diff options
Diffstat (limited to 'src/benchmark.c')
-rw-r--r-- | src/benchmark.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/benchmark.c b/src/benchmark.c index 45a6f77e57..bdff41ef9c 100644 --- a/src/benchmark.c +++ b/src/benchmark.c @@ -31,10 +31,10 @@ volatile int benchmark_must_finish = 0; #if defined(_WIN32) -# include <windows.h> +#include <windows.h> static DWORD WINAPI alarm_handler(LPVOID lpParameter) { - HANDLE wtimer = *((HANDLE *) lpParameter); + HANDLE wtimer = *((HANDLE *)lpParameter); WaitForSingleObject(wtimer, INFINITE); benchmark_must_finish = 1; return 0; @@ -46,9 +46,8 @@ static void alarm_handler(int signo) } #endif -static void -value2human(uint64_t bytes, double time, double *data, double *speed, - char *metric) +static void value2human(uint64_t bytes, double time, double *data, + double *speed, char *metric) { if (bytes > 1000 && bytes < 1000 * 1000) { *data = ((double)bytes) / 1000; @@ -90,21 +89,20 @@ void start_benchmark(struct benchmark_st *st) exit(1); } st->wthread = - CreateThread(NULL, 0, alarm_handler, &st->wtimer, 0, NULL); + CreateThread(NULL, 0, alarm_handler, &st->wtimer, 0, NULL); if (st->wthread == NULL) { fprintf(stderr, "error: CreateThread %u\n", GetLastError()); exit(1); } - st->alarm_timeout.QuadPart = (BSECS) * 10000000; - if (SetWaitableTimer - (st->wtimer, &st->alarm_timeout, 0, NULL, NULL, FALSE) == 0) { + st->alarm_timeout.QuadPart = (BSECS)*10000000; + if (SetWaitableTimer(st->wtimer, &st->alarm_timeout, 0, NULL, NULL, + FALSE) == 0) { fprintf(stderr, "error: SetWaitableTimer %u\n", GetLastError()); exit(1); } #else alarm(BSECS); #endif - } /* returns the elapsed time */ @@ -131,7 +129,7 @@ double stop_benchmark(struct benchmark_st *st, const char *metric, int quiet) secs = lsecs; secs /= 1000; - if (metric == NULL) { /* assume bytes/sec */ + if (metric == NULL) { /* assume bytes/sec */ value2human(st->size, secs, &ddata, &dspeed, imetric); if (quiet == 0) printf(" Processed %.2f %s in %.2f secs: ", ddata, |