Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(239)

Side by Side Diff: third_party/twisted_8_1/twisted/python/dxprofile.py

Issue 12261012: Remove third_party/twisted_8_1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 # Copyright (c) 2001-2007 Twisted Matrix Laboratories.
2 # See LICENSE for details.
3
4 """
5 DEPRECATED since Twisted 8.0.
6
7 Utility functions for reporting bytecode frequencies to Skip Montanaro's
8 stat collector.
9
10 This module requires a version of Python build with DYNAMIC_EXCUTION_PROFILE,
11 and optionally DXPAIRS, defined to be useful.
12 """
13
14 import sys, types, xmlrpclib, warnings
15
16
17 warnings.warn("twisted.python.dxprofile is deprecated since Twisted 8.0.",
18 category=DeprecationWarning)
19
20
21 def rle(iterable):
22 """
23 Run length encode a list.
24 """
25 iterable = iter(iterable)
26 runlen = 1
27 result = []
28 try:
29 previous = iterable.next()
30 except StopIteration:
31 return []
32 for element in iterable:
33 if element == previous:
34 runlen = runlen + 1
35 continue
36 else:
37 if isinstance(previous, (types.ListType, types.TupleType)):
38 previous = rle(previous)
39 result.append([previous, runlen])
40 previous = element
41 runlen = 1
42 if isinstance(previous, (types.ListType, types.TupleType)):
43 previous = rle(previous)
44 result.append([previous, runlen])
45 return result
46
47
48
49 def report(email, appname):
50 """
51 Send an RLE encoded version of sys.getdxp() off to our Top Men (tm)
52 for analysis.
53 """
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()))
OLDNEW
« no previous file with comments | « third_party/twisted_8_1/twisted/python/dist.py ('k') | third_party/twisted_8_1/twisted/python/failure.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698