diff options
author | Peter Harris <peter.harris@hummingbird.com> | 2007-10-29 11:35:22 -0400 |
---|---|---|
committer | Peter Harris <pharris@opentext.com> | 2010-11-23 14:36:10 -0500 |
commit | cc84118bd700745f02c65b2d6900e512e4c333af (patch) | |
tree | 01aa71db1f5f1392d7ca8c52b3de3e483c33f921 | |
parent | 17a30e7c65c0b03b71b5b1ac54ae3ba33ae3b42a (diff) |
Avoid "rep" calculation overflow.
On today's fast machines, "treps" can easily overflow a 32-bit number.
Use "long long" to calculate reps.
Signed-off-by: Peter Harris <pharris@opentext.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
-rw-r--r-- | x11perf.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -282,7 +282,7 @@ RoundTo3Digits(double d) static void -ReportTimes(double usecs, int n, char *str, int average) +ReportTimes(double usecs, long long n, char *str, int average) { double msecsperobj, objspersec; @@ -296,14 +296,14 @@ ReportTimes(double usecs, int n, char *str, int average) objspersec = RoundTo3Digits(objspersec); if (average) { - printf("%7d trep @ %8.4f msec (%8.1f/sec): %s\n", + printf("%7lld trep @ %8.4f msec (%8.1f/sec): %s\n", n, msecsperobj, objspersec, str); } else { - printf("%7d reps @ %8.4f msec (%8.1f/sec): %s\n", + printf("%7lld reps @ %8.4f msec (%8.1f/sec): %s\n", n, msecsperobj, objspersec, str); } } else { - printf("%6d %sreps @ 0.0 msec (unmeasurably fast): %s\n", + printf("%6lld %sreps @ 0.0 msec (unmeasurably fast): %s\n", n, average ? "t" : "", str); } @@ -839,7 +839,7 @@ static void ProcessTest(XParms xp, Test *test, int func, unsigned long pm, char *label) { double time, totalTime; - int reps; + long long reps; int j; xp->planemask = pm; |