From: Nicholas Nethercote Date: Thu, 27 Jan 2011 23:17:58 +0000 (+0000) Subject: Merge from trunk, r11511 (fix threshold printing in Massif). X-Git-Tag: svn/VALGRIND_3_6_1~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=040a59a8d0f02716ecc9c6e8b3ab22288b3a9492;p=thirdparty%2Fvalgrind.git Merge from trunk, r11511 (fix threshold printing in Massif). git-svn-id: svn://svn.valgrind.org/valgrind/branches/VALGRIND_3_6_BRANCH@11512 --- diff --git a/massif/ms_main.c b/massif/ms_main.c index f7122ae918..6e95ace5d1 100644 --- a/massif/ms_main.c +++ b/massif/ms_main.c @@ -2106,14 +2106,11 @@ Char FP_buf[BUF_LEN]; }) // Nb: uses a static buffer, each call trashes the last string returned. -static Char* make_perc(ULong x, ULong y) +static Char* make_perc(double x) { static Char mbuf[32]; -// tl_assert(x <= y); XXX; put back in later... - - // XXX: I'm not confident that VG_(percentify) works as it should... - VG_(percentify)(x, y, 2, 6, mbuf); + VG_(percentify)((ULong)(x * 100), 10000, 2, 6, mbuf); // XXX: this is bogus if the denominator was zero -- resulting string is // something like "0 --%") if (' ' == mbuf[0]) mbuf[0] = '0'; @@ -2239,7 +2236,7 @@ static void pp_snapshot_SXPt(Int fd, SXPt* sxpt, Int depth, Char* depth_str, Char* s = ( 1 == sxpt->Insig.n_xpts ? "," : "s, all" ); FP("%sn0: %lu in %d place%s below massif's threshold (%s)\n", depth_str, sxpt->szB, sxpt->Insig.n_xpts, s, - make_perc((ULong)clo_threshold, 100)); + make_perc(clo_threshold)); break; } diff --git a/massif/tests/insig.post.exp b/massif/tests/insig.post.exp index b402eaef13..5963decfeb 100644 --- a/massif/tests/insig.post.exp +++ b/massif/tests/insig.post.exp @@ -1,6 +1,6 @@ -------------------------------------------------------------------------------- Command: ./insig -Massif arguments: --stacks=no --time-unit=B --heap-admin=128 --massif-out-file=massif.out --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element +Massif arguments: --stacks=no --time-unit=B --heap-admin=128 --massif-out-file=massif.out --threshold=0.99 --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element ms_print arguments: massif.out -------------------------------------------------------------------------------- @@ -70,7 +70,7 @@ Number of snapshots: 24 87.28% (16,688B) (heap allocation functions) malloc/new/new[], --alloc-fns, etc. ->83.68% (16,000B) 0x........: main (insig.c:8) | -->01.34% (256B) in 16 places, all below massif's threshold (01.00%) +->01.34% (256B) in 16 places, all below massif's threshold (00.99%) | ->01.26% (240B) 0x........: main (insig.c:9) | diff --git a/massif/tests/insig.vgtest b/massif/tests/insig.vgtest index cb167dfa83..4c3807fb62 100644 --- a/massif/tests/insig.vgtest +++ b/massif/tests/insig.vgtest @@ -1,5 +1,6 @@ +# At one point, thresholds less than 1.0% were misprinted as 00.00%, so test that here. prog: insig -vgopts: --stacks=no --time-unit=B --heap-admin=128 --massif-out-file=massif.out +vgopts: --stacks=no --time-unit=B --heap-admin=128 --massif-out-file=massif.out --threshold=0.99 vgopts: --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element post: perl ../../massif/ms_print massif.out | ../../tests/filter_addresses cleanup: rm massif.out