From: Philippe Waroquiers Date: Thu, 26 Mar 2015 22:12:40 +0000 (+0000) Subject: Improve --stats=yes: X-Git-Tag: svn/VALGRIND_3_11_0~551 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=06b9624009aeff1dff4d642c5c3d5270fda95080;p=thirdparty%2Fvalgrind.git Improve --stats=yes: * give the avg nr of IPs per execontext * use the newly introduced %f in m_transtab.c ratio and in the avg nr of execontext per list git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15041 --- diff --git a/coregrind/m_execontext.c b/coregrind/m_execontext.c index 0ec53dec36..9472b30a65 100644 --- a/coregrind/m_execontext.c +++ b/coregrind/m_execontext.c @@ -159,11 +159,13 @@ static void init_ExeContext_storage ( void ) /* Print stats. */ void VG_(print_ExeContext_stats) ( Bool with_stacktraces ) { + Int i; + ULong total_n_ips; + ExeContext* ec; + init_ExeContext_storage(); if (with_stacktraces) { - Int i; - ExeContext* ec; VG_(message)(Vg_DebugMsg, " exectx: Printing contexts stacktraces\n"); for (i = 0; i < ec_htab_size; i++) { for (ec = ec_htab[i]; ec; ec = ec->chain) { @@ -176,10 +178,17 @@ void VG_(print_ExeContext_stats) ( Bool with_stacktraces ) " exectx: Printed %'llu contexts stacktraces\n", ec_totstored); } - + + total_n_ips = 0; + for (i = 0; i < ec_htab_size; i++) { + for (ec = ec_htab[i]; ec; ec = ec->chain) + total_n_ips += ec->n_ips; + } VG_(message)(Vg_DebugMsg, - " exectx: %'lu lists, %'llu contexts (avg %'llu per list)\n", - ec_htab_size, ec_totstored, ec_totstored / (ULong)ec_htab_size + " exectx: %'lu lists, %'llu contexts (avg %3.2f per list)" + " (avg %3.2f IP per context)\n", + ec_htab_size, ec_totstored, (Double)ec_totstored / (Double)ec_htab_size, + (Double)total_n_ips / (Double)ec_htab_size ); VG_(message)(Vg_DebugMsg, " exectx: %'llu searches, %'llu full compares (%'llu per 1000)\n", diff --git a/coregrind/m_transtab.c b/coregrind/m_transtab.c index d82a5326b6..33ac23848b 100644 --- a/coregrind/m_transtab.c +++ b/coregrind/m_transtab.c @@ -2384,9 +2384,9 @@ void VG_(init_tt_tc) ( void ) /*--- Printing out statistics. ---*/ /*------------------------------------------------------------*/ -static ULong safe_idiv( ULong a, ULong b ) +static Double safe_idiv( ULong a, ULong b ) { - return (b == 0 ? 0 : a / b); + return (b == 0 ? 0 : (Double)a / (Double)b); } UInt VG_(get_bbs_translated) ( void ) @@ -2405,10 +2405,10 @@ void VG_(print_tt_tc_stats) ( void ) VG_(message)(Vg_DebugMsg, " transtab: new %'lld " - "(%'llu -> %'llu; ratio %'llu:10) [%'llu scs] " + "(%'llu -> %'llu; ratio %3.1f) [%'llu scs] " "avg tce size %d\n", n_in_count, n_in_osize, n_in_tsize, - safe_idiv(10*n_in_tsize, n_in_osize), + safe_idiv(n_in_tsize, n_in_osize), n_in_sc_count, (int) (n_in_tsize / (n_in_count ? n_in_count : 1))); VG_(message)(Vg_DebugMsg,