[m-rev.] diff: Fix ThreadScope profiling when using dependent parallel conjunctions.

Paul Bone pbone at csse.unimelb.edu.au
Sun Oct 10 10:42:58 AEDT 2010


Fix ThreadScope profiling when using dependent parallel conjunctions.

A bug caused the ThreadScope profile to be malformed, it would show threads
begin execution and then resume execution without stopping execution in
between.

runtime/mercury_par_builtin.h:
    Post a ThreadScope event when a context becomes blocked on a future.

Index: runtime/mercury_par_builtin.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_par_builtin.h,v
retrieving revision 1.1
diff -u -p -b -r1.1 mercury_par_builtin.h
--- runtime/mercury_par_builtin.h	11 Jun 2009 08:28:32 -0000	1.1
+++ runtime/mercury_par_builtin.h	9 Oct 2010 23:20:58 -0000
@@ -20,6 +20,7 @@ vim: ft=c ts=4 sw=4 et
 
 #include "mercury_context.h"
 #include "mercury_thread.h"
+#include "mercury_threadscope.h"
 
 #ifdef MR_THREAD_SAFE
 
@@ -131,11 +132,24 @@ vim: ft=c ts=4 sw=4 et
                                                                             \
                 MR_UNLOCK(&(Future->MR_fut_lock), "future.wait");           \
                                                                             \
+                MR_maybe_post_stop_context;                                 \
                 MR_ENGINE(MR_eng_this_context) = NULL;                      \
                 MR_runnext();                                               \
             }                                                               \
         } while (0)
 
+#ifdef MR_THREADSCOPE
+    #define MR_maybe_post_stop_context                                      \
+        do {                                                                \
+            MR_threadscope_post_stop_context(MR_TS_STOP_REASON_BLOCKED);    \
+        } while (0)
+
+#else
+    #define MR_maybe_post_stop_context                                      \
+        do {                                                                \
+        } while (0)
+#endif
+
     #define MR_par_builtin_get_future(Future, Value)                        \
         do {                                                                \
             assert(Future->MR_fut_signalled);                               \
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20101010/c142399b/attachment.sig>


More information about the reviews mailing list