diff options
Diffstat (limited to 'src/benchmark.h')
-rw-r--r-- | src/benchmark.h | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/src/benchmark.h b/src/benchmark.h index 4f2619c96e..cadd0d2615 100644 --- a/src/benchmark.h +++ b/src/benchmark.h @@ -21,48 +21,47 @@ #include <time.h> #include <signal.h> #if defined(_WIN32) -# include <windows.h> +#include <windows.h> #endif #if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_PROCESS_CPUTIME_ID) -# undef gettime -# define gettime(x) clock_gettime(CLOCK_PROCESS_CPUTIME_ID, x) +#undef gettime +#define gettime(x) clock_gettime(CLOCK_PROCESS_CPUTIME_ID, x) #else -inline static void -gettime (struct timespec *ts) +inline static void gettime(struct timespec *ts) { -struct timeval tv; - gettimeofday (&tv, NULL); - ts->tv_sec = tv.tv_sec; - ts->tv_nsec = tv.tv_usec * 1000; + struct timeval tv; + gettimeofday(&tv, NULL); + ts->tv_sec = tv.tv_sec; + ts->tv_nsec = tv.tv_usec * 1000; } #endif -typedef void (*sighandler_t)(int); +typedef void (*sighandler_t) (int); -void benchmark_cipher (int init, int debug_level); -void benchmark_tls (int debug_level, int ciphers); +void benchmark_cipher(int init, int debug_level); +void benchmark_tls(int debug_level, int ciphers); -struct benchmark_st -{ - struct timespec start; - unsigned long size; - sighandler_t old_handler; +struct benchmark_st { + struct timespec start; + unsigned long size; + sighandler_t old_handler; #if defined(_WIN32) - HANDLE wtimer; - HANDLE wthread; - LARGE_INTEGER alarm_timeout; + HANDLE wtimer; + HANDLE wthread; + LARGE_INTEGER alarm_timeout; #endif }; extern int benchmark_must_finish; -void start_benchmark(struct benchmark_st * st); -double stop_benchmark(struct benchmark_st * st, const char* metric, int quiet); +void start_benchmark(struct benchmark_st *st); +double stop_benchmark(struct benchmark_st *st, const char *metric, + int quiet); inline static unsigned int -timespec_sub_ms (struct timespec *a, struct timespec *b) +timespec_sub_ms(struct timespec *a, struct timespec *b) { - return (a->tv_sec * 1000 + a->tv_nsec / (1000 * 1000) - - (b->tv_sec * 1000 + b->tv_nsec / (1000 * 1000))); + return (a->tv_sec * 1000 + a->tv_nsec / (1000 * 1000) - + (b->tv_sec * 1000 + b->tv_nsec / (1000 * 1000))); } |