|
From: <sv...@va...> - 2006-12-24 07:51:24
|
Author: njn
Date: 2006-12-24 07:51:17 +0000 (Sun, 24 Dec 2006)
New Revision: 6418
Log:
Split the thread_runstate event into two, start_client_code and
stop_client_code, which is a bit clearer and easier to work with.
Modified:
trunk/callgrind/main.c
trunk/coregrind/m_scheduler/scheduler.c
trunk/coregrind/m_tooliface.c
trunk/coregrind/pub_core_tooliface.h
trunk/include/pub_tool_tooliface.h
Modified: trunk/callgrind/main.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/callgrind/main.c 2006-12-24 03:02:18 UTC (rev 6417)
+++ trunk/callgrind/main.c 2006-12-24 07:51:17 UTC (rev 6418)
@@ -1022,18 +1022,13 @@
/*--- Setup ---*/
/*--------------------------------------------------------------------*/
=20
-static void clg_thread_runstate_callback ( ThreadId tid,
- Bool is_running,=20
- ULong blocks_done )
+static void clg_start_client_code_callback ( ThreadId tid, ULong blocks_=
done )
{
static ULong last_blocks_done =3D 0;
=20
if (0)
- VG_(printf)("%d %c %llu\n",=20
- (Int)tid, is_running ? 'R' : 's', blocks_done);
+ VG_(printf)("%d R %llu\n", (Int)tid, blocks_done);
=20
- if (!is_running) return;
-
/* throttle calls to CLG_(run_thread) by number of BBs executed */
if (blocks_done - last_blocks_done < 5000) return;
last_blocks_done =3D blocks_done;
@@ -1107,9 +1102,9 @@
VG_(needs_syscall_wrapper)(CLG_(pre_syscalltime),
CLG_(post_syscalltime));
=20
- 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) );
=20
CLG_(set_clo_defaults)();
}
Modified: trunk/coregrind/m_scheduler/scheduler.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_scheduler/scheduler.c 2006-12-24 03:02:18 UTC (rev =
6417)
+++ trunk/coregrind/m_scheduler/scheduler.c 2006-12-24 07:51:17 UTC (rev =
6418)
@@ -613,7 +613,7 @@
}
=20
// 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 );
=20
vg_assert(VG_(in_generated_code) =3D=3D False);
VG_(in_generated_code) =3D True;
@@ -641,7 +641,7 @@
bbs_done +=3D (ULong)done_this_time;
=20
// 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 );
=20
return trc;
}
@@ -690,7 +690,7 @@
argblock[3] =3D 0; /* guest state ptr afterwards is written here */
=20
// 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 );
=20
vg_assert(VG_(in_generated_code) =3D=3D False);
VG_(in_generated_code) =3D True;
@@ -723,7 +723,7 @@
bbs_done++;
=20
// 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 );
=20
return retval;
}
Modified: trunk/coregrind/m_tooliface.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_tooliface.c 2006-12-24 03:02:18 UTC (rev 6417)
+++ trunk/coregrind/m_tooliface.c 2006-12-24 07:51:17 UTC (rev 6418)
@@ -321,7 +321,8 @@
=20
DEF(track_post_reg_write_clientcall_return, ThreadId, OffT, SizeT, Addr)
=20
-DEF(track_thread_runstate, ThreadId, Bool, ULong)
+DEF(track_start_client_code, ThreadId, ULong)
+DEF(track_stop_client_code, ThreadId, ULong)
=20
DEF(track_post_thread_create, ThreadId, ThreadId)
DEF(track_post_thread_join, ThreadId, ThreadId)
Modified: trunk/coregrind/pub_core_tooliface.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/pub_core_tooliface.h 2006-12-24 03:02:18 UTC (rev 641=
7)
+++ trunk/coregrind/pub_core_tooliface.h 2006-12-24 07:51:17 UTC (rev 641=
8)
@@ -200,7 +200,8 @@
void (*track_post_reg_write)(CorePart, ThreadId, OffT, SizeT);
void (*track_post_reg_write_clientcall_return)(ThreadId, OffT, SizeT,=
Addr);
=20
- void (*track_thread_runstate)(ThreadId, Bool, ULong);
+ void (*track_start_client_code)(ThreadId, ULong);
+ void (*track_stop_client_code) (ThreadId, ULong);
=20
void (*track_post_thread_create)(ThreadId, ThreadId);
void (*track_post_thread_join) (ThreadId, ThreadId);
Modified: trunk/include/pub_tool_tooliface.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/include/pub_tool_tooliface.h 2006-12-24 03:02:18 UTC (rev 6417)
+++ trunk/include/pub_tool_tooliface.h 2006-12-24 07:51:17 UTC (rev 6418)
@@ -539,17 +539,20 @@
/* Scheduler events (not exhaustive) */
=20
/* 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)
+ );
=20
=20
/* Thread events (not exhaustive)
@@ -560,6 +563,7 @@
void VG_(track_post_thread_create)(void(*f)(ThreadId tid, ThreadId child=
));
void VG_(track_post_thread_join) (void(*f)(ThreadId joiner, ThreadId jo=
inee));
=20
+
/* Mutex events (not exhaustive)
"void *mutex" is really a pthread_mutex *
=20
@@ -587,10 +591,6 @@
handler longjmps, this won't be called. */
void VG_(track_post_deliver_signal)(void(*f)(ThreadId tid, Int sigNo));
=20
-/* Others... condition variables...
- ...
- */
-
#endif // __PUB_TOOL_TOOLIFACE_H
=20
/*--------------------------------------------------------------------*/
|