This is done to support architectures where `rdtsc()` is not implemented.
In case it is available use `clock_gettime()`. Otherwise still fall back
to use `clock()`.
The first approach was to always use `clock_gettime()` if it is available
but the overhead it brings compared to `rdtsc()` is high, so I chose to
only try to use it if `rdtsc()` is not implemented.
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
In case this ifdef-elseif-chain falls back to the else path, the macro
to `clock()` wasn't defined.
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
examples/perf.c: In function ‘perf_rand’:
examples/perf.c:42:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
for (size_t sz = 2; sz <= alloc_sz; sz <<= 1) {