aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
5 daysUpgrade google-benchmark to bc946b919cac6f25a199a526da571638cfde109fHEADmastermainElliott Hughes
This project was upgraded with external_updater. Usage: tools/external_updater/updater.sh update external/google-benchmark For more info, check https://cs.android.com/android/platform/superproject/+/main:tools/external_updater/README.md Test: TreeHugger Change-Id: I99620b3dfaa6fe54a1a1ebe857e4affb449fc469
2024-04-15Modernize wheel building job config (#1783)upstream-mainNicholas Junge
It is now possible to build Mac wheels on native machines in Github Actions, so ARM64 Mac wheels are now built and tested on M1 machines. Also, the artifact up-/download was migrated to v4, which made it necessary to upload wheels to unique artifact names, and then later stitch them together again in a subsequent job. The cross-platform Mac build injection in setup.py was removed, since it is no longer necessary. I relanded a monkey-patching of Bazel build files, this time for MODULE.bazel. This is because `rules_python` does not allow running as the root user, which is the case in cibuildwheel+Linux (happens in a Docker container). Since I did not see a quick way of switching to rootless containers, and did not want to hardcode the config change (it can apparently cause cache misses and build failures), I inject the "ignore_root_user_error" flag into the MODULE.bazel file when running in cibuildwheel on Linux.
2024-04-15Switch git override to stable BCR tag for nanobind_bazel (#1778)Nicholas Junge
This comes following the first BCR release of nanobind_bazel. Feature-wise, nothing substantial has changed, except that the extensions are stripped of debug info when built in release mode, which reduces clutter in the symbol tables. No stubgen yet, since nanobind v2 has not been released yet.
2024-04-14Add `benchmark_main.pc` to link `main()` containing library (#1779)David Seifert
This is similar to the addition in https://github.com/google/googletest/commit/8604c4adac40573f806cfadae44e22f8dfaf212a#diff-eb8e49bdf5e9aafb996777a4f4302ad1efd281222bf3202eb9b77ce47496c345 that added pkg-config support in GTest. Without this, users need to manually find the library containing `main()`.
2024-04-13Refactor: Return frequency as double (#1782)dhairya
Adjusted the GetSysctl call in sysinfo.cc to ensure the frequency value is returned as a double rather than an integer. This helps maintain consistency and clarity in the codebase.
2024-04-03Remove COMPILER_IBMXL macro for z/OS (#1777)Fanbo Meng
COMPILER_IBMXL identifies the Clang based IBM XL compiler (xlclang) on z/OS. This compiler is obsolete and replaced by the Open XL compiler, so the macro is no longer needed and the existing code would lead to incorrect asm syntax for Open XL.
2024-03-24Fix OpenBSD build (#1772)Vasyl Zubko
2024-03-21allow BENCHMARK_VERSION to be undefined (#1769)PhilipDeegan
2024-03-18clang-tidy broke the world (#1766)Roman Lebedev
`AnalyzeTemporaryDtors` option is no longer recognized by clang-tidy-18, and that renders the whole config invalid and completely ignored... ???
2024-03-09Fix implicit conversion changes signess warning in perf_counters.cc (#1765)Afanasyev Ivan
`read_bytes` is `ssize_t` (and we know it's non-negative), we need to explicitly cast it to `size_t`.
2024-03-07Add Python bindings build using bzlmod (#1764)Nicholas Junge
* Add a bzlmod Python bindings build Uses the newly started `@nanobind_bazel` project to build nanobind extensions. This means that we can drop all in-tree custom build defs and build files for nanobind and the C++ Python headers. Additionally, the temporary WORKSPACE overwrite hack naturally goes away due to the WORKSPACE system being obsolete. * Bump ruff -> v0.3.1, change ruff settings The latest minor releases incurred some formatting and configuration changes, this commit rolls them out. --------- Co-authored-by: dominic <510002+dmah42@users.noreply.github.com>
2024-03-07mitigate clang build warnings -Wconversion (#1763)dominic
* mitigate clang build warnings -Wconversion * ensure we have warnings set everywhere and fix some
2024-03-06Fixed LTO issue on no discard variable (#1761)Tiago Freire
Improve `UseCharPointer()` (thus, `DoNotOptimize()`) under MSVC LTO, make it actually escape the pointer and prevent it from being optimized away.
2024-03-06Revert "fix some warnings" (#1762)Roman Lebedev
This reverts commit 1576991177ba97a4b2ff6c45950f1fa6e9aa678c.
2024-02-20fix some warningsDominic Hamon
2024-02-19Rewrite complexity_test to use (hardcoded) manual time (#1757)Roman Lebedev
* Rewrite complexity_test to use (hardcoded) manual time This test is fundamentally flaky, because it tried to read tea leafs, and is inherently misbehaving in CI environments, since there are unmitigated sources of noise. That being said, the computed Big-O also depends on the `--benchmark_min_time=` Fixes https://github.com/google/benchmark/issues/272 * Correctly compute Big-O for manual timings. Fixes #1758. * complexity_test: do more stuff in empty loop * Make all empty loops be a bit longer empty Looks like on windows, some of these tests still fail, i guess clock precision is too small.
2024-02-14sysinfo.cc: Always abort on GetNumCPUs failure (#1756)Sam James
Defines a wrapper function, CheckNumCPUs, which enforces that GetNumCPUs never returns fewer than one CPU. There is no reasonable way to continue if we are unable to identify the number of CPUs. Signed-off-by: Sam James <sam@gentoo.org>
2024-02-14CycleClock: Add support for Alpha architecture (#1753)Sam James
* Add support for Alpha architecture As documented, the real cycle counter is unsafe to use here, because it is a 32-bit integer which wraps every ~4s. Use gettimeofday instead, which has a limitation of a low-precision real-time-clock (~1ms), but no wrapping. Passes test suite. Support parsing /proc/cpuinfo on Alpha tabular_test: add a missing DoNotOptimize call
2024-02-12fix typo in GetBenchmarkVersion() (#1755)Matthias Liedtke
2024-02-02Deflake CI (#1751)Roman Lebedev
* `complexity_test`: deflake, same as https://github.com/google/benchmark/issues/272 As it can be seen in e.g. https://github.com/google/benchmark/actions/runs/7711328637/job/21016492361 We may get `65: BM_Complexity_O1_BigO 0.00 N^2 0.00 N^2 ` * `user_counters_tabular_test`: deflake We were still getting zero times there. Perhaps this is better?
2024-01-30Add `BENCHMARK_TEMPLATE[12]_CAPTURE`, fusion of `BENCHMARK_CAPTURE` and ↵Roman Lebedev
`BENCHMARK_TEMPLATE` (#1747) Test coverage isn't great, but not worse than the existing one. You'd think `BENCHMARK_CAPTURE` would suffice, but you can't pass `func<targs>` to it (due to the `<` and `>`), and when passing `(func<targs>)` we get issues with brackets. So i'm not sure if we can fully avoid this helper. That being said, if there is only a single template argument, `BENCHMARK_CAPTURE()` works fine if we avoid using function name.
2024-01-29set library version in bazel (#1746)dominic
* set library version in bazel
2024-01-29Output library / schema versions in JSON context block (#1742)Roman Lebedev
* CMake: `get_git_version()`: just use `--dirty` flag of `git describe` * CMake: move version normalization out of `get_git_version()` Mainly, i want `get_git_version()` to return true version, not something sanitized. * JSON reporter: store library version and schema version in `context` * Tools: discard inputs with unexpected `json_schema_version` * Extract version string into `GetBenchmarkVersiom()` --------- Co-authored-by: dominic <510002+dmah42@users.noreply.github.com>
2024-01-29ignore new bzlmod lock fileDominic Hamon
2024-01-29changes to run bazel migration scriptsDominic Hamon
part of #1743
2024-01-18Bump pre-commit dependencies (#1740)Nicholas Junge
Also fix a mypy error in `tools.gbench.util` - the condition behaves the same as before, but in the new mypy version, the old condition results in an unreachable code error for the final `return False` statement. This is most likely a bug in mypy's reachability analysis, but the fix is easy enough here to circumvent it.
2024-01-16Fix C-style typecasting in QNX-specific code (#1739)Aleksey
C-style typecasting breaks the build due to `-Werror=old-style-cast` which should remain in place.
2024-01-10Docs: `reducing_variance.md`: proofreading, fix typos (#1736)Roman Lebedev
2024-01-09fix(cmakelists.txt): enforce CMake to find PFM or fail when ↵Ananta Bastola
BENCHMARK_ENABLE_LIBPFM is ON (#1705) Fixes #1702
2024-01-09Issue 1734: Streams not flushed if not running actual benchmarks (#1735)Benny Tordrup
Consistently flush Out and Err streams, otherwise they might not get flushed and the output lost when using custom streams. Fixes #1734.
2024-01-08tools/compare: don't actually discard valid (but zero) `pvalue` (#1733)Roman Lebedev
* tools/compare: when dumping json, pretty-print it It's rather completely non-human-readable otherwise. I can't imagine the filesize really matters, and if it does, it should just be compressed later on. * tools/compare: add failing test * tools/compare: don't actually discard valid (but zero) `pvalue` So, this is embarressing. For a very large number of repetitions, we can end up with pvalue of a true zero, and it obviously compares false, and we treat it as-if we failed to compute it...
2024-01-05Issue1731 created console does not receive output (#1732)Benny Tordrup
* Instead of directly comparing std::cout and GetOutputStream(), the underlying buffers are retreived via rdbuf(), and then compared. * Instead of fflush(stdout), call out.flush(). Use out << FormatString() instead of vprintf --------- Co-authored-by: dominic <510002+dmah42@users.noreply.github.com>
2024-01-05Merge branch 'aqrose-aidi-sdk-team-main'Dominic Hamon
2024-01-05Change Fixture to use non-const SetUp and TearDown in example (#1723)FantasqueX
Const SetUp and TearDown were deprecated in https://github.com/google/benchmark/pull/285 Co-authored-by: dominic <510002+dmah42@users.noreply.github.com>
2024-01-05Avoid leaking LFS flags to reverse dependencies (#1730)Li-Yu Yu
Follow up of #1725. `defines` propagates to reverse dependencies, while `local_defines` don't. If we use `defines` then there's risk of ODR violation: Suppose a user have a cc_library foo that depends on bar and benchmark: cc_library(name = "foo", deps = [":bar", "@com_github_google_benchmark//:benchmark"]) And bar has a class that has LFS-dependant ABI: cc_library(name = "foo") class Bar { off_t member; }; Bar would be compiled without LFS, but linked to foo when assuming LFS is enabled. So we limit LFS to within the library only. benchmark does not have LFS dependant public ABIs so it should be fine.
2024-01-05style: re-format BUILD file with buildifier.dhmemi
2024-01-04fix per-thread timing error on z/OS (#1719)Abhina Sree
Co-authored-by: dominic <510002+dmah42@users.noreply.github.com>
2024-01-04Enable Large-file Support (#1726)Tommy Chiang
* Enable Large-file Support This should fix https://github.com/google/benchmark/issues/1725 * Use whitespaces instead of tab in BUILD.bazel --------- Co-authored-by: dominic <510002+dmah42@users.noreply.github.com>
2024-01-04CycleClock: use RDTIME instead of RDCYCLE on RISC-V (#1727)aurel32
Starting with Linux 6.6 [1], RDCYCLE is a privileged instruction on RISC-V and can't be used directly from userland. There is a sysctl option to change that as a transition period, but it will eventually disappear. Use RDTIME instead, which while less accurate has the advantage of being synchronized between CPU (and thus monotonic) and of constant frequency. [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=cc4c07c89aada16229084eeb93895c95b7eabaa3 Co-authored-by: dominic <510002+dmah42@users.noreply.github.com>
2024-01-04Update perf_counters_gtest.cc (#1728)hamptonm1
2024-01-03Fix division by zero for low frequency timers for CV statistics (#1724)Afanasyev Ivan
2023-12-22fix: fail to import gbench in bazel and python3.12dhmemi
2023-12-20define HOST_NAME_MAX for z/oS (#1717)Abhina Sree
2023-12-20Fix mis-matching argument in closing tag for cmake macro (#1714) (#1715)IS
Co-authored-by: Iakov Sergeev <yahontu@gmail.com>
2023-12-19Check out repo at depth 0 for Python tests, bump Python and PyPI actions (#1713)Nicholas Junge
The reason for this is that `setuptools-scm` installs a version relative to the last release tag - if no tag is found, the default version is taken to be v0.1.0. This was the case in GitHub Actions, where only the PR branch is checked out. Also unpins build system requirements in the `pyproject.toml`. The sdist build system was changed to `build` from `python setup.py sdist` for forward compatibility - `build` is superior in every way, and the advertised solution by both cibuildwheel and PyPA itself. Bump `actions/setup-python` to v5, `pypa/gh-action-pypi-publish` to v1.8.11, and `docker/setup-qemu-action` to v3.
2023-12-13Run `pre-commit autoupdate`, fix stale pyproject.toml comments (#1712)Nicholas Junge
* Run `pre-commit autoupdate`, fix stale pyproject.toml comments * Set `--enable_bzlmod=false` for the moment Until the newer nanobind tags are pushed to the BCR, it's best to disable bzlmod for the bindings, because the Python CI breaks due to Bazel 7 enabling bzlmod by default. * Remove E203 ignore, add linebreaks to semantically group ruff options
2023-12-07Upgrade core bazel dependencies (#1711)Nicholas Junge
Bumps `rules_foreign_cc` to v0.10.1 (October 2023), `bazel_skylib` to v1.5.0 (November 2023), `rules_python` to v0.27.1 (December 2023). Also syncs GoogleTest to v1.12.1 (the last C++11 supporting version) to be the same as in MODULE.bazel. Since the latest `rules_python` changed its setup calling convention, that is updated also in the WORKSPACE file.
2023-12-07Fix editable install by unsetting `build_ext.copy_extensions_to_source` (#1710)Nicholas Junge
This method was the culprit for the recent editable install breakage, since it just tries to copy the generated extension file without checking its existence. Since the `BazelExtension` uses a non-standard location to store the build artifacts, calling the copy method fails the build since the extension is not found in the expected location. But, since we already copy the file into the source tree as part of the `BazelExtension.bazel_build` method, it's fine - the extension appears in the right place, and the egg info is generated correctly as well. This method also does not affect the general install, so it solves the editable problem without regressing the fixed install. Co-authored-by: dominic <510002+dmah42@users.noreply.github.com>
2023-12-07[NFC] `complexity_n` is not of `IterationCount` type (#1709)Roman Lebedev
There is no bug here, but it gave me a scare the other day. It is not incorrect to use `IterationCount` here, since it's just an `int64_t` either way, but it's wildly confusing. Let's not do that. Co-authored-by: dominic <510002+dmah42@users.noreply.github.com>
2023-12-07Fix `pre-commit` GitHub Actions job (#1708)Nicholas Junge
For some reason, editable pip installs are now broken, which means that they will break the pre-commit workflow due to the `pip install -e .` instruction. Since the normal install is unaffected, we can just drop the `-e` switch. It does not matter which mode is used, since the environment is only used for linting.