stop_client_code, which is a bit clearer and easier to work with.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6418
/*--- 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;
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)();
}
}
// 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;
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;
}
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;
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;
}
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)
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);
/* 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)
);
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 *
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
/*--------------------------------------------------------------------*/