summaryrefslogtreecommitdiff
path: root/src/libstrongswan/crypto/crypto_tester.c
diff options
context:
space:
mode:
authorYves-Alexis Perez <corsac@corsac.net>2012-06-28 21:16:07 +0200
committerYves-Alexis Perez <corsac@corsac.net>2012-06-28 21:16:07 +0200
commitb34738ed08c2227300d554b139e2495ca5da97d6 (patch)
tree62f33b52820f2e49f0e53c0f8c636312037c8054 /src/libstrongswan/crypto/crypto_tester.c
parent0a9d51a49042a68daa15b0c74a2b7f152f52606b (diff)
downloadvyos-strongswan-b34738ed08c2227300d554b139e2495ca5da97d6.tar.gz
vyos-strongswan-b34738ed08c2227300d554b139e2495ca5da97d6.zip
Imported Upstream version 4.6.4
Diffstat (limited to 'src/libstrongswan/crypto/crypto_tester.c')
-rw-r--r--src/libstrongswan/crypto/crypto_tester.c10
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
*/