Skip to content

Commit 6773c85

Browse files
authored
Merge pull request #5842 from artem-dmitriev/patch-1
bench.h: fix getsec() double time conversion on Apple Silicon
2 parents 7ac17f4 + 2d9cbfc commit 6773c85

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

benchmark/bench.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ static void *aligned_alloc_cacheline(size_t n)
9595
#if defined(__WIN32__) || defined(__WIN64__) || !defined(_POSIX_TIMERS)
9696
struct timeval start, stop;
9797
#elif defined(__APPLE__)
98-
mach_timebase_info_data_t info;
9998
uint64_t start = 0, stop = 0;
10099
#else
101100
struct timespec start = { 0, 0 }, stop = { 0, 0 };
@@ -106,8 +105,7 @@ double getsec()
106105
#if defined(__WIN32__) || defined(__WIN64__) || !defined(_POSIX_TIMERS)
107106
return (double)(stop.tv_sec - start.tv_sec) + (double)((stop.tv_usec - start.tv_usec)) * 1.e-6;
108107
#elif defined(__APPLE__)
109-
mach_timebase_info(&info);
110-
return (double)(((stop - start) * info.numer)/info.denom) * 1.e-9;
108+
return (double)(stop - start) * 1.e-9;
111109
#else
112110
return (double)(stop.tv_sec - start.tv_sec) + (double)((stop.tv_nsec - start.tv_nsec)) * 1.e-9;
113111
#endif

0 commit comments

Comments
 (0)