[pypy-commit] pypy stmgc-c7: less inevitable transactions when using print_abort_info

Raemi noreply at buildbot.pypy.org
Mon May 12 09:18:25 CEST 2014


Author: Remi Meier <remi.meier at inf.ethz.ch>
Branch: stmgc-c7
Changeset: r71469:65abf162d582
Date: 2014-05-12 09:17 +0200
http://bitbucket.org/pypy/pypy/changeset/65abf162d582/

Log:	less inevitable transactions when using print_abort_info

diff --git a/lib_pypy/atomic.py b/lib_pypy/atomic.py
--- a/lib_pypy/atomic.py
+++ b/lib_pypy/atomic.py
@@ -50,16 +50,18 @@
         info = _thread.longest_abort_info(mintime)
         if info is None:
             return
+
+        output = []
         with atomic:
-            print >> sys.stderr, "Conflict",
+            output.append("Conflict ")
             a, b, c, d = info
             try:
                 reason = _timing_reasons[a]
             except IndexError:
                 reason = "'%s'" % (a,)
-            print >> sys.stderr, reason,
+            output.append(reason)
             def show(line):
-                print >> sys.stderr, " ", line
+                output.append("  %s\n" % line)
                 match = _r_line.match(line)
                 if match and match.group(1) != '?':
                     filename = match.group(1)
@@ -82,14 +84,14 @@
                         filename = _fullfilenames[filename]
                     line = linecache.getline(filename, lineno)
                     if line:
-                        print >> sys.stderr, "   ", line.strip()
+                        output.append("    %s\n" % line.strip())
             if d:
-                print >> sys.stderr, "between two threads:"
+                output.append(" between two threads:\n")
                 show(c)
                 show(d)
             else:
-                print >> sys.stderr, "in this thread:"
+                output.append(" in this thread:\n")
                 show(c)
-            print >> sys.stderr, 'Lost %.6f seconds.' % (b,)
-            print >> sys.stderr
+            output.append('Lost %.6f seconds.\n\n' % (b,))
             _thread.reset_longest_abort_info()
+        print >> sys.stderr, "".join(output),


More information about the pypy-commit mailing list