Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r1458:32dbfbd04b6f
Date: 2014-10-05 14:50 +0200
http://bitbucket.org/pypy/stmgc/changeset/32dbfbd04b6f/

Log:    Must also dump the number of the other thread.

diff --git a/c7/stm/prof.c b/c7/stm/prof.c
--- a/c7/stm/prof.c
+++ b/c7/stm/prof.c
@@ -14,6 +14,7 @@
         uint32_t tv_sec;
         uint32_t tv_nsec;
         uint32_t thread_num;
+        uint32_t other_thread_num;
         uint8_t event;
         uint8_t marker_length[2];
         char extra[256];
@@ -25,11 +26,14 @@
     buf.tv_sec = t.tv_sec;
     buf.tv_nsec = t.tv_nsec;
     buf.thread_num = tl->thread_local_counter;
+    buf.other_thread_num = 0;
     buf.event = event;
 
     int len0 = 0;
     int len1 = 0;
     if (markers != NULL) {
+        if (markers[1].tl != NULL)
+            buf.other_thread_num = markers[1].tl->thread_local_counter;
         if (markers[0].odd_number != 0)
             len0 = profiling_expand_marker(&markers[0], buf.extra, 128);
         if (markers[1].odd_number != 0)
diff --git a/c7/test/test_prof.py b/c7/test/test_prof.py
--- a/c7/test/test_prof.py
+++ b/c7/test/test_prof.py
@@ -10,12 +10,12 @@
     assert header == "STMGC-C7-PROF01\n"
     result = []
     while True:
-        packet = f.read(15)
+        packet = f.read(19)
         if not packet: break
-        sec, nsec, threadnum, event, len0, len1 = \
-              struct.unpack("IIIBBB", packet)
+        sec, nsec, threadnum, otherthreadnum, event, len0, len1 = \
+              struct.unpack("IIIIBBB", packet)
         result.append((sec + 0.000000001 * nsec,
-                       threadnum,
+                       (threadnum, otherthreadnum),
                        event,
                        f.read(len0),
                        f.read(len1)))
@@ -65,13 +65,13 @@
             lib.stm_set_timing_log(ffi.NULL, ffi.NULL)
 
         result = read_log(filename)
-        id0 = result[0][1]
-        id1 = result[1][1]
-        assert result[0][1:5] == (id0, lib.STM_TRANSACTION_START, '', '')
-        assert result[1][1:5] == (id1, lib.STM_TRANSACTION_START, '', '')
-        assert result[2][1:5] == (id1, lib.STM_GC_MINOR_START, '', '')
-        assert result[3][1:5] == (id1, lib.STM_GC_MINOR_DONE, '', '')
-        assert result[4][1:5] == (id1, lib.STM_CONTENTION_WRITE_READ,
+        id0 = result[0][1][0]
+        id1 = result[1][1][0]
+        assert result[0][1:5] == ((id0, 0), lib.STM_TRANSACTION_START, '', '')
+        assert result[1][1:5] == ((id1, 0), lib.STM_TRANSACTION_START, '', '')
+        assert result[2][1:5] == ((id1, 0), lib.STM_GC_MINOR_START, '', '')
+        assert result[3][1:5] == ((id1, 0), lib.STM_GC_MINOR_DONE, '', '')
+        assert result[4][1:5] == ((id1, id0), lib.STM_CONTENTION_WRITE_READ,
                                   chr(119), '')
-        assert result[5][1:5] == (id1, lib.STM_TRANSACTION_ABORT, '', '')
+        assert result[5][1:5] == ((id1, 0), lib.STM_TRANSACTION_ABORT, '', '')
         assert len(result) == 6
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to