diff options
author | Pawel Kowalski <p.kowalski2@partner.samsung.com> | 2019-08-28 14:31:23 +0200 |
---|---|---|
committer | Pawel Kowalski <p.kowalski2@partner.samsung.com> | 2019-08-28 16:56:31 +0200 |
commit | dee455252ad321c660b411b4ecd65aa5e08f8fc1 (patch) | |
tree | b55f9ec039e963e42605e9e9bdc186354cf9df42 /src/benchmark.c | |
parent | 5c7e0aaf17a296535495e3431db6a86ad64064b3 (diff) | |
parent | 26bea900a531662c6028ecc06f4adea825658434 (diff) | |
download | libtasn1-tizen_6.0_hotfix.tar.gz libtasn1-tizen_6.0_hotfix.tar.bz2 libtasn1-tizen_6.0_hotfix.zip |
Merge tag 'upstream/4.14' into tizentizen_6.5.m2_releasetizen_6.0.m2_releasetizen_5.5.m2_releasesubmit/tizen_6.5/20211028.163501submit/tizen_6.0_hotfix/20201103.115102submit/tizen_6.0_hotfix/20201102.192902submit/tizen_6.0/20201029.205502submit/tizen_5.5_wearable_hotfix/20201026.184307submit/tizen_5.5_mobile_hotfix/20201026.185107submit/tizen_5.5/20191031.000007submit/tizen/20190904.070216submit/tizen/20190829.061506accepted/tizen/unified/20190904.110630accepted/tizen/6.5/unified/20211029.014057accepted/tizen/6.0/unified/hotfix/20201103.050702accepted/tizen/6.0/unified/hotfix/20201102.234932accepted/tizen/6.0/unified/20201030.110146accepted/tizen/5.5/unified/wearable/hotfix/20201027.100357accepted/tizen/5.5/unified/mobile/hotfix/20201027.074057accepted/tizen/5.5/unified/20191031.011500tizen_6.5tizen_6.0_hotfixtizen_6.0tizen_5.5_wearable_hotfixtizen_5.5_tvtizen_5.5_mobile_hotfixtizen_5.5accepted/tizen_6.5_unifiedaccepted/tizen_6.0_unified_hotfixaccepted/tizen_6.0_unifiedaccepted/tizen_5.5_unified_wearable_hotfixaccepted/tizen_5.5_unified_mobile_hotfixaccepted/tizen_5.5_unified
Change-Id: I6d4b47b2072db8e7c45daa6e269e2f0cc6f54a7f
Diffstat (limited to 'src/benchmark.c')
-rw-r--r-- | src/benchmark.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/benchmark.c b/src/benchmark.c index f36115b..010d58e 100644 --- a/src/benchmark.c +++ b/src/benchmark.c @@ -87,7 +87,12 @@ 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 @@ -122,7 +127,11 @@ 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]; @@ -135,10 +144,17 @@ stop_benchmark (struct benchmark_st *st, const char *metric) signal (SIGALRM, st->old_handler); #endif - gettime (&stop); - +#ifdef HAVE_CLOCK_GETTIME + clock_gettime (CLOCK_MONOTONIC, &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; |