aboutsummaryrefslogtreecommitdiff
path: root/include/pub_tool_tooliface.h
diff options
context:
space:
mode:
authorsewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9>2006-12-23 01:21:12 +0000
committersewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9>2006-12-23 01:21:12 +0000
commit975618137c5e56cc8f633d5747727f26e2fbc90b (patch)
treec87d8d328cb53c99fc9662521632d58574945d08 /include/pub_tool_tooliface.h
parentbf57ce7d35884056dfc780bd8755f03f21af3fa3 (diff)
downloadvalgrind-975618137c5e56cc8f633d5747727f26e2fbc90b.tar.gz
Change the core-tool interface 'thread_run' event to be more useful:
- Rename the event to 'thread_runstate'. - Add arguments: pass also a boolean indicating whether the thread is running or stopping, and a 64-bit int showing how many blocks overall have run, so tools can make a rough estimate of workload. The boolean allows tools to see threads starting and stopping. Prior to this, de-schedule events were invisible to tools. - Call the callback (hand the event to tools) just before client code is run, and again immediately after it stops running. This should give correct sequencing w.r.t posting of thread creation/ destruction events. In order to make callgrind work without complex changes, I added a simple impedance-matching function 'clg_thread_runstate_callback' which hands thread-run events onwards to CLG_(thread_run). Use this new 'thread_runstate' with care: it will be called before and after every translation, which means it will be called ~500k times in a startup of firefox. So the callback needs to be fast. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6413 a5019735-40e9-0310-863c-91ae7b9d1cf9
Diffstat (limited to 'include/pub_tool_tooliface.h')
-rw-r--r--include/pub_tool_tooliface.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/include/pub_tool_tooliface.h b/include/pub_tool_tooliface.h
index be530a4b1..a3f1b6ce4 100644
--- a/include/pub_tool_tooliface.h
+++ b/include/pub_tool_tooliface.h
@@ -537,7 +537,19 @@ void VG_(track_post_reg_write_clientcall_return)(
/* Scheduler events (not exhaustive) */
-void VG_(track_thread_run)(void(*f)(ThreadId tid));
+
+/* 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.
+*/
+void VG_(track_thread_runstate)(
+ void(*f)(ThreadId tid, Bool running, ULong blocks_dispatched)
+ );
/* Thread events (not exhaustive)