From 17a30e7c65c0b03b71b5b1ac54ae3ba33ae3b42a Mon Sep 17 00:00:00 2001 From: Peter Harris Date: Mon, 29 Oct 2007 11:29:32 -0400 Subject: Clamp test time to positive values. If there is some jitter in the sync time, operations can complete in a negative amount of time (confusing both humans and x11perfcomp). Signed-off-by: Peter Harris Reviewed-by: Adam Jackson --- x11perf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/x11perf.c b/x11perf.c index 08c0062..c1fb5c2 100644 --- a/x11perf.c +++ b/x11perf.c @@ -647,6 +647,7 @@ DoTest(XParms xp, Test *test, int reps) HardwareSync(xp); time = ElapsedTime(syncTime); + if (time < 0.0) time = 0.0; CheckAbort (); if (drawToFakeServer) XQueryBestSize(xp->d, TileShape, tileToQuery, -- cgit v1.2.3 From cc84118bd700745f02c65b2d6900e512e4c333af Mon Sep 17 00:00:00 2001 From: Peter Harris Date: Mon, 29 Oct 2007 11:35:22 -0400 Subject: 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 Reviewed-by: Adam Jackson --- x11perf.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/x11perf.c b/x11perf.c index c1fb5c2..71c7e1c 100644 --- a/x11perf.c +++ b/x11perf.c @@ -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; -- cgit v1.2.3