diff options
author | Keith Whitwell <[email protected]> | 2009-09-17 12:08:04 +0100 |
---|---|---|
committer | Keith Whitwell <[email protected]> | 2009-09-17 12:08:04 +0100 |
commit | e95a3a23dca9fc7aaa89237059d841f624b438db (patch) | |
tree | a255327884ee6ce838e83de48bc308d347ce8a69 /progs/perf/common.c | |
parent | 21caa29fbd332a2ee05a58df91e1664fbbc4e61f (diff) |
progs/perf: add scons support, get working under mingw
Diffstat (limited to 'progs/perf/common.c')
-rw-r--r-- | progs/perf/common.c | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/progs/perf/common.c b/progs/perf/common.c index a50fc11cca5..695b8a99d9d 100644 --- a/progs/perf/common.c +++ b/progs/perf/common.c @@ -26,6 +26,28 @@ #include "common.h" #include "glmain.h" +#include <stdio.h> +#include <stdlib.h> +#include <stdarg.h> + + +/* Need to add a fflush windows console with mingw, otherwise nothing + * shows up until program exit. May want to add logging here. + */ +void +perf_printf(const char *format, ...) +{ + va_list ap; + va_start(ap, format); + + fflush(stdout); + vfprintf(stdout, format, ap); + fflush(stdout); + + va_end(ap); +} + + /** * Run function 'f' for enough iterations to reach a steady state. @@ -52,7 +74,7 @@ PerfMeasureRate(PerfRateFunc f) subiters *= 2; } while (t1 - t0 < 0.1 * minDuration); } - /*printf("initial subIters = %u\n", subiters);*/ + /*perf_printf("initial subIters = %u\n", subiters);*/ while (1) { const double t0 = PerfGetTime(); @@ -68,7 +90,7 @@ PerfMeasureRate(PerfRateFunc f) rate = iters / (t1 - t0); if (0) - printf("prevRate %f rate %f ratio %f iters %u\n", + perf_printf("prevRate %f rate %f ratio %f iters %u\n", prevRate, rate, rate/prevRate, iters); /* Try and speed the search up by skipping a few steps: @@ -86,7 +108,7 @@ PerfMeasureRate(PerfRateFunc f) } if (0) - printf("%s returning iters %u rate %f\n", __FUNCTION__, subiters, rate); + perf_printf("%s returning iters %u rate %f\n", __FUNCTION__, subiters, rate); return rate; } |