aboutsummaryrefslogtreecommitdiff
path: root/callgrind
diff options
context:
space:
mode:
authorflorian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9>2014-12-12 19:32:10 +0000
committerflorian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9>2014-12-12 19:32:10 +0000
commit227a1ecca7f44cb07e74aa8f1bd24b29df629499 (patch)
treef2ba2ddc5a1fe76ae9b7cf58435b13a49ca4750d /callgrind
parent404c0c7587ef5b9ebb794374fd4bde86be433fac (diff)
downloadvalgrind-227a1ecca7f44cb07e74aa8f1bd24b29df629499.tar.gz
Add limited support for printing floating point numbers to
VG_(debugLog_vprintf). Remove function VG_(percentify) and fix up its call sites (part of fixing BZ #337869. Allow the width in a format specification to be '*', i.e. the width is given as an additional function argument. The limitations for printing floating point numbers are: (1) %f is the only supported format. Width and precision can be specified. (2) Funny numbers (NaN and such) are not supported. (3) Floating point numbers need to be benign in the sense that their integral part fits into an ULong. This is good enough for our purposes. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14806 a5019735-40e9-0310-863c-91ae7b9d1cf9
Diffstat (limited to 'callgrind')
-rw-r--r--callgrind/main.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/callgrind/main.c b/callgrind/main.c
index 740213123..0180ec649 100644
--- a/callgrind/main.c
+++ b/callgrind/main.c
@@ -1775,7 +1775,6 @@ static UInt ULong_width(ULong n)
static
void branchsim_printstat(int l1, int l2, int l3)
{
- static HChar buf1[128], buf2[128], buf3[128];
static HChar fmt[128]; // large enough
FullCost total;
ULong Bc_total_b, Bc_total_mp, Bi_total_b, Bi_total_mp;
@@ -1803,11 +1802,10 @@ void branchsim_printstat(int l1, int l2, int l3)
VG_(umsg)(fmt, "Mispredicts: ",
B_total_mp, Bc_total_mp, Bi_total_mp);
- VG_(percentify)(B_total_mp, B_total_b, 1, l1+1, buf1);
- VG_(percentify)(Bc_total_mp, Bc_total_b, 1, l2+1, buf2);
- VG_(percentify)(Bi_total_mp, Bi_total_b, 1, l3+1, buf3);
-
- VG_(umsg)("Mispred rate: %s (%s + %s )\n", buf1, buf2,buf3);
+ VG_(umsg)("Mispred rate: %*.1f%% (%*.1f%% + %*.1f%% )\n",
+ l1, B_total_mp * 100.0 / B_total_b,
+ l2, Bc_total_mp * 100.0 / Bc_total_b,
+ l3, Bi_total_mp * 100.0 / Bi_total_b);
}
static