1
# Copyright (c) 2001-2007 Twisted Matrix Laboratories.
2
# See LICENSE for details.
5
DEPRECATED since Twisted 8.0.
7
Utility functions for reporting bytecode frequencies to Skip Montanaro's
10
This module requires a version of Python build with DYNAMIC_EXCUTION_PROFILE,
11
and optionally DXPAIRS, defined to be useful.
14
import sys, types, xmlrpclib, warnings
17
warnings.warn("twisted.python.dxprofile is deprecated since Twisted 8.0.",
18
category=DeprecationWarning)
23
Run length encode a list.
25
iterable = iter(iterable)
29
previous = iterable.next()
32
for element in iterable:
33
if element == previous:
37
if isinstance(previous, (types.ListType, types.TupleType)):
38
previous = rle(previous)
39
result.append([previous, runlen])
42
if isinstance(previous, (types.ListType, types.TupleType)):
43
previous = rle(previous)
44
result.append([previous, runlen])
49
def report(email, appname):
51
Send an RLE encoded version of sys.getdxp() off to our Top Men (tm)
54
if hasattr(sys, 'getdxp') and appname:
55
dxp = xmlrpclib.ServerProxy("http://manatee.mojam.com:7304")
56
dxp.add_dx_info(appname, email, sys.version_info[:3], rle(sys.getdxp()))