diff options
author | Tobias Brunner <tobias@strongswan.org> | 2012-01-30 11:04:55 +0100 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2012-01-30 11:04:55 +0100 |
commit | 7171d8765ecb719751c422286dc976f5cd478dba (patch) | |
tree | b2ccbe2f6c4d22cba1840150aa7d86402c0fc292 /src/libstrongswan/crypto/crypto_tester.c | |
parent | 023800ba624258495dcddc82faabcd583269ed77 (diff) | |
download | strongswan-7171d8765ecb719751c422286dc976f5cd478dba.tar.bz2 strongswan-7171d8765ecb719751c422286dc976f5cd478dba.tar.xz |
Disable crypto benchmarking if CLOCK_THREAD_CPUTIME_ID is not available.
Diffstat (limited to 'src/libstrongswan/crypto/crypto_tester.c')
-rw-r--r-- | src/libstrongswan/crypto/crypto_tester.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libstrongswan/crypto/crypto_tester.c b/src/libstrongswan/crypto/crypto_tester.c index 4635dccea..8b1daa885 100644 --- a/src/libstrongswan/crypto/crypto_tester.c +++ b/src/libstrongswan/crypto/crypto_tester.c @@ -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 */ |