From bd12703b7605724094263e468f89e16c248851b0 Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Wed, 1 Jun 2005 09:40:27 +0000 Subject: [PATCH] Able to dump lock()/unlock() timing data --- servers/is/dmp.c | 46 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/servers/is/dmp.c b/servers/is/dmp.c index 9defd5c45..58d71f07b 100644 --- a/servers/is/dmp.c +++ b/servers/is/dmp.c @@ -15,6 +15,7 @@ #include #include #include +#include #include "../../kernel/const.h" #include "../../kernel/type.h" #include "../../kernel/proc.h" @@ -37,6 +38,9 @@ FORWARD _PROTOTYPE( void sched_dmp, (void) ); FORWARD _PROTOTYPE( void monparams_dmp, (void) ); FORWARD _PROTOTYPE( void kenv_dmp, (void) ); FORWARD _PROTOTYPE( void memchunks_dmp, (void) ); +#if ENABLE_LOCK_TIMING +FORWARD _PROTOTYPE( void timing_dmp, (void) ); +#endif /* Some global data that is shared among several dumping procedures. * Note that the process table copy has the same name as in the kernel @@ -65,6 +69,9 @@ PUBLIC int do_fkey_pressed(message *m) case F5: monparams_dmp(); break; case F6: irqtab_dmp(); break; case F7: kmessages_dmp(); break; +#if ENABLE_LOCK_TIMING + case F8: timing_dmp(); break; +#endif case F9: diagnostics_dmp(); break; case F10: kenv_dmp(); break; case F11: memchunks_dmp(); break; @@ -108,6 +115,43 @@ PRIVATE void diagnostics_dmp() printf(print_buf); /* print the messages */ } +#if ENABLE_LOCK_TIMING +/*===========================================================================* + * timing_dmp * + *===========================================================================*/ +PRIVATE void timing_dmp() +{ + static struct lock_timedata timingdata[TIMING_CATEGORIES]; + int r, c, f, skipped = 0, printed = 0, maxlines = 23, x = 0; + static int offsetlines = 0; + + if ((r = sys_getlocktimings(timingdata)) != OK) { + report("warning: couldn't get copy of lock timings", r); + return; + } + + for(c = 0; c < TIMING_CATEGORIES; c++) { + int b; + if(!timingdata[c].lock_timings_range[0] || !timingdata[c].binsize) + continue; + x = printf("%-*s: misses %lu, resets %lu, measurements %lu: ", + TIMING_NAME, timingdata[c].names, + timingdata[c].misses, + timingdata[c].resets, + timingdata[c].measurements); + for(b = 0; b < TIMING_POINTS; b++) { + int w; + if(!timingdata[c].lock_timings[b]) + continue; + x += (w = printf(" %5d: %5d", timingdata[c].lock_timings_range[0] + + b*timingdata[c].binsize, + timingdata[c].lock_timings[b])); + if(x + w >= 80) { printf("\n"); x = 0; } + } + if(x > 0) printf("\n"); + } +} +#endif /*===========================================================================* * kmessages_dmp * @@ -139,7 +183,7 @@ PRIVATE void kmessages_dmp() } print_buf[r] = 0; /* make sure it terminates */ printf("Dump of all messages generated by the kernel.\n\n"); - printf(print_buf); /* print the messages */ + printf("%s", print_buf); /* print the messages */ } -- 2.44.0