Commits

Remi Meier  committed 0874e8e

stm: log and plot should_commit events

  • Participants
  • Parent commits ac4ab9e
  • Branches stm-logging

Comments (0)

Files changed (3)

File pypy/tool/plot_log.py

 
 BOX_HEIGHT = 0.8
 HALF_HEIGHT = 0.1 + BOX_HEIGHT / 2
+QUARTER_HEIGHT = 0.1 + BOX_HEIGHT / 4
 
 def plot_boxes(boxes, y, ax):
     coords = [(x, w) for x, w, c, i in boxes]
         boxes = []
         hlines = []
         atomics = []
+        should_commits = []
         current_atomic = 0
         program_aborted = None
         for time, kind, line_dict in logs[tid]:
                             picker=True, antialiased=False, rasterized=True)
                 [setattr(m, "info", str(tid)) for m in k]
                 end_time = time
-                
+            elif kind == EventTypes.SHOULD_COMMIT:
+                should_commits.append(time)
+
         if current_atomic and args.atomic:
             print "ERROR: Finished transaction is still atomic"
+
         plot_boxes(boxes, tid, ax)
         plot_hlines(hlines, tid, ax)
+
+        if should_commits:
+            ax.plot(should_commits, [tid+QUARTER_HEIGHT] * len(should_commits),
+                    'y+', mew=2, markersize=8,
+                    antialiased=False, rasterized=True)
+
         if end_time == 0:
             k = ax.plot(start_time, tid+HALF_HEIGHT, 'c>',
                         time, tid+HALF_HEIGHT, 'y*', markersize=8,
                         picker=True, antialiased=False, rasterized=True)
             [setattr(m, "info", str(tid)) for m in k]
+
         if program_aborted is not None:
             k = ax.plot(program_aborted, tid+HALF_HEIGHT, 'wo',
                         markersize=30, mew=5, mec='r',
         else:
             print "== pick ==\nCould not find info"
 
-            
+
 ############## MAIN ################
 
 def main():

File pypy/tool/stmlogparser.py

         state['type'] = EventTypes.DESCRIPTOR_INIT
     elif 'DESCRIPTOR_DONE' in reason:
         state['type'] = EventTypes.DESCRIPTOR_DONE
+    elif 'SHOULD_COMMIT' in reason:
+        state['type'] = EventTypes.SHOULD_COMMIT
+    else:
+        print "IGNORED reason:", reason
 
 
 
     DEC_ATOMIC               = 7
     DESCRIPTOR_INIT          = 8
     DESCRIPTOR_DONE          = 9
-
-    
+    SHOULD_COMMIT            = 10

File pypy/translator/stm/src_stm/rpyintf.c

 void stm_should_commit(void)
 {
   struct tx_descriptor *d = thread_descriptor;
+
+  stm_print_trace_formatted("SHOULD_COMMIT");
   d->reads_size_limit_nonatomic = 0;
   update_reads_size_limit(d);
 }