[pypy-svn] r76956 - pypy/branch/rsocket-improvements/pypy/jit/tool

fijal at codespeak.net fijal at codespeak.net
Thu Sep 9 02:02:43 CEST 2010


Author: fijal
Date: Thu Sep  9 02:02:42 2010
New Revision: 76956

Modified:
   pypy/branch/rsocket-improvements/pypy/jit/tool/traceviewer.py
Log:
Update this tool (how-this-could-have-ever-worked kind of checkin)


Modified: pypy/branch/rsocket-improvements/pypy/jit/tool/traceviewer.py
==============================================================================
--- pypy/branch/rsocket-improvements/pypy/jit/tool/traceviewer.py	(original)
+++ pypy/branch/rsocket-improvements/pypy/jit/tool/traceviewer.py	Thu Sep  9 02:02:42 2010
@@ -250,13 +250,14 @@
 class Counts(dict):
     pass
 
-def main(loopfile, options, view=True):
+def main(loopfile, use_threshold, view=True):
     countname = py.path.local(loopfile + '.count')
     if countname.check():
-        counts = [line.rsplit(':', 1) for line in countname.readlines()]
-        counts = Counts([(k, int(v.strip('\n'))) for k, v in counts])
+        counts = [re.split(r' +', line, 1) for line in countname.readlines()]
+        counts = Counts([(k.strip("\n"), int(v.strip('\n')))
+                         for v, k in counts])
         l = list(sorted(counts.values()))
-        if len(l) > 20 and options.use_threshold:
+        if len(l) > 20 and use_threshold:
             counts.threshold = l[-20]
         else:
             counts.threshold = 0
@@ -274,7 +275,7 @@
 if __name__ == '__main__':
     parser = optparse.OptionParser(usage=__doc__)
     parser.add_option('--use-threshold', dest='use_threshold',
-                      action="store_true")
+                      action="store_true", default=False)
     options, args = parser.parse_args(sys.argv)
     if len(args) != 2:
         print __doc__



More information about the Pypy-commit mailing list