From: Nicholas Nethercote Date: Mon, 2 Aug 2004 15:27:22 +0000 (+0000) Subject: Scheduler counts don't need to be in vg_include.h. Replace with a print X-Git-Tag: svn/VALGRIND_2_2_0~85 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3ef40799acaad3cbb0ea55ddc43616733bd234cc;p=thirdparty%2Fvalgrind.git Scheduler counts don't need to be in vg_include.h. Replace with a print function. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2551 --- diff --git a/coregrind/vg_include.h b/coregrind/vg_include.h index c6d45b7d31..f5b8669146 100644 --- a/coregrind/vg_include.h +++ b/coregrind/vg_include.h @@ -1358,10 +1358,7 @@ extern UInt VG_(bb_dechain_count); /* Number of unchained jumps performed. */ extern UInt VG_(unchained_jumps_done); - -/* Counts pertaining to the scheduler. */ -extern UInt VG_(num_scheduling_events_MINOR); -extern UInt VG_(num_scheduling_events_MAJOR); +extern void VG_(print_scheduler_stats) ( void ); /* --------------------------------------------------------------------- Exports of vg_memory.c diff --git a/coregrind/vg_main.c b/coregrind/vg_main.c index def1d0d87a..990b70c2d1 100644 --- a/coregrind/vg_main.c +++ b/coregrind/vg_main.c @@ -201,11 +201,6 @@ UInt VG_(unchained_jumps_done) = 0; static UInt sanity_fast_count = 0; static UInt sanity_slow_count = 0; -/* Counts pertaining to the scheduler. */ -UInt VG_(num_scheduling_events_MINOR) = 0; -UInt VG_(num_scheduling_events_MAJOR) = 0; - - static __inline__ Int safe_idiv(Int a, Int b) { return (b == 0 ? 0 : a / b); @@ -239,11 +234,9 @@ static void show_counts ( void ) / ( VG_(bbs_done)==0 ? 1 : VG_(bbs_done) ) ); + VG_(print_scheduler_stats)(); VG_(message)(Vg_DebugMsg, - " %d/%d major/minor sched events. %d tt_fast misses.", - VG_(num_scheduling_events_MAJOR), - VG_(num_scheduling_events_MINOR), - VG_(tt_fast_misses)); + " %d tt_fast misses.", VG_(tt_fast_misses)); VG_(print_reg_alloc_stats)(); VG_(message)(Vg_DebugMsg, diff --git a/coregrind/vg_scheduler.c b/coregrind/vg_scheduler.c index 8128c667da..b4bab2454e 100644 --- a/coregrind/vg_scheduler.c +++ b/coregrind/vg_scheduler.c @@ -134,6 +134,17 @@ static void do_client_request ( ThreadId tid ); static void scheduler_sanity ( void ); static void do_pthread_cond_timedwait_TIMEOUT ( ThreadId tid ); +/* Stats. */ +static UInt n_scheduling_events_MINOR = 0; +static UInt n_scheduling_events_MAJOR = 0; + +void VG_(print_scheduler_stats)(void) +{ + VG_(message)(Vg_DebugMsg, + " %d/%d major/minor sched events.", + n_scheduling_events_MAJOR, n_scheduling_events_MINOR); +} + /* --------------------------------------------------------------------- Helper functions for the scheduler. ------------------------------------------------------------------ */ @@ -938,7 +949,7 @@ VgSchedReturnCode VG_(scheduler) ( Int* exitcode ) while (True) { /* For stats purposes only. */ - VG_(num_scheduling_events_MAJOR) ++; + n_scheduling_events_MAJOR++; /* Route signals to their proper places */ VG_(route_signals)(); @@ -1038,7 +1049,7 @@ VgSchedReturnCode VG_(scheduler) ( Int* exitcode ) VG_(last_run_tid) = tid; /* For stats purposes only. */ - VG_(num_scheduling_events_MINOR) ++; + n_scheduling_events_MINOR++; if (0) VG_(message)(Vg_DebugMsg, "thread %d: running for %d bbs",