* Add in helgrind stats the nr of live/exit/joined/exit and joined threads
* avoid division by 0 in m_transtab.c stats before anything was done



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15037 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/helgrind/libhb_core.c b/helgrind/libhb_core.c
index d39f5a7..cb7e851 100644
--- a/helgrind/libhb_core.c
+++ b/helgrind/libhb_core.c
@@ -6232,6 +6232,34 @@
                    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,
                    stats__ctxt_rcdec2,