mirror of
https://github.com/google/benchmark.git
synced 2025-02-04 00:00:18 +08:00
Merge branch 'main' into clang-tidy
This commit is contained in:
commit
f616c58df3
@ -229,10 +229,12 @@ inline BENCHMARK_ALWAYS_INLINE int64_t Now() {
|
|||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
gettimeofday(&tv, nullptr);
|
gettimeofday(&tv, nullptr);
|
||||||
return static_cast<int64_t>(tv.tv_sec) * 1000000 + tv.tv_usec;
|
return static_cast<int64_t>(tv.tv_sec) * 1000000 + tv.tv_usec;
|
||||||
#elif defined(__hppa__)
|
#elif defined(__hppa__) || defined(__linux__)
|
||||||
|
// Fallback for all other architectures with a recent Linux kernel, e.g.:
|
||||||
// HP PA-RISC provides a user-readable clock counter (cr16), but
|
// HP PA-RISC provides a user-readable clock counter (cr16), but
|
||||||
// it's not syncronized across CPUs and only 32-bit wide when programs
|
// it's not syncronized across CPUs and only 32-bit wide when programs
|
||||||
// are built as 32-bit binaries.
|
// are built as 32-bit binaries.
|
||||||
|
// Same for SH-4 and possibly others.
|
||||||
// Use clock_gettime(CLOCK_MONOTONIC, ...) instead of gettimeofday
|
// Use clock_gettime(CLOCK_MONOTONIC, ...) instead of gettimeofday
|
||||||
// because is provides nanosecond resolution.
|
// because is provides nanosecond resolution.
|
||||||
// Initialize to always return 0 if clock_gettime fails.
|
// Initialize to always return 0 if clock_gettime fails.
|
||||||
|
Loading…
Reference in New Issue
Block a user