From 5af40e824defae36fb70521c793af0594599ac7e Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Wed, 8 Jan 2025 03:26:44 -0800 Subject: [PATCH 1/2] [bazel] Remove selects on CPU (#1892) In a future version of bazel this produces a warning. In this case using only the platform being windows is enough. Fixes: ``` WARNING: /.../benchmark/BUILD.bazel:29:15: in config_setting rule //:windows: select() on cpu is deprecated. Use platform constraints instead: https://bazel.build/docs/configurable-attributes#platforms. ``` --- BUILD.bazel | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index 3451b4e758..95557a35b2 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -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 = { From f65741b2bd92461dc2c816056eb9c996ae48ad62 Mon Sep 17 00:00:00 2001 From: Helge Deller Date: Wed, 8 Jan 2025 13:03:53 +0100 Subject: [PATCH 2/2] cycleclock: Support for PA-RISC (hppa) architecture (#1894) Co-authored-by: dominic <510002+dmah42@users.noreply.github.com> --- src/cycleclock.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/cycleclock.h b/src/cycleclock.h index bd62f5d7e7..7852f3df52 100644 --- a/src/cycleclock.h +++ b/src/cycleclock.h @@ -229,6 +229,16 @@ inline BENCHMARK_ALWAYS_INLINE int64_t Now() { struct timeval tv; gettimeofday(&tv, nullptr); return static_cast(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(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