1
0
mirror of https://github.com/google/benchmark.git synced 2025-04-17 23:12:30 +08:00

Merge branch 'main' into fix_readme_build_instructions

This commit is contained in:
dominic 2025-01-08 11:06:46 +00:00 committed by GitHub
commit 27f11d431c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 15 additions and 28 deletions

View File

@ -6,13 +6,12 @@ on:
jobs:
build_and_test_default:
name: bazel.${{ matrix.os }}.${{ matrix.bzlmod && 'bzlmod' || 'no_bzlmod' }}
name: bazel.${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
bzlmod: [false, true]
steps:
- uses: actions/checkout@v4
@ -28,8 +27,8 @@ jobs:
- name: build
run: |
bazel build ${{ matrix.bzlmod && '--enable_bzlmod' || '--noenable_bzlmod' }} //:benchmark //:benchmark_main //test/...
bazel build //:benchmark //:benchmark_main //test/...
- name: test
run: |
bazel test ${{ matrix.bzlmod && '--enable_bzlmod' || '--noenable_bzlmod' }} --test_output=all //test/...
bazel test --test_output=all //test/...

View File

@ -53,12 +53,11 @@ jobs:
platforms: all
- name: Build wheels on ${{ matrix.os }} using cibuildwheel
uses: pypa/cibuildwheel@v2.21.3
uses: pypa/cibuildwheel@v2.22.0
env:
CIBW_BUILD: "cp310-* cp311-* cp312-*"
CIBW_BUILD_FRONTEND: "build[uv]"
CIBW_SKIP: "*-musllinux_*"
CIBW_TEST_SKIP: "cp38-macosx_*:arm64"
CIBW_ARCHS_LINUX: auto64 aarch64
CIBW_ARCHS_WINDOWS: auto64
CIBW_BEFORE_ALL_LINUX: bash .github/install_bazel.sh
@ -74,27 +73,16 @@ jobs:
name: dist-${{ matrix.os }}
path: wheelhouse/*.whl
merge_wheels:
name: Merge all built wheels into one artifact
runs-on: ubuntu-latest
needs: build_wheels
steps:
- name: Merge wheels
uses: actions/upload-artifact/merge@v4
with:
name: dist
pattern: dist-*
delete-merged: true
pypi_upload:
name: Publish google-benchmark wheels to PyPI
needs: [merge_wheels]
needs: [build_sdist, build_wheels]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
path: dist
pattern: dist-*
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1

View File

@ -1,7 +1,7 @@
# Require CMake 3.10. If available, use the policies up to CMake 3.22.
cmake_minimum_required (VERSION 3.13...3.22)
project (benchmark VERSION 1.9.0 LANGUAGES CXX)
project (benchmark VERSION 1.9.1 LANGUAGES CXX)
option(BENCHMARK_ENABLE_TESTING "Enable testing of the benchmark library." ON)
option(BENCHMARK_ENABLE_EXCEPTIONS "Enable the use of exceptions in the benchmark library." ON)

View File

@ -1,6 +1,6 @@
module(
name = "google_benchmark",
version = "1.9.0",
version = "1.9.1",
)
bazel_dep(name = "bazel_skylib", version = "1.7.1")

View File

@ -50,7 +50,7 @@ from google_benchmark._benchmark import (
oNSquared as oNSquared,
)
__version__ = "1.9.0"
__version__ = "1.9.1"
class __OptionMaker:

View File

@ -1106,6 +1106,7 @@ void BM_spin_empty(benchmark::State& state) {
}
BENCHMARK(BM_spin_empty)
->Repetitions(3) // or add option --benchmark_repetitions=3
->ComputeStatistics("max", [](const std::vector<double>& v) -> double {
return *(std::max_element(std::begin(v), std::end(v)));
})
@ -1125,8 +1126,9 @@ void BM_spin_empty(benchmark::State& state) {
}
BENCHMARK(BM_spin_empty)
->Repetitions(3) // or add option --benchmark_repetitions=3
->ComputeStatistics("ratio", [](const std::vector<double>& v) -> double {
return std::begin(v) / std::end(v);
return v.front() / v.back();
}, benchmark::StatisticUnit::kPercentage)
->Arg(512);
```

View File

@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools<73"]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
[project]

View File

@ -77,7 +77,6 @@ class BuildBazelExtension(build_ext.build_ext):
def run(self):
for ext in self.extensions:
self.bazel_build(ext)
super().run()
# explicitly call `bazel shutdown` for graceful exit
self.spawn(["bazel", "shutdown"])

View File

@ -354,8 +354,7 @@ std::vector<CPUInfo::CacheInfo> GetCacheSizesWindows() {
C.type = "Unknown";
switch (cache.Type) {
// Windows SDK version >= 10.0.26100.0
// 0x0A000010 is the value of NTDDI_WIN11_GE
#if NTDDI_VERSION >= 0x0A000010
#ifdef NTDDI_WIN11_GE
case CacheUnknown:
break;
#endif