Commit Graph

1602 Commits

Author SHA1 Message Date
Dominic Hamon ee965cbea1 add back /proc/cpuinfo as a fallback for some platforms
bazel / bazel.ubuntu-latest (push) Has been cancelled
bazel / bazel.windows-latest (push) Has been cancelled
clang-format-lint / check-clang-format (push) Has been cancelled
bazel / bazel.macos-latest (push) Has been cancelled
clang-tidy / run-clang-tidy (push) Has been cancelled
sanitizer / asan.Debug (push) Has been cancelled
sanitizer / msan.Debug (push) Has been cancelled
sanitizer / tsan.Debug (push) Has been cancelled
sanitizer / ubsan.Debug (push) Has been cancelled
sanitizer / asan.RelWithDebInfo (push) Has been cancelled
sanitizer / msan.RelWithDebInfo (push) Has been cancelled
sanitizer / tsan.RelWithDebInfo (push) Has been cancelled
sanitizer / ubsan.RelWithDebInfo (push) Has been cancelled
2025-02-05 11:30:00 +00:00
Brad Smith c35af58b61 Update error message now that /proc/cpuinfo is no longer in use (#1917)
c24774dc4f removed using /proc/cpuinfo
so no longer mention it in the error message.
2025-02-04 10:32:41 +00:00
Dominic Hamon 4a805f9f0f clang-tidy warning 2025-01-30 10:00:04 +00:00
Dominic Hamon 4642758438 fix some clang-tidy issues 2025-01-30 09:52:07 +00:00
xdje42 049f6e79cc [BUG] Run external profiler (ProfilerManager) same number of iterations #1913 (#1914)
Run the external profiler the same number of iterations as the
benchmark was run normally.
This makes, for example, a trace collected via ProfilerManager
consistent with collected PMU data.
2025-01-29 09:53:56 +00:00
Christian Clauss 3d027d7e38 ruff rule E501: Fix long lines in Python code (#1910)
* ruff rule E501: Fix long lines in Python code

* Add missing space

---------

Co-authored-by: dominic <510002+dmah42@users.noreply.github.com>
2025-01-22 16:43:07 +00:00
Christian Clauss 6f21075d9c GitHub Actions: build-and-test on an ARM processor (#1911)
[Standard GitHub-hosted runners for public repositories](https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories) --> `ubuntu-22.04-arm`, `ubuntu-24.04-arm`
2025-01-22 14:24:22 +00:00
Christian Clauss ecb5df6473 Lint Python: Add more ruff rules (#1909)
* Lint Python: Add more ruff rules

* range(len()) --> enumerate()

* zip(strict=True)
2025-01-22 11:50:00 +00:00
Nicholas Junge d6536acfe8 ci: Update pre-commit hooks (#1905)
As a fix, also turn the comment in libpfm's build file into a proper Starlark
docstring.

Co-authored-by: dominic <510002+dmah42@users.noreply.github.com>
2025-01-13 13:38:59 +00:00
Nicholas Junge 4834ae9e57 Update nanobind-bazel to v2.4.0 (#1904)
Contains nanobind v2.4.0, which brings some more functionality, free-threading fixes,
and performance improvements.
2025-01-13 13:33:04 +00:00
Helge Deller c24774dc4f Get number of CPUs with sysconf() on Linux (#1901)
* Get number of CPUs with sysconf() on Linux

Avoid parsing the /proc/cpuinfo just to get number of CPUs.
Instead use the portable function provided by glibc.

* Update sysinfo.cc
2025-01-09 16:07:43 +00:00
Helge Deller 39be87d300 Fix runtime crash when parsing /proc/cpuinfo fails (#1900)
The testcase fails on sparc64, because the parsing of /proc/cpuinfo
fails and thus currently returns "0" CPUs which finally leads
to division-by-zero faults in the tests.

Fix the issue by returning at least "1" CPU which allows the
tests to run. A error message will be printed in any case.

Long-term the code should be fixed to parse the cpuinfo output
on sparch which looks like this:
...
type            : sun4v
ncpus probed    : 48
ncpus active    : 48
2025-01-09 10:47:29 +00:00
Helge Deller 077db43001 cycleclock: Use cock_gettime() as fallback for any Linux architecture (#1899)
The Linux kernel provides the clock_gettime() functions since a long
time already, so it's possible to use it as a generic fallback option
for any architecture if no other (better) possibility has been provided
instead.

I noticed the benchmark package failed to build on debian on the SH-4
architecture, so with this change SH-4 is now the first user of this
fallback option.
2025-01-08 16:54:08 +00:00
0dminnimda f981f58da3 README.md: fix build instructions (#1880)
Co-authored-by: dominic <510002+dmah42@users.noreply.github.com>
2025-01-08 12:49:09 +00:00
Hamza 7ddc400d62 fix: remove clang-cl compilation warning (#1895)
- MP flag only applies to cl, not cl frontends to other compilers (e.g. clang-cl, icx-cl etc).

Co-authored-by: dominic <510002+dmah42@users.noreply.github.com>
2025-01-08 12:41:17 +00:00
Helge Deller f65741b2bd cycleclock: Support for PA-RISC (hppa) architecture (#1894)
Co-authored-by: dominic <510002+dmah42@users.noreply.github.com>
2025-01-08 12:03:53 +00:00
Keith Smiley 5af40e824d [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.
```
2025-01-08 11:26:44 +00:00
Devon Loehr f4f93b5553 Change SDK version check (#1887)
Now that github seems to have updated its builders, perhaps we can check the SDK version the more standard way.
2024-12-10 15:29:03 +00:00
Nicholas Junge ae52c9e66e Remove wheel merge job, merge artifacts on download (#1886)
This is supported by `actions/download-artifact@v4`, and endorsed by cibuildwheel
in their documentation (see https://cibuildwheel.pypa.io/en/stable/deliver-to-pypi/#github-actions).

Co-authored-by: dominic <510002+dmah42@users.noreply.github.com>
2024-12-10 12:27:12 +00:00
Dominic Hamon c8c66e0b4a remove unnecessary bazel action parameter 2024-12-10 12:07:53 +00:00
Dominic Hamon b32ae9c9af remove noenable_bzlmod as workspace support is going away 2024-12-10 12:04:53 +00:00
Nicholas Junge b2b0aab464 Fix malformed clang invocation in build_ext.run (#1884)
The fix is, unsurprisingly, to not invoke clang at all, because we use
Bazel to build everything anyway.

This also means that we can drop the setuptools pin.
2024-12-03 17:42:57 +00:00
Nicholas Junge 3d88affa59 Remove if statement from wheel upload job (#1883)
This to see if it works with the new artifact download config.
2024-11-29 11:55:32 +00:00
Nicholas Junge 4b0533b726 Add artifact name to download before wheel PyPI upload (#1882)
Otherwise, the folder structure gets messed up, and twine errors out.
2024-11-29 11:06:08 +00:00
Dominic Hamon c58e6d0710 v1.9.1 bump
bazel / bazel.macos-latest.no_bzlmod (push) Has been cancelled
bazel / bazel.ubuntu-latest.no_bzlmod (push) Has been cancelled
bazel / bazel.windows-latest.no_bzlmod (push) Has been cancelled
bazel / bazel.macos-latest.bzlmod (push) Has been cancelled
bazel / bazel.ubuntu-latest.bzlmod (push) Has been cancelled
bazel / bazel.windows-latest.bzlmod (push) Has been cancelled
clang-format-lint / check-clang-format (push) Has been cancelled
clang-tidy / run-clang-tidy (push) Has been cancelled
sanitizer / asan.Debug (push) Has been cancelled
sanitizer / msan.Debug (push) Has been cancelled
sanitizer / tsan.Debug (push) Has been cancelled
sanitizer / ubsan.Debug (push) Has been cancelled
sanitizer / asan.RelWithDebInfo (push) Has been cancelled
sanitizer / msan.RelWithDebInfo (push) Has been cancelled
sanitizer / tsan.RelWithDebInfo (push) Has been cancelled
sanitizer / ubsan.RelWithDebInfo (push) Has been cancelled
v1.9.1
2024-11-28 16:51:38 +00:00
Guo Ci d26047a0ac Improve examples on ComputeStatistics (#1881) 2024-11-27 09:41:06 +00:00
dominic 62a321d6dc update standard to C++17 per C++ build support (#1875)
* update standard to C++17 per C++ build support

* disable deadcode checks from clang-tidy

* fix redundant definition of constexpr
2024-11-13 13:06:48 +00:00
Nicholas Junge 50ffd3e546 Declare a Python 3.13 toolchain, revert setup.py toolchain arget selection (#1876)
The new solution was too smart (read: dense), because it did not account for
the fact that we look for the Windows libs of the interpreter building
the wheel, not the hermetic one supplying the header files.

The fix is to just align the versions again, so that the libs and headers
come from the same minor version.
2024-11-07 15:04:51 +00:00
Nicholas Junge a6af6eeb6a Add a Python matrix to ensure the bindings build on all supported versions (#1871)
Also contains a run of `pre-commit autoupdate`, and a bump of cibuildwheel
to its latest tag for CPython 3.13 support.

But, since we build for 3.10+ with SABI from 3.12 onwards, we don't even
need a dedicated Python 3.13 build job or toolchain - the wheels from 3.12
can be reused.

Simplifies some version-dependent logic around assembling the bazel
build command in setup.py, and fixes a possible unbound local error in
the toolchain patch context manager.
2024-11-06 13:15:22 +00:00
Nicholas Junge d99cdd7356 Add nb::is_flag() annotation to Counter::Flags (#1870)
This saves us the definition of `__or__`, because we can just use the
one from `enum.IntFlag`.
2024-10-28 18:18:40 +00:00
Richard Cole 4e3f2d8b67 [#1487] ensure that when printing color text the background color of the terminal on windows is preserved (#1865)
Co-authored-by: dominic <510002+dmah42@users.noreply.github.com>
2024-10-24 12:31:06 +01:00
xdje42 ffc727a859 Verify RegisterProfilerManager doesn't overwrite an existing registration (#1837)
* Verify RegisterProfilerManager doesn't overwrite an existing registration

Tested:
Add a second registration to test/profiler_manager_test.cc and
verify the test crashes as expected.

* Verify RegisterProfilerManager doesn't overwrite an existing registration

Tested:
Configure with:
cmake -GNinja -DCMAKE_BUILD_TYPE=Debug -DBENCHMARK_DOWNLOAD_DEPENDENCIES=on
Then run:
ctest -R profiler_manager_gtest
Before change test fails (expected), after change test passes (expected)

---------

Co-authored-by: dominic <510002+dmah42@users.noreply.github.com>
2024-10-24 10:22:58 +01:00
dominic c45d9c4c2f bump googletest version to match bazel (#1868)
* bump googletest version to match bazel

* bump minimum cmake to 3.13 per supported versions
2024-10-24 09:46:02 +01:00
Nicholas Junge be2134584d Update nanobind_bazel to v2.2.0 (#1866)
Adds support for free-threaded nanobind extension builds, though we
don't currently build a free-threaded wheel.

Co-authored-by: dominic <510002+dmah42@users.noreply.github.com>
2024-10-23 10:38:53 +01:00
dominic 498714357f upgrade bazel mods. requires c++14 for tests (#1867) 2024-10-23 10:27:18 +01:00
Alfredo Daniel Esponda Cervantes 761305ec3b Update user_guide.md (#1863)
PR for Issue #819: Fix Suffix in Console Format Table
This PR fixes an issue with an incorrect suffix displayed in the console output. 

Fixes #819.
2024-10-12 00:16:37 +03:00
Alecto Irene Perez 0c998f7cc4 Fix spurious warning 'misc-use-anonymous-namespace' (#1860) (#1861)
Disables 'misc-use-anonymous-namespace' for usage of the BENCHMARK
macro. This warning is spurious, and the variable declared by the
BENCHMARK macro can't be moved into an annonymous namespace.

We don't want to disable it globally, but it can be disabled locally,
for the `BENCHMARK` statement, as this warning appears downstream for
users.

See:
https://clang.llvm.org/extra/clang-tidy/#suppressing-undesired-diagnostics
2024-10-11 01:02:36 +03:00
Devon Loehr 24e0bd827a Add enum value from newest Windows SDK (#1859)
* Add enum value from newest Windows SDK

Windows SDK version 10.0.26100.0 adds a cache type value, `CacheUnknown`. This adds a case for that type to `sysinfo.cc`, which will otherwise complain about the switch statement being non-exhaustive when building with the new SDK.

Since the value doesn't exist in prior SDK versions, we only add the case conditionally. The condition can be removed if we ever decide to bump up the required SDK version.

* Fix SDK version macro

Make sure the version macro we're using for the SDK is properly indicative of version 10.0.26100.0. Also fix formatting complains from the linter.

* Add space to satisfy formatter

Formatter insists on two space before a comment after a macro...

* Change preprocessor condition

Try detecting the current SDK version in a slightly different way.

* Replace NTDDI_WIN11_GE with its value

Undefined constants are treated as 0 by the preprocessor, which causes the check to trivially return true for previous SDK versions. Replace the constant with its value (from the newest SDK version) instead,
2024-10-02 09:40:03 +01:00
Alfredo Daniel Esponda Cervantes 23d8c1e589 Version string correction in pkg-config files (#1858)
Co-authored-by: Alfredo Daniel Esponda Cervantes <92197886+DanEC1211@users.noreply.github.com>
2024-09-26 17:56:16 +01:00
Dominic Hamon 3fd1e6a7ae add dry run docs 2024-09-13 10:06:24 +01:00
dominic 72ecc4ea67 Added the functionality for a dry run benchmark called through the cli argument --benchmark_dry_run. (#1851)
* Added benchmark_dry_run boolean flag to command line options

* Dry run logic to exit early and override iterations, repetitions, min time, min warmup time

* Changeddry run override logic structure and added dry run to context

---------

Co-authored-by: Shaan <shaanmistry03@gmail.com>
Co-authored-by: Shaan Mistry <49106143+Shaan-Mistry@users.noreply.github.com>
2024-09-12 15:50:52 +01:00
Richard Cole 08fdf6eb84 enable the /MP MSVC compiler argument for parallel compilation (#1846) 2024-09-05 22:28:43 +01:00
Nicholas Junge 986423a62d Bump oldest supported Python to 3.10, eliminate setuptools-scm (#1842)
* Supply MacOS deployment target to delocate, use build+uv frontend

This shaves off multiple minutes from the wheel builds alone.

Also revert to trusted publishing for wheel uploads as it is now set up.

* Bump oldest supported Python to 3.10, eliminate setuptools-scm

The version is now a string again, under the same attribute as it was
before. This is a pragmatic decision in order to be able to upload wheels
again, possibly directly from main.

We could in the future also set the Python version to a development version
if we want to avoid accidental uploads of `main`.

* Add a note on supported Python versions in the docs

Also fixes the setuptools failure observed in the latest CI by pinning
to the last version before v73 until the problem is identified and resolved.
2024-09-04 17:42:07 +01:00
Igor Zhukov c19cfee61e Fix C4459: Rename a function parameter profiler_manager to avoid hiding the global declaration. (#1839)
* Fix C4459: Rename a function parameter `profiler_manager` to avoid hiding the global declaration.

* Treat warnings as errors for MSVC

* disable one warning for MSVC
2024-08-19 06:39:37 +03:00
Chris Kennelly 6126d2a205 Align benchmark::State to a cacheline. (#1230)
* Align benchmark::State to a cacheline.

This can avoid interference with neighboring objects and stabilize
benchmark results.

* separate cachline definition from alignment attribute macro

Co-authored-by: Roman Lebedev <lebedev.ri@gmail.com>

---------

Co-authored-by: dominic <510002+dmah42@users.noreply.github.com>
Co-authored-by: Roman Lebedev <lebedev.ri@gmail.com>
2024-08-16 16:10:18 +01:00
Alex Bilger 437fea4b54 Fix Python manual timing example (#1722)
According to the user guide, when manual timing, it is necessary to explicit it by using the `UseManualTime` function. Its equivalent in Python is use_manual_time(). This function was not called in the example.

It is possible to verify that the use of this function has an impact on the measure by adding another `time.sleep(0.01)` at the end of the iteration. There is a x2 difference depending on whether `use_manual_time()` is used or not.

Co-authored-by: dominic <510002+dmah42@users.noreply.github.com>
2024-08-16 15:32:48 +01:00
Dominic Hamon ec3dc37b60 separate wheel versions in an effort to avoid timeouts 2024-08-16 11:56:56 +01:00
Dominic Hamon 12235e2465 v1.9.0
bazel / bazel.macos-latest.no_bzlmod (push) Has been cancelled
bazel / bazel.ubuntu-latest.no_bzlmod (push) Has been cancelled
bazel / bazel.windows-latest.no_bzlmod (push) Has been cancelled
bazel / bazel.macos-latest.bzlmod (push) Has been cancelled
bazel / bazel.ubuntu-latest.bzlmod (push) Has been cancelled
bazel / bazel.windows-latest.bzlmod (push) Has been cancelled
clang-format-lint / check-clang-format (push) Has been cancelled
clang-tidy / run-clang-tidy (push) Has been cancelled
sanitizer / asan.Debug (push) Has been cancelled
sanitizer / msan.Debug (push) Has been cancelled
sanitizer / tsan.Debug (push) Has been cancelled
sanitizer / ubsan.Debug (push) Has been cancelled
sanitizer / asan.RelWithDebInfo (push) Has been cancelled
sanitizer / msan.RelWithDebInfo (push) Has been cancelled
sanitizer / tsan.RelWithDebInfo (push) Has been cancelled
sanitizer / ubsan.RelWithDebInfo (push) Has been cancelled
v1.9.0
2024-08-16 11:08:15 +01:00
dominic a008bf82f4 Ensure reported Time is walltime by removing spurious scaling by threads (#1836)
* change the default to not scale
2024-08-13 18:12:02 +01:00
Ikko Eltociear Ashimine b884717437 chore: update perf_counters.cc (#1831)
peformance -> performance
2024-08-05 10:05:40 +01:00