]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Split the thread_runstate event into two, start_client_code and
authorNicholas Nethercote <njn@valgrind.org>
Sun, 24 Dec 2006 07:51:17 +0000 (07:51 +0000)
committerNicholas Nethercote <njn@valgrind.org>
Sun, 24 Dec 2006 07:51:17 +0000 (07:51 +0000)
stop_client_code, which is a bit clearer and easier to work with.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6418

callgrind/main.c
coregrind/m_scheduler/scheduler.c
coregrind/m_tooliface.c
coregrind/pub_core_tooliface.h
include/pub_tool_tooliface.h

index 5b31e90323cf760e1c6cbcf694ebc7234b343710..00646629c3bf0bd82b64c05cb0c78949d3c1e16d 100644 (file)
@@ -1022,17 +1022,12 @@ void CLG_(fini)(Int exitcode)
 /*--- Setup                                                        ---*/
 /*--------------------------------------------------------------------*/
 
-static void clg_thread_runstate_callback ( ThreadId tid,
-                                           Bool is_running, 
-                                           ULong blocks_done )
+static void clg_start_client_code_callback ( ThreadId tid, ULong blocks_done )
 {
    static ULong last_blocks_done = 0;
 
    if (0)
-      VG_(printf)("%d %c %llu\n", 
-                  (Int)tid, is_running ? 'R' : 's', blocks_done);
-
-   if (!is_running) return;
+      VG_(printf)("%d R %llu\n", (Int)tid, blocks_done);
 
    /* throttle calls to CLG_(run_thread) by number of BBs executed */
    if (blocks_done - last_blocks_done < 5000) return;
@@ -1107,9 +1102,9 @@ void CLG_(pre_clo_init)(void)
     VG_(needs_syscall_wrapper)(CLG_(pre_syscalltime),
                               CLG_(post_syscalltime));
 
-    VG_(track_thread_runstate) ( & clg_thread_runstate_callback );
-    VG_(track_pre_deliver_signal)  ( & CLG_(pre_signal) );
-    VG_(track_post_deliver_signal)  ( & CLG_(post_signal) );
+    VG_(track_start_client_code)  ( & clg_start_client_code_callback );
+    VG_(track_pre_deliver_signal) ( & CLG_(pre_signal) );
+    VG_(track_post_deliver_signal)( & CLG_(post_signal) );
 
     CLG_(set_clo_defaults)();
 }
index 27bff8989d0bca899fdaabb9ecb56e16022d48c1..cb8fc0f423442a50dad2d3a9b74f092ab6f327b3 100644 (file)
@@ -613,7 +613,7 @@ static UInt run_thread_for_a_while ( ThreadId tid )
    }
 
    // Tell the tool this thread is about to run client code
-   VG_TRACK( thread_runstate, tid, True, bbs_done );
+   VG_TRACK( start_client_code, tid, bbs_done );
 
    vg_assert(VG_(in_generated_code) == False);
    VG_(in_generated_code) = True;
@@ -641,7 +641,7 @@ static UInt run_thread_for_a_while ( ThreadId tid )
    bbs_done += (ULong)done_this_time;
 
    // Tell the tool this thread has stopped running client code
-   VG_TRACK( thread_runstate, tid, False, bbs_done );
+   VG_TRACK( stop_client_code, tid, bbs_done );
 
    return trc;
 }
@@ -690,7 +690,7 @@ static UInt run_noredir_translation ( Addr hcode, ThreadId tid )
    argblock[3] = 0; /* guest state ptr afterwards is written here */
 
    // Tell the tool this thread is about to run client code
-   VG_TRACK( thread_runstate, tid, True, bbs_done );
+   VG_TRACK( start_client_code, tid, bbs_done );
 
    vg_assert(VG_(in_generated_code) == False);
    VG_(in_generated_code) = True;
@@ -723,7 +723,7 @@ static UInt run_noredir_translation ( Addr hcode, ThreadId tid )
    bbs_done++;
 
    // Tell the tool this thread has stopped running client code
-   VG_TRACK( thread_runstate, tid, False, bbs_done );
+   VG_TRACK( stop_client_code, tid, bbs_done );
 
    return retval;
 }
index cb0bef99436105045f492e8d8b85956987c08722..6d4f2437a3ff432112231f91c23590272fd83cf1 100644 (file)
@@ -321,7 +321,8 @@ DEF(track_post_reg_write,        CorePart, ThreadId,        OffT, SizeT)
 
 DEF(track_post_reg_write_clientcall_return, ThreadId, OffT, SizeT, Addr)
 
-DEF(track_thread_runstate,       ThreadId, Bool, ULong)
+DEF(track_start_client_code,     ThreadId, ULong)
+DEF(track_stop_client_code,      ThreadId, ULong)
 
 DEF(track_post_thread_create,    ThreadId, ThreadId)
 DEF(track_post_thread_join,      ThreadId, ThreadId)
index f74f24e32ab573beaa32669a8aa947a8e5391212..a8151cdadd9e67f34fd10b76f56d45251e31a221 100644 (file)
@@ -200,7 +200,8 @@ typedef struct {
    void (*track_post_reg_write)(CorePart, ThreadId,        OffT, SizeT);
    void (*track_post_reg_write_clientcall_return)(ThreadId, OffT, SizeT, Addr);
 
-   void (*track_thread_runstate)(ThreadId, Bool, ULong);
+   void (*track_start_client_code)(ThreadId, ULong);
+   void (*track_stop_client_code) (ThreadId, ULong);
 
    void (*track_post_thread_create)(ThreadId, ThreadId);
    void (*track_post_thread_join)  (ThreadId, ThreadId);
index 664a19dde9414dd629d413d5c8e02c5e29f4390a..f2f7c845341ab1780c833a8e95b12d4998ffd275 100644 (file)
@@ -539,16 +539,19 @@ void VG_(track_post_reg_write_clientcall_return)(
 /* Scheduler events (not exhaustive) */
 
 /* Called when 'tid' starts or stops running client code blocks.
-   Gives the total dispatched block count at that event.  Note, this
-   is not the same as 'tid' holding the BigLock: a thread can hold the
-   lock for other purposes (making translations, etc) yet not be
-   running client blocks.  Obviously though, a thread must hold the
-   lock in order to run client code blocks, so the times bracketed by
-   thread_runstate(tid, True, ..) .. thread_runstate(tid, False, ..)
-   are a subset of the times when 'tid' holds the cpu lock.
+   Gives the total dispatched block count at that event.  Note, this is
+   not the same as 'tid' holding the BigLock (the lock that ensures that
+   only one thread runs at a time): a thread can hold the lock for other
+   purposes (making translations, etc) yet not be running client blocks.
+   Obviously though, a thread must hold the lock in order to run client
+   code blocks, so the times bracketed by 'thread_run'..'thread_runstate'
+   are a subset of the times when thread 'tid' holds the cpu lock.
 */
-void VG_(track_thread_runstate)(
-        void(*f)(ThreadId tid, Bool running, ULong blocks_dispatched)
+void VG_(track_start_client_code)(
+        void(*f)(ThreadId tid, ULong blocks_dispatched)
+     );
+void VG_(track_stop_client_code)(
+        void(*f)(ThreadId tid, ULong blocks_dispatched)
      );
 
 
@@ -560,6 +563,7 @@ void VG_(track_thread_runstate)(
 void VG_(track_post_thread_create)(void(*f)(ThreadId tid, ThreadId child));
 void VG_(track_post_thread_join)  (void(*f)(ThreadId joiner, ThreadId joinee));
 
+
 /* Mutex events (not exhaustive)
    "void *mutex" is really a pthread_mutex *
 
@@ -587,10 +591,6 @@ void VG_(track_pre_deliver_signal) (void(*f)(ThreadId tid, Int sigNo,
    handler longjmps, this won't be called.  */
 void VG_(track_post_deliver_signal)(void(*f)(ThreadId tid, Int sigNo));
 
-/* Others... condition variables...
-   ...
- */
-
 #endif   // __PUB_TOOL_TOOLIFACE_H
 
 /*--------------------------------------------------------------------*/