]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Merge from trunk, r11511 (fix threshold printing in Massif).
authorNicholas Nethercote <njn@valgrind.org>
Thu, 27 Jan 2011 23:17:58 +0000 (23:17 +0000)
committerNicholas Nethercote <njn@valgrind.org>
Thu, 27 Jan 2011 23:17:58 +0000 (23:17 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/branches/VALGRIND_3_6_BRANCH@11512

massif/ms_main.c
massif/tests/insig.post.exp
massif/tests/insig.vgtest

index f7122ae9184d49a47876cb9d7b50e584b31faacd..6e95ace5d187084e6a0f457b85077ff8827d77e9 100644 (file)
@@ -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;
     }
 
index b402eaef13a7e41b0f50eeffbc44f66e071b73d3..5963decfeb9e73ce5e87e3cf6ad0838e90d84ce9 100644 (file)
@@ -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)
 | 
index cb167dfa8346e77ca1ba245fbc7b80e47e578c35..4c3807fb627b4fea06ba216fc7c0858160a6d9a1 100644 (file)
@@ -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