1. Pypy
  2. Untitled project
  3. jitviewer

Commits

Maciej Fijalkowski  committed 3419b0f

attach count to loops

  • Participants
  • Parent commits 27e8bf0
  • Branches default

Comments (0)

Files changed (3)

File baseviewer.py

View file
  • Ignore whitespace
 def main():
     log = parse_log_file('log')
     storage = LoopStorage()
-    #log_counts = parse_log_counts(open('log.count').readlines())
-    storage.reconnect_loops([parse(l) for l in
-                             extract_category(log, "jit-log-opt-")])
+    loops = [parse(l) for l in extract_category(log, "jit-log-opt-")]
+    parse_log_counts(open('log.count').readlines(), loops)
+    storage.reconnect_loops(loops)
     app = flask.Flask(__name__)
     server = Server(storage)
     app.debug = True

File loops.py

View file
  • Ignore whitespace
                 print >>out, "  ", source
             chunk.pretty_print(out)
 
-def parse_log_counts(lines):
+def parse_log_counts(lines, loops):
     nums = []
     i = 0
     for line in lines:
         if line:
             num, count = line.split(':')
             assert int(num) == i
-            nums.append(int(count))
+            count = int(count)
+            nums.append(count)
+            loops[i].count = count
             i += 1
     return nums
 

File test/test_loops.py

View file
  • Ignore whitespace
 '''.split("\n")
 
 def test_parse_log_count():
-    nums = parse_log_counts(LINES)
+    class Loop(object):
+        pass
+    
+    loops = [Loop() for i in range(13)]
+    nums = parse_log_counts(LINES, loops)
     assert nums[5] == 2000
+    assert loops[9].count == 2000