]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Improve --stats=yes:
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Thu, 26 Mar 2015 22:12:40 +0000 (22:12 +0000)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Thu, 26 Mar 2015 22:12:40 +0000 (22:12 +0000)
 * 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

coregrind/m_execontext.c
coregrind/m_transtab.c

index 0ec53dec36dc9fd5193831a27af3a8728c47de3d..9472b30a655e35d96ba0d55f514f571a6d4df981 100644 (file)
@@ -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",
index d82a5326b6d7f436ac8293c88f5232eb9b5e4829..33ac23848b9b982b3cd8682695199e1166df8dcb 100644 (file)
@@ -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,