|
From: <sv...@va...> - 2005-09-25 18:59:50
|
Author: njn
Date: 2005-09-25 19:59:46 +0100 (Sun, 25 Sep 2005)
New Revision: 4768
Log:
Fix incorrect computation of miss rates due to Int/Long mixups <sigh>.
Modified:
branches/ASPACEM/coregrind/m_libcprint.c
branches/ASPACEM/include/pub_tool_libcprint.h
Modified: branches/ASPACEM/coregrind/m_libcprint.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_libcprint.c 2005-09-25 18:00:25 UTC (rev=
4767)
+++ branches/ASPACEM/coregrind/m_libcprint.c 2005-09-25 18:59:46 UTC (rev=
4768)
@@ -203,13 +203,19 @@
------------------------------------------------------------------ */
=20
// Percentify n/m with d decimal places. Includes the '%' symbol at the=
end.
-void VG_(percentify)(UInt n, UInt m, UInt d, Int n_buf, char buf[])=20
+// Right justifies in 'buf'.
+void VG_(percentify)(ULong n, ULong m, UInt d, Int n_buf, char buf[])=20
{
Int i, len, space;
ULong p1;
+ Char fmt[32];
=20
if (m =3D=3D 0) {
- VG_(sprintf)(buf, "--%%");
+ // Have to generate the format string in order to be flexible abou=
t
+ // the width of the field.
+ VG_(sprintf)(fmt, "%%-%lds", n_buf);
+ // fmt is now "%<n_buf>s" where <d> is 1,2,3...
+ VG_(sprintf)(buf, fmt, "--%");
return;
}
=20
@@ -220,7 +226,6 @@
} else {
ULong p2;
UInt ex;
- Char fmt[32];
switch (d) {
case 1: ex =3D 10; break;
case 2: ex =3D 100; break;
Modified: branches/ASPACEM/include/pub_tool_libcprint.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/include/pub_tool_libcprint.h 2005-09-25 18:00:25 UTC=
(rev 4767)
+++ branches/ASPACEM/include/pub_tool_libcprint.h 2005-09-25 18:59:46 UTC=
(rev 4768)
@@ -52,7 +52,8 @@
const HChar *format, va_list varg=
s );
=20
// Percentify n/m with d decimal places. Includes the '%' symbol at the=
end.
-extern void VG_(percentify)(UInt n, UInt m, UInt d, Int n_buf, char buf[=
]);
+// Right justifies in 'buf'.
+extern void VG_(percentify)(ULong n, ULong m, UInt d, Int n_buf, char bu=
f[]);
=20
/* ---------------------------------------------------------------------
Messages for the user
|