Author: Remi Meier <remi.me...@inf.ethz.ch>
Branch: stmgc-c7
Changeset: r74616:71d03ab2f30b
Date: 2014-11-20 16:47 +0100
http://bitbucket.org/pypy/pypy/changeset/71d03ab2f30b/

Log:    fix plot to show all threads

diff --git a/pypy/stm/plot_stm_log.py b/pypy/stm/plot_stm_log.py
--- a/pypy/stm/plot_stm_log.py
+++ b/pypy/stm/plot_stm_log.py
@@ -107,17 +107,25 @@
                 tr.pauses[-1] = (tr.pauses[-1][0], entry.timestamp)
 
 
-        # attach logentry as transaction info
+        # attach logentry as clickable transaction info
         tr = curr_trs.get(th_num)
+        if tr is None:
+            # no current transaction
+            # try to attach it to the last transaction
+            tr = finished_trs.get(th_num, [None])[-1]
         if tr is not None:
             tr.info.append(str(entry))
-        if entry.event in (psl.STM_ABORTING_OTHER_CONTENTION,):
+        # also affects other transaction:
+        if entry.marker2:
             tr2 = curr_trs.get(entry.otherthreadnum)
+            if tr2 is None:
+                tr2 = finished_trs.get(entry.otherthreadnum, [None])[-1]
             if tr2 is not None:
                 tr2.info.append(str(entry))
 
 
 
+
     # plt.ion()
     for th_num, trs in finished_trs.items():
         # plt.draw()
@@ -170,9 +178,9 @@
     thread_count = len(trs)
 
     axs[0].set_ylabel("Thread")
-    axs[0].set_ylim(0, thread_count)
-    axs[0].set_yticks([r+0.5 for r in range(thread_count)])
-    axs[0].set_yticklabels(range(thread_count))
+    axs[0].set_ylim(0, thread_count+2)
+    axs[0].set_yticks([r+0.5 for r in range(thread_count+1)])
+    axs[0].set_yticklabels(range(thread_count+1))
     #axs[0].set_xticks([])
     print "Drawn."
 
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to