aboutsummaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAge
* Fix C4459: Rename a function parameter `profiler_manager` to avoid hiding ↵Igor Zhukov2024-08-19
| | | | | | | | | | 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
* Ensure reported Time is walltime by removing spurious scaling by threads (#1836)dominic2024-08-13
| | | | * change the default to not scale
* chore: update perf_counters.cc (#1831)Ikko Eltociear Ashimine2024-08-05
| | | peformance -> performance
* Move ProfilerManager Start/Stop routines closer to actual benchmark #1807 ↵xdje422024-08-01
| | | | | | | | | | | (#1818) Previously, the Start/Stop routines were called before the benchmark function was called and after it returned. However, what we really want is for them to be called within the core of the benchmark: for (auto _ : state) { // This is what we want traced, not the entire BM_foo function. }
* Use log2 now that NDK requires at least API 21 which includes it. (#1822)dominic2024-07-24
| | | Fixes #1820
* Suppress invalid-offsetof warning for clang (#1821)Devon Loehr2024-07-24
| | | For several compilers, `benchmark.cc` suppresses a warning regarding its use of `offsetof`. This merely extends that suppression to cover clang as well.
* clang format yet againDominic Hamon2024-07-17
|
* another reversal of something that breaks on wasmDominic Hamon2024-07-17
|
* clang-format fixesDominic Hamon2024-07-17
|
* roll back fatal error that breaks some platform (wasm) expectationsDominic Hamon2024-07-17
|
* revert perf counters change until we can do the full versionDominic Hamon2024-07-16
|
* [FR] Add API to provide custom profilers #1807 (#1809)xdje422024-07-16
| | | | | | | | This API is akin to the MemoryManager API and lets tools provide their own profiler which is wrapped in the same way MemoryManager is wrapped. Namely, the profiler provides Start/Stop methods that are called at the start/end of running the benchmark in a separate pass. Co-authored-by: dominic <510002+dmah42@users.noreply.github.com>
* add PERF_FORMAT_TOTAL_TIME_{ENABLED,RUNNING} to support multiplexing (#1814)dominic2024-07-12
|
* Add -lkstat to the .pc for Solaris (#1801)Chris Cotter2024-07-03
| | | | | | | | | | | | | | | | * Add -lkstat to the .pc for Solaris This fixes linking for projects that rely on pkg-config to generate the link line on Solaris. Test plan: Built the project locally on Solaris and verified -kstat appears in the .pc file ``` $ cat lib/pkgconfig/benchmark.pc | grep Libs.private Libs.private: -lpthread -lkstat ``` * Use BENCHMARK_PRIVATE_LINK_LIBRARIES
* cycleclock: Fix type conversion to match function return type on riscv64 (#1802)Khem Raj2024-06-11
| | | | | | | | Fixes builds with clang src/cycleclock.h:213:10: error: implicit conversion changes signedness: 'uint64_t' (aka 'unsigned long') to 'int64_t' (aka 'long') [-Werror,-Wsign-conversion] 213 | return cycles; | ~~~~~~ ^~~~~~ 1 error generated.
* cycleclock: Fix type conversion to match function return type (#1794)Khem Raj2024-05-29
| | | | | | | | fixes build with clang19 src/cycleclock.h:208:52: error: implicit conversion changes signedness: 'uint64_t' (aka 'unsigned long long') to 'int64_t' (aka 'long long') [-Werror,-Wsign-conversion] 208 | return (static_cast<uint64_t>(cycles_hi1) << 32) | cycles_lo; | ~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~ 1 error generated.
* Improve compatibility with Hexagon hardware (#1785)Steven Johnson2024-05-23
| | | | The customization done via BENCHMARK_OS_QURT works just fine with the Hexagon simulator, but on at least some Hexagon hardware, both `qurt_timer_get_ticks()` and `std::chrono::now()` are broken and always return 0. This fixes the former by using the better-supported (and essentially identical `qurt_sysclock_get_hw_ticks()` call, and the latter by reading a 19.2MHz hardware counter (per suggestion from Qualcomm). Local testing seems to indicate these changes are just as robust under the simulator as before.
* Add `benchmark_main.pc` to link `main()` containing library (#1779)David Seifert2024-04-14
| | | | | 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()`.
* Refactor: Return frequency as double (#1782)dhairya2024-04-13
| | | | | 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.
* Remove COMPILER_IBMXL macro for z/OS (#1777)Fanbo Meng2024-04-03
| | | 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.
* Fix OpenBSD build (#1772)Vasyl Zubko2024-03-24
|
* allow BENCHMARK_VERSION to be undefined (#1769)PhilipDeegan2024-03-21
|
* Fix implicit conversion changes signess warning in perf_counters.cc (#1765)Afanasyev Ivan2024-03-09
| | | | `read_bytes` is `ssize_t` (and we know it's non-negative), we need to explicitly cast it to `size_t`.
* mitigate clang build warnings -Wconversion (#1763)dominic2024-03-07
| | | | | | * mitigate clang build warnings -Wconversion * ensure we have warnings set everywhere and fix some
* Fixed LTO issue on no discard variable (#1761)Tiago Freire2024-03-06
| | | | Improve `UseCharPointer()` (thus, `DoNotOptimize()`) under MSVC LTO, make it actually escape the pointer and prevent it from being optimized away.
* Rewrite complexity_test to use (hardcoded) manual time (#1757)Roman Lebedev2024-02-19
| | | | | | | | | | | | | | | | | | | | * 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.
* sysinfo.cc: Always abort on GetNumCPUs failure (#1756)Sam James2024-02-14
| | | | | | | 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>
* CycleClock: Add support for Alpha architecture (#1753)Sam James2024-02-14
| | | | | | | | | | | | | * 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
* fix typo in GetBenchmarkVersion() (#1755)Matthias Liedtke2024-02-12
|
* set library version in bazel (#1746)dominic2024-01-29
| | | * set library version in bazel
* Output library / schema versions in JSON context block (#1742)Roman Lebedev2024-01-29
| | | | | | | | | | | | | | | | | | * 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>
* Fix C-style typecasting in QNX-specific code (#1739)Aleksey2024-01-16
| | | C-style typecasting breaks the build due to `-Werror=old-style-cast` which should remain in place.
* Issue 1734: Streams not flushed if not running actual benchmarks (#1735)Benny Tordrup2024-01-09
| | | | | | Consistently flush Out and Err streams, otherwise they might not get flushed and the output lost when using custom streams. Fixes #1734.
* Issue1731 created console does not receive output (#1732)Benny Tordrup2024-01-05
| | | | | | | | | | * 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>
* fix per-thread timing error on z/OS (#1719)Abhina Sree2024-01-04
| | | Co-authored-by: dominic <510002+dmah42@users.noreply.github.com>
* CycleClock: use RDTIME instead of RDCYCLE on RISC-V (#1727)aurel322024-01-04
| | | | | | | | | | | | | 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>
* Fix division by zero for low frequency timers for CV statistics (#1724)Afanasyev Ivan2024-01-03
|
* define HOST_NAME_MAX for z/oS (#1717)Abhina Sree2023-12-20
|
* [NFC] `complexity_n` is not of `IterationCount` type (#1709)Roman Lebedev2023-12-07
| | | | | | | | 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>
* Add missing `\n` character at end of error log string (#1700)Anjan Roy2023-11-13
| | | | | Closes https://github.com/google/benchmark/issues/1699 Signed-off-by: Anjan Roy <hello@itzmeanjan.in>
* Fixed compiler warnings (#1697)Tiago Freire2023-11-10
| | | | | | | | | | | | * fixed warnings used proper math functions * ran clang format * used a more up-to-date clang-format * space twedling * reveretd CMakeLists.txt
* Increase the kMaxIterations limit (#1668)Andreas Abel2023-10-17
| | | | | | | | | | | | | * Increase the kMaxIterations limit This fixes #1663. Note that as a result of this change, the columns in the console output can become misaligned if the actual iteration count is too high. This will be dealt with in a separate commit. * Fix failing test on Windows * Fix formatting --------- Co-authored-by: dominic <510002+dmah42@users.noreply.github.com>
* fix format in src/sysinfoDominic Hamon2023-10-17
|
* Fix building on MinGW: default `WINVER` is too old (#1681)Ming Zero2023-10-16
| | | | | MinGW defaults `WINVER` to something very old, while benchmark requires features gated by `WINVER = 0x0600`, so manually set update to that.
* Make json and csv output consistent. (#1662)Andreas Abel2023-09-26
| | | | | | | | | | | | | * Make json and csv output consistent. Currently, the --benchmark_format=csv option does not output the correct value for the cv statistics. Also, the json output should not contain a time unit for the cv statistics. * fix formatting * undo json change --------- Co-authored-by: dominic <510002+dmah42@users.noreply.github.com>
* tweak comment wordingDominic Hamon2023-08-25
|
* StatisticsMedian: Fix bugJesse Rosenstock2023-08-24
| | | | | | | | | | | | | Previously, this could return the wrong result when there was an even number of elements. There were two `nth_element` calls. The second call could change elements in `[center2, end])`, which was where `center` pointed. Therefore, `*center` sometimes had the wrong value after the second `nth_element` call. Rewrite to use `max_element` instead of the second call to `nth_element`. This avoids modifying the vector.
* perf_counters: Initialize once only when needed (#1656)Jesse Rosenstock2023-08-24
| | | | | | | | | | | | | | | | | | | | | * perf_counters: Initialize once only when needed This works around some performance problems running Android under QEMU. Calling `pfm_initialize` was very slow, and was called during dynamic initialization (before `main` or when loaded as a shared library). This happened whenever benchmark was linked, even if no benchmarks were run. Instead, call `pfm_initialize` at most once, and only when one of: 1. `PerfCounters::Initialize` is called 2. `PerfCounters::Create` is called with a non-empty counter list 3. `PerfCounters::IsCounterSupported` is called The return value of the first `pfm_initialize()` is saved and returned from all subsequent `PerfCounters::Initialize` calls. * perf_counters: Make success var const * InitLibPfmOnce: Inline function
* State: Initialize counters with kAvgIteration in constructor (#1652)Jesse Rosenstock2023-08-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * State: Initialize counters with kAvgIteration in constructor Previously, `counters` was updated in `PauseTiming()` with `counters[name] += Counter(measurement, kAvgIteration)`. The first `counters[name]` call inserts a counter with no flags. There is no `operator+=` for `Counter`, so the insertion is done by converting the `Counter` to a `double`, then constructing a `Counter` to insert from the `double`, which drops the flags. Pre-insert the `Counter` with the correct flags, then only update `Counter::value`. Introduced in 1c64a36 ([perf-counters] Fix pause/resume (#1643)). * perf_counters_test.cc: Don't divide by iterations Perf counters are now divided by iterations, so dividing again in the test is wrong. * State: Fix shadowed param error * benchmark.cc: Fix clang-tidy error --------- Co-authored-by: dominic <510002+dmah42@users.noreply.github.com>
* benchmark.cc: Fix benchmarks_with_threads condition (#1651)Jesse Rosenstock2023-08-17
| | | | | Change condition for `benchmarks_with_threads` from `benchmark.threads() > 0` to `> 1`. `threads()` appears to always be `>= 1`. Introduced in fbc6efa (Refactoring of PerfCounters infrastructure (#1559))