From e83c164c0a0bef3a42d0a8b9cb952bdc0e9b9588 Mon Sep 17 00:00:00 2001 From: Philippe Waroquiers Date: Tue, 24 Mar 2015 14:02:44 +0000 Subject: [PATCH] * 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 --- coregrind/m_transtab.c | 2 +- helgrind/libhb_core.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/coregrind/m_transtab.c b/coregrind/m_transtab.c index d00ff6a22c..d82a5326b6 100644 --- a/coregrind/m_transtab.c +++ b/coregrind/m_transtab.c @@ -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", diff --git a/helgrind/libhb_core.c b/helgrind/libhb_core.c index d39f5a76bb..cb7e851635 100644 --- a/helgrind/libhb_core.c +++ b/helgrind/libhb_core.c @@ -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, -- 2.47.3