})
// 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';
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;
}
--------------------------------------------------------------------------------
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
--------------------------------------------------------------------------------
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)
|
+# 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