]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
* Add in helgrind stats the nr of live/exit/joined/exit and joined threads
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Tue, 24 Mar 2015 14:02:44 +0000 (14:02 +0000)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Tue, 24 Mar 2015 14:02:44 +0000 (14:02 +0000)
* avoid division by 0 in m_transtab.c stats before anything was done

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15037

coregrind/m_transtab.c
helgrind/libhb_core.c

index d00ff6a22cb936056e87d4bc393652599cdab126..d82a5326b6d7f436ac8293c88f5232eb9b5e4829 100644 (file)
@@ -2410,7 +2410,7 @@ void VG_(print_tt_tc_stats) ( void )
                 n_in_count, n_in_osize, n_in_tsize,
                 safe_idiv(10*n_in_tsize, n_in_osize),
                 n_in_sc_count,
-                (int) (n_in_tsize / n_in_count));
+                (int) (n_in_tsize / (n_in_count ? n_in_count : 1)));
    VG_(message)(Vg_DebugMsg,
                 " transtab: dumped     %'llu (%'llu -> ?" "?) "
                 "(sectors recycled %'llu)\n",
index d39f5a76bb2068d008436277ccfa08139f261a93..cb7e851635d292e49a6b6da9c26f0389a866702f 100644 (file)
@@ -6231,6 +6231,34 @@ void libhb_shutdown ( Bool show_stats )
       VG_(printf)( "   libhb: %lu entries in vts_set\n",
                    VG_(sizeFM)( vts_set ) );
 
+      VG_(printf)("%s","\n");
+      {
+         UInt live = 0;
+         UInt llexit_done = 0;
+         UInt joinedwith_done = 0;
+         UInt llexit_and_joinedwith_done = 0;
+
+         Thread* hgthread = get_admin_threads();
+         tl_assert(hgthread);
+         while (hgthread) {
+            Thr* hbthr = hgthread->hbthr;
+            tl_assert(hbthr);
+            if (hbthr->llexit_done && hbthr->joinedwith_done)
+               llexit_and_joinedwith_done++;
+            else if (hbthr->llexit_done)
+               llexit_done++;
+            else if (hbthr->joinedwith_done)
+               joinedwith_done++;
+            else
+               live++;
+            hgthread = hgthread->admin;
+         }
+         VG_(printf)("   libhb: threads live: %d exit_and_joinedwith %d"
+                     " exit %d joinedwith %d\n",
+                     live, llexit_and_joinedwith_done,
+                     llexit_done, joinedwith_done);
+      }
+
       VG_(printf)("%s","\n");
       VG_(printf)( "   libhb: ctxt__rcdec: 1=%lu(%lu eq), 2=%lu, 3=%lu\n",
                    stats__ctxt_rcdec1, stats__ctxt_rcdec1_eq,