Author: Armin Rigo <[email protected]>
Branch: stmgc-c7
Changeset: r73782:34ec42503109
Date: 2014-10-05 15:23 +0200
http://bitbucket.org/pypy/pypy/changeset/34ec42503109/
Log: Print the source code line, if found
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
@@ -1,6 +1,6 @@
#!/usr/bin/env python
import sys
-import struct
+import struct, re, linecache
# ____________________________________________________________
@@ -107,6 +107,17 @@
return self.aborted_time + self.paused_time
+r_marker = re.compile(r'File "(.+)", line (\d+)')
+
+def print_marker(marker):
+ print ' ' + marker
+ match = r_marker.match(marker)
+ if match:
+ line = linecache.getline(match.group(1), int(match.group(2)))
+ line = line.strip()
+ if line:
+ print ' ' + line
+
def percent(fraction, total):
r = '%.1f' % (fraction * 100.0 / total)
if len(r) > 3:
@@ -158,11 +169,11 @@
#
values = sorted(conflicts.values(), key=ConflictSummary.sortkey)
for c in values[-1:-15:-1]:
- print '%.3fs lost in aborts, %.3fs paused (%s)' % (
- c.aborted_time, c.paused_time, event_name[c.event])
- print ' ', c.marker1
+ print '%.3fs lost in aborts, %.3fs paused (%dx %s)' % (
+ c.aborted_time, c.paused_time, c.num_events, event_name[c.event])
+ print_marker(c.marker1)
if c.marker2:
- print ' ', c.marker2
+ print_marker(c.marker2)
print
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit