[pypy-commit] pypy stmgc-c8-gcc: Accept a 2nd argument, which is the number of conflict entries to report

arigo noreply at buildbot.pypy.org
Tue Sep 1 19:20:29 CEST 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: stmgc-c8-gcc
Changeset: r79360:6521053a52f2
Date: 2015-09-01 18:04 +0200
http://bitbucket.org/pypy/pypy/changeset/6521053a52f2/

Log:	Accept a 2nd argument, which is the number of conflict entries to
	report

diff --git a/pypy/stm/print_stm_log.py b/pypy/stm/print_stm_log.py
--- a/pypy/stm/print_stm_log.py
+++ b/pypy/stm/print_stm_log.py
@@ -301,7 +301,7 @@
     stmlog.threads = threads
     stmlog.conflicts = conflicts
 
-def dump_summary(stmlog):
+def dump_summary(stmlog, maxcount=15):
     start_time = stmlog.start_time
     total_time = stmlog.total_time
     print
@@ -330,7 +330,7 @@
     print
     #
     values = stmlog.get_conflicts()
-    for c in values[:15]:
+    for c in values[:maxcount]:
         intervals = 60
         timeline = [0] * intervals
         for t in c.timestamps:
@@ -375,13 +375,17 @@
             total += c.num_events
         return total
 
-    def dump(self):
-        dump_summary(self)
+    def dump(self, maxcount=15):
+        dump_summary(self, maxcount)
 
 
 def main(argv):
-    assert len(argv) == 1, "expected a filename argument"
-    StmLog(argv[0]).dump()
+    assert len(argv) >= 1, "expected a filename argument"
+    if len(argv) > 1:
+        maxcount = int(argv[1])
+    else:
+        maxcount = 5
+    StmLog(argv[0]).dump(maxcount)
     return 0
 
 if __name__ == '__main__':


More information about the pypy-commit mailing list