Disable crypto benchmarking if CLOCK_THREAD_CPUTIME_ID is not available.
This commit is contained in:
parent
023800ba62
commit
7171d8765e
|
@ -102,6 +102,8 @@ static const char* get_name(void *sym)
|
|||
return "unknown";
|
||||
}
|
||||
|
||||
#ifdef CLOCK_THREAD_CPUTIME_ID
|
||||
|
||||
/**
|
||||
* Start a benchmark timer
|
||||
*/
|
||||
|
@ -122,6 +124,14 @@ static u_int end_timing(struct timespec *start)
|
|||
(end.tv_sec - start->tv_sec) * 1000;
|
||||
}
|
||||
|
||||
#else /* CLOCK_THREAD_CPUTIME_ID */
|
||||
|
||||
/* Make benchmarking a no-op if CLOCK_THREAD_CPUTIME_ID is not available */
|
||||
#define start_timing(start) ((start)->tv_sec = 0, (start)->tv_nsec = 0)
|
||||
#define end_timing(...) (this->bench_time)
|
||||
|
||||
#endif /* CLOCK_THREAD_CPUTIME_ID */
|
||||
|
||||
/**
|
||||
* Benchmark a crypter
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue