Skip to content

Commit

Permalink
Merge branch 'main' into clang-tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
dmah42 authored Jan 8, 2025
2 parents 00e8f53 + f65741b commit 79837e1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 18 deletions.
18 changes: 0 additions & 18 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,12 @@ COPTS = [
"-Werror=old-style-cast",
]

config_setting(
name = "qnx",
constraint_values = ["@platforms//os:qnx"],
values = {
"cpu": "x64_qnx",
},
visibility = [":__subpackages__"],
)

config_setting(
name = "windows",
constraint_values = ["@platforms//os:windows"],
values = {
"cpu": "x64_windows",
},
visibility = [":__subpackages__"],
)

config_setting(
name = "macos",
constraint_values = ["@platforms//os:macos"],
visibility = ["//visibility:public"],
)

config_setting(
name = "perfcounters",
define_values = {
Expand Down
10 changes: 10 additions & 0 deletions src/cycleclock.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,16 @@ inline BENCHMARK_ALWAYS_INLINE int64_t Now() {
struct timeval tv;
gettimeofday(&tv, nullptr);
return static_cast<int64_t>(tv.tv_sec) * 1000000 + tv.tv_usec;
#elif defined(__hppa__)
// HP PA-RISC provides a user-readable clock counter (cr16), but
// it's not syncronized across CPUs and only 32-bit wide when programs
// are built as 32-bit binaries.
// Use clock_gettime(CLOCK_MONOTONIC, ...) instead of gettimeofday
// because is provides nanosecond resolution.
// Initialize to always return 0 if clock_gettime fails.
struct timespec ts = {0, 0};
clock_gettime(CLOCK_MONOTONIC, &ts);
return static_cast<int64_t>(ts.tv_sec) * 1000000000 + ts.tv_nsec;
#else
// The soft failover to a generic implementation is automatic only for ARM.
// For other platforms the developer is expected to make an attempt to create
Expand Down

0 comments on commit 79837e1

Please sign in to comment.