diff options
author | Dariusz Michaluk <d.michaluk@samsung.com> | 2024-02-13 15:38:29 +0100 |
---|---|---|
committer | Dariusz Michaluk <d.michaluk@samsung.com> | 2024-02-13 15:38:29 +0100 |
commit | 031996ef501f8c3d0532f7df1c38cf2e540a4f11 (patch) | |
tree | 27217d793b273edadc969aa3110378aac3c36e9c /src/benchmark.c | |
parent | 26bea900a531662c6028ecc06f4adea825658434 (diff) | |
download | libtasn1-031996ef501f8c3d0532f7df1c38cf2e540a4f11.tar.gz libtasn1-031996ef501f8c3d0532f7df1c38cf2e540a4f11.tar.bz2 libtasn1-031996ef501f8c3d0532f7df1c38cf2e540a4f11.zip |
Imported Upstream version 4.19.0upstream/4.19.0upstream
Diffstat (limited to 'src/benchmark.c')
-rw-r--r-- | src/benchmark.c | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/src/benchmark.c b/src/benchmark.c index 010d58e..2f26ca3 100644 --- a/src/benchmark.c +++ b/src/benchmark.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011-2014 Free Software Foundation, Inc. + * Copyright (C) 2011-2022 Free Software Foundation, Inc. * * This file is part of GnuTLS. * @@ -29,7 +29,7 @@ int benchmark_must_finish = 0; #if defined _WIN32 -#include <windows.h> +# include <windows.h> static DWORD WINAPI alarm_handler (LPVOID lpParameter) { @@ -87,12 +87,8 @@ start_benchmark (struct benchmark_st *st) #ifndef _WIN32 st->old_handler = signal (SIGALRM, alarm_handler); #endif + gettime (&st->start); -#ifdef HAVE_CLOCK_GETTIME - clock_gettime (CLOCK_MONOTONIC, &st->start); -#else - gettimeofday(&st->start, NULL); -#endif benchmark_must_finish = 0; #if defined _WIN32 @@ -127,11 +123,7 @@ stop_benchmark (struct benchmark_st *st, const char *metric) { double secs; unsigned long lsecs; -#ifdef HAVE_CLOCK_GETTIME struct timespec stop; -#else - struct timeval stop; -#endif double dspeed, ddata; char imetric[16]; @@ -144,17 +136,10 @@ stop_benchmark (struct benchmark_st *st, const char *metric) signal (SIGALRM, st->old_handler); #endif -#ifdef HAVE_CLOCK_GETTIME - clock_gettime (CLOCK_MONOTONIC, &stop); + gettime (&stop); lsecs = (stop.tv_sec * 1000 + stop.tv_nsec / (1000 * 1000) - (st->start.tv_sec * 1000 + st->start.tv_nsec / (1000 * 1000))); -#else - gettimeofday(&stop, NULL); - lsecs = (stop.tv_sec * 1000 + stop.tv_usec / (1000) - - (st->start.tv_sec * 1000 + st->start.tv_usec / (1000))); -#endif - secs = lsecs; secs /= 1000; |