Commit Graph

1379 Commits

Author SHA1 Message Date
Dominic Hamon 0e1255af2f
Removing freenode from README
It seems that by setting the /topic in freenode #googlebenchmark to point to libera I have angered the powers that be and we've been locked out of the channel. Libera it is then.
2021-05-28 11:09:18 +01:00
Mariusz Wachowicz db2de74cc8
Fix pedantic compilation flag violation (#1156)
';' after method definition was removed.
Also, pedantic flag is now uncommented in CMakeList.txt.
2021-05-21 09:48:20 +01:00
Kai Germaschewski a4bcd937b2
fix version recorded in releases (#1047)
* cmake: fix handling the case where `git describe` fails

* cmake: fix version recorded in releases

If downloaded as a tarball release, there will be no info from git
to determine the release, so it ends up v0.0.0. If that's the case,
we'll now use the release specified in the project() command,
which needs to be updated for each new release.

* cmake: add `--tags` to `git describe`

That way, lightweight tags will also be taken into account, which should
never hurt, but it'll help in cases where, for some mysterious reason or
other, annotated tags don't make it into a clone.

* update releasing.md
2021-05-20 17:59:29 +01:00
haih-g a6a738c1cc
Implementation of random interleaving. (#1105)
* Implementation of random interleaving. See
http://github.com/google/benchmark/issues/1051 for the feature requests.

Committer: Hai Huang (http://github.com/haih-g)

On branch fr-1051
Changes to be committed:
modified:   include/benchmark/benchmark.h
modified:   src/benchmark.cc
new file:   src/benchmark_adjust_repetitions.cc
new file:   src/benchmark_adjust_repetitions.h
modified:   src/benchmark_api_internal.cc
modified:   src/benchmark_api_internal.h
modified:   src/benchmark_register.cc
modified:   src/benchmark_runner.cc
modified:   src/benchmark_runner.h
modified:   test/CMakeLists.txt
new file:   test/benchmark_random_interleaving_gtest.cc

* Fix benchmark_random_interleaving_gtest.cc for fr-1051

Committer: Hai Huang <haih@google.com>

On branch fr-1051
Your branch is up to date with 'origin/fr-1051'.

Changes to be committed:
modified:   src/benchmark.cc
modified:   src/benchmark_runner.cc
modified:   test/benchmark_random_interleaving_gtest.cc

* Fix macos build for fr-1051

Committer: Hai Huang <haih@google.com>

On branch fr-1051
Your branch is up to date with 'origin/fr-1051'.

Changes to be committed:
modified:   src/benchmark_api_internal.cc
modified:   src/benchmark_api_internal.h
modified:   src/benchmark_runner.cc

* Fix macos and windows build for fr-1051.

Committer: Hai Huang <haih@google.com>

On branch fr-1051
Your branch is up to date with 'origin/fr-1051'.

Changes to be committed:
modified:   src/benchmark_runner.cc

* Fix benchmark_random_interleaving_test.cc for macos and windows in fr-1051

Committer: Hai Huang <haih@google.com>

On branch fr-1051
Your branch is up to date with 'origin/fr-1051'.

Changes to be committed:
modified:   test/benchmark_random_interleaving_gtest.cc

* Fix int type benchmark_random_interleaving_gtest for macos in fr-1051

Committer: Hai Huang <haih@google.com>

On branch fr-1051
Your branch is up to date with 'origin/fr-1051'.

Changes to be committed:
modified:   test/benchmark_random_interleaving_gtest.cc

* Address dominichamon's comments 03/29 for fr-1051

Committer: Hai Huang <haih@google.com>

On branch fr-1051
Your branch is up to date with 'origin/fr-1051'.

Changes to be committed:
modified:   src/benchmark.cc
modified:   src/benchmark_api_internal.cc
modified:   src/benchmark_api_internal.h
modified:   test/benchmark_random_interleaving_gtest.cc

* Address dominichamon's comment on default min_time / repetitions for fr-1051.
Also change sentinel of random_interleaving_repetitions to -1. Hopefully it
fixes the failures on Windows.

Committer: Hai Huang <haih@google.com>

On branch fr-1051
Your branch is up to date with 'origin/fr-1051'.

Changes to be committed:
modified:   src/benchmark.cc
modified:   src/benchmark_api_internal.cc
modified:   src/benchmark_api_internal.h

* Fix windows test failures for fr-1051

Committer: Hai Huang <haih@google.com>

On branch fr-1051
Your branch is up to date with 'origin/fr-1051'.

Changes to be committed:
modified:   src/benchmark_api_internal.cc
modified:   src/benchmark_runner.cc

* Add license blurb for fr-1051.

Committer: Hai Huang <haih@google.com>

On branch fr-1051
Your branch is up to date with 'origin/fr-1051'.

Changes to be committed:
modified:   src/benchmark_adjust_repetitions.cc
modified:   src/benchmark_adjust_repetitions.h

* Switch to std::shuffle() for fr-1105.

Committer: Hai Huang <haih@google.com>

On branch fr-1051
Your branch is up to date with 'origin/fr-1051'.

Changes to be committed:
modified:   src/benchmark.cc

* Change to 1e-9 in fr-1105

Committer: Hai Huang <haih@google.com>

On branch fr-1051
Your branch is up to date with 'origin/fr-1051'.

Changes to be committed:
modified:   src/benchmark_adjust_repetitions.cc

* Fix broken build caused by bad merge for fr-1105.

Committer: Hai Huang <haih@google.com>

On branch fr-1051
Your branch is up to date with 'origin/fr-1051'.

Changes to be committed:
modified:   src/benchmark_api_internal.cc
modified:   src/benchmark_runner.cc

* Fix build breakage for fr-1051.

Committer: Hai Huang <haih@google.com>

On branch fr-1051
Your branch is up to date with 'origin/fr-1051'.

Changes to be committed:
modified:   src/benchmark.cc
modified:   src/benchmark_api_internal.cc
modified:   src/benchmark_api_internal.h
modified:   src/benchmark_register.cc
modified:   src/benchmark_runner.cc

* Print out reports as they come in if random interleaving is disabled (fr-1051)

Committer: Hai Huang <haih@google.com>

On branch fr-1051
Your branch is up to date with 'origin/fr-1051'.

Changes to be committed:
modified:   src/benchmark.cc

* size_t, int64_t --> int in benchmark_runner for fr-1051.

Committer: Hai Huang <haih@google.com>

On branch fr-1051
Your branch is up to date with 'origin/fr-1051'.

Changes to be committed:
modified:   src/benchmark_runner.cc
modified:   src/benchmark_runner.h

* Address comments from dominichamon for fr-1051

Committer: Hai Huang <haih@google.com>

On branch fr-1051
Your branch is up to date with 'origin/fr-1051'.

Changes to be committed:
modified:   src/benchmark.cc
modified:   src/benchmark_adjust_repetitions.cc
modified:   src/benchmark_adjust_repetitions.h
modified:   src/benchmark_api_internal.cc
modified:   src/benchmark_api_internal.h
modified:   test/benchmark_random_interleaving_gtest.cc

* benchmar_indices --> size_t to make CI pass: fr-1051

Committer: Hai Huang <haih@google.com>

On branch fr-1051
Your branch is up to date with 'origin/fr-1051'.

Changes to be committed:
modified:   src/benchmark.cc

* Fix min_time not initialized issue for fr-1051.

Committer: Hai Huang <haih@google.com>

On branch fr-1051
Your branch is up to date with 'origin/fr-1051'.

Changes to be committed:
modified:   src/benchmark_api_internal.cc
modified:   src/benchmark_api_internal.h

* min_time --> MinTime in fr-1051.

Committer: Hai Huang <haih@google.com>

On branch fr-1051
Your branch is up to date with 'origin/fr-1051'.

Changes to be committed:
modified:   src/benchmark_api_internal.cc
modified:   src/benchmark_api_internal.h
modified:   src/benchmark_runner.cc

* Add doc for random interleaving for fr-1051

Committer: Hai Huang <haih@google.com>

On branch fr-1051
Your branch is up to date with 'origin/fr-1051'.

Changes to be committed:
modified:   README.md
new file:   docs/random_interleaving.md

Co-authored-by: Dominic Hamon <dominichamon@users.noreply.github.com>
2021-05-20 17:09:16 +01:00
Dominic Hamon c983c3ecfb
remove appveyor and add libera.chat as IRC resource 2021-05-20 13:05:50 +01:00
Mircea Trofin e539e807da
[PFM] Extend perf counter support to multi-threaded cases. (#1153)
* Extend perf counter support to multi-threaded cases.

* Docs update

* const-ed Snapshot
2021-05-19 09:49:05 +01:00
Guillaume Chatelet 7d0d9061d8
Support -Wsuggest-override (#1059)
* Support -Wsuggest-override

google/benchmark is C++11 compatible but doesn't use the `override` keyword.
Projects using google/benchmark with enabled `-Wsuggest-override` and `-Werror` will fail to compile.

* Add -Wsuggest-override cxx flag

* Revert unrelated formatting

* Revert unrelated formatting, take 2

* Revert unrelated formatting, take 3

* Disable -Wsuggest-override when compiling tests, gtest does not handle it yet

Co-authored-by: Dominic Hamon <dominichamon@users.noreply.github.com>
2021-05-11 14:56:00 +03:00
Dominic Hamon 3b508fad1f
Refactor `BenchmarkInstance` (#1148)
* Refactor BenchmarkInstance (precursor to #1105)

* fix bazel (debug) build

* clang-format on header

* fix build error on g++-4.8
2021-05-10 17:12:09 +01:00
Dominic Hamon 1f47b6b64c
Remove travis configs that are covered by actions (#1145) 2021-05-10 13:43:08 +01:00
Dominic Hamon 0852c79f35
remove done TODOs 2021-05-07 14:24:00 +01:00
Dominic Hamon 551a21bad0
add g++-6 to ubuntu-14.04 (#1144)
* add g++-6 to ubuntu-14.04

* fix syntax

* fix yamllint errors for build-and-test

* fix 'add-apt-repository' command not found

* make 'run tests' explicit

* enable testing and run both release and debug

* oops
2021-05-07 14:23:05 +01:00
Michał Janiszewski 17948a78ee
Add MSVC ARM64 support to cmake (#1090) 2021-05-07 14:08:24 +01:00
Dominic Hamon a53b8853aa
Add ubuntu-14.04 build and test workflow (#1131)
* Add ubuntu-14.04 build and test workflow

* avoid '.' in job name

* no need for fail fast

* fix workflow syntax

* install some stuff

* better compiler installations

* update before install

* just say yes

* trying to match up some paths

* Difference between runner and github context in container?

* Try some judicious logging

* cmake 3.5+ required

* specific compiler versions

* need git for googletest

* Disable testing on old compilers

* disable testing properly
2021-05-07 12:39:04 +01:00
Roman Lebedev a2e8a8a9db
Clean -Wreserved-identifier instances (#1143) 2021-05-06 20:31:14 +01:00
Mircea Trofin e0826edea7
Fix StrSplit empty string case (#1142)
This also fixes #1135. Because StrSplit was returning a vector with an
empty string, it was treated by PerfCounters::Create as a legitimate ask
for setting up a counter with that name. The empty vector is understood
by PerfCounters as "just return NoCounters()".
2021-05-06 19:12:36 +01:00
Paweł Bylica e50b572e89
cmake: Add explicit BENCHMARK_ENABLE_LIBPFM option (#1141) 2021-05-06 13:48:48 +01:00
Dominic Hamon d0c227ccfd
Add API to benchmark allowing for custom context to be added (#1137)
* Add API to benchmark allowing for custom context to be added

Fixes #525

* add docs

* Add context flag output to JSON reporter

* Plumb everything into the global context.

* Add googletests for custom context

* update docs with duplicate key behaviour
2021-05-05 12:08:23 +01:00
Dominic Hamon 33c133a206
Add `benchmark_context` flag that allows per-run custom context. (#1127)
* Add `benchmark_context` flag that allows per-run custom context.

Add support for key-value flags in general.
Added test for key-value flags.
Added `benchmark_context` flag.
Output content of `benchmark_context` to base reporter.

Solves the first part of #525.

* Docs and better help
2021-05-04 14:36:11 +01:00
Dominic Hamon ba9a763def
Add multiple compiler support to build-and-test workflow (#1128)
* Add 32-bit build support to build-and-test

* attempt different yaml multiline string format

* syntax fixes to yaml

* switch to getting alternative compilers working

* remove done TODO

* trying to separate out windows

* oops, typo.

* add TODOs for missing builds wrt travis
2021-04-30 14:22:15 +01:00
Dominic Hamon 64cb55e910
enable markdown rendering on github pages 2021-04-28 16:44:33 +01:00
Mircea Trofin 376ebc2635
Support optional, user-directed collection of performance counters (#1114)
* Support optional, user-directed collection of performance counters

The patch allows an engineer wishing to drill into the root causes
of a regression, for example. Currently, only single threaded runs
are supported. The feature is a build-time opt in, and then a runtime
opt in.

The engineer may run the benchmark executable, passing a list of
performance counter names (using libpfm's naming scheme) at the
command line. The counter values will then be collected and reported
back as UserCounters.

This is different from #240 in that it is a benchmark user opt-in, and
the counter collection is transparent to the benchmark.

Currently, this is only supported on platforms where libpfm is
supported.

libpfm: http://perfmon2.sourceforge.net/

* 'Use' values param in Snapshot when BENCHMARK_OS_WINDOWS

This is to avoid unused parameter warning-as-error

* Added missing include for <vector> in perf_counters.cc

* Moved doc to docs

* Added license blurbs
2021-04-28 09:25:29 +01:00
Dominic Hamon 835951aa44 Be compliant and return 0 from main.
Fixes #713
2021-04-27 16:54:53 +01:00
Dominic Hamon 264976def3
Fix windows warning on type conversion (#1121) 2021-04-27 08:24:27 +01:00
Dominic Hamon 86da5ec294
Add verbosity to CI logs (#1122) 2021-04-26 18:26:33 +01:00
Kai Germaschewski d882be1ea9
fix cmake issue with referencing a non-existing function argument (#1118)
according to https://cmake.org/cmake/help/latest/command/function.html,
"Referencing to ARGV# arguments beyond ARGC have undefined behavior.",
which I hit with cmake 3.19.7.

This uses ARGC to check whether ARGV1 has been passed before referencing
it.
2021-04-26 09:15:07 +01:00
Roman Lebedev 058fb588b6
[tools] Fix dumb mistake in previous commit - print aggregates only means aggregates, not non-aggregates 2021-04-24 13:43:22 +03:00
Roman Lebedev 362c2ab9c6
[tools] Don't forget to print UTest when printing aggregates only
This probably regressed in #1042.
2021-04-24 13:37:13 +03:00
Roman Lebedev c05843a9f6
[sysinfo] Fix CPU Frequency reading on AMD Ryzen CPU's (#1117)
Currently, i get:
```
Run on (32 X 7326.56 MHz CPU s)
CPU Caches:
  L1 Data 32 KiB (x16)
  L1 Instruction 32 KiB (x16)
  L2 Unified 512 KiB (x16)
  L3 Unified 32768 KiB (x2)
```
which seems mostly right, except that the frequency is rather bogus.
Yes, i guess the CPU could theoretically achieve that,
but i have 3.6GHz configured, and scaling disabled.
So we clearly read the wrong thing.

With this fix, i now get the expected
```
Run on (32 X 3598.53 MHz CPU s)
CPU Caches:
  L1 Data 32 KiB (x16)
  L1 Instruction 32 KiB (x16)
  L2 Unified 512 KiB (x16)
  L3 Unified 32768 KiB (x2)
```
2021-04-23 14:33:22 +03:00
Matt Armstrong 69054ae50e
Use fewer ramp up repetitions when KeepRunningBatch is used (#1113)
Use the benchmark's reported iteration count when estimating
iterations for the next repetition, rather than the requested
iteration count.  When the benchmark uses KeepRunningBatch the actual
iteration count can be larger than the one the runner requested.

Prior to this fix the runner was underestimating the next iteration
count, sometimes significantly so.  Consider the case of a benchmark
using a batch size of 1024.  Prior to this change, the benchmark
runner would attempt iteration counts 1, 10, 100 and 1000, yet the
benchmark itself would do the same amount of work each time: a single
batch of 1024 iterations.  The discrepancy could also contribute to
estimation errors once the benchmark time reached 10% of the target.
For example, if the very first batch of 1024 iterations reached 10% of
benchmark_min_min time, the runner would attempt to scale that to 100%
from a basis of one iteration rather than 1024.

This bug was particularly noticeable in benchmarks with large batch
sizes, especially when the benchmark also had slow set up or tear down
phases.

With this fix in place it is possible to use KeepRunningBatch to
achieve a kind of "minimum iteration count" feature by using a larger
fixed batch size.  For example, a benchmark may build a map of 500K
elements and test a "find" operation.  There is no point in running
"find" just 1, 10, 100, etc., times.  The benchmark can now pick a
batch size of something like 10K, and the runner will arrive at the
final max iteration count with in noticeably fewer repetitions.
2021-04-20 07:16:05 +01:00
Dominic Hamon 0882a74c8b
Add bazel status to README 2021-04-19 17:25:59 +01:00
Dominic Hamon 2dad9aef78
Re-enable bazel without bazelisk and with scoped build/test targets (#1109)
* See if bazel "just works" now (almost)

* Add cache and better bazel test command line

* Narrow focus of bazel build
2021-04-19 10:51:12 +01:00
Dominic Hamon 39b5a298a7
Improve BENCHMARK_UNUSED definition (#1111)
Take advantage of C++17's `[[maybe_unused]]` if it's available. Also clang supports `__attribute__((unused))` so add that too.
2021-04-12 12:46:05 +01:00
Chris Lalancette 07578d82e0
Shrink the tz_offset size to 41. (#1110)
When building with gcc TSan on, and in Debug mode, we see a warning
like:

benchmark/src/timers.cc: In function ‘std::string benchmark::LocalDateTimeString()’:
src/timers.cc:241:15: warning: ‘char* strncat(char*, const char*, size_t)’ output may be truncated copying 108 bytes from a string of length 127 [-Wstringop-truncation]
  241 |   std::strncat(storage, tz_offset, sizeof(storage) - timestamp_len - 1);
      |   ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

While this is essentially a false positive (we never expect
the number of bytes in tz_offset to be too large), the compiler can't
actually tell that.  Shrink the size of tz_offset to a smaller, but still safe
size to eliminate this warning.

Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
2021-04-09 17:32:00 +01:00
Dominic Hamon f1deaf16b8
fix minor typo (though this is an external property) 2021-04-09 13:00:43 +01:00
Dominic Hamon 5a77a6d8dc
fix minor typo 2021-04-09 13:00:06 +01:00
Dominic Hamon b8084e5054
fix minor typo 2021-04-09 12:59:31 +01:00
Tobias Schmidt 5e387e7d33
Implement custom benchmark name (#1107)
* Implement custom benchmark name

The benchmark's name can be changed using the Name() function
which internally uses SetName().

* Update AUTHORS and CONTRIBUTORS

* Describe new feature in README

* Move new name function up

Fixes #1106
2021-03-30 16:43:03 +03:00
Andre Meyering cc9abfc8f1
Fix URL to googletest primer (#1102) 2021-03-08 12:23:24 +03:00
Dominic Hamon 50c9eb5496
Removing conanfile (and support) per #1088 (#1099)
* Removing conanfile (and support) per #1088
2021-03-05 16:37:55 +00:00
Dominic Hamon 4c26070de0
disable bazel for now (#1101)
Unclear why this is failing so disabling for now. bazel build still works locally so this is a bazelisk/github workflow thing.
2021-03-05 15:04:18 +00:00
Phoenix Meadowlark 5c43112eb3
Update 'Output Files' section to reflect csv support. (#1095) 2021-02-22 09:55:59 +00:00
Phoenix Meadowlark a9b9471c02
Fix typo in invalid file name error message. (#1094) 2021-02-22 09:55:07 +00:00
SSE4 d90321ff7a
- add support for Elbrus 2000 (e2k) (#1091)
Signed-off-by: SSE4 <tomskside@gmail.com>
2021-02-14 17:45:57 +03:00
Michał Janiszewski ea5a5bbff4
Add MSVC ARM64 support for reading clocks (#1052)
Lacks CMake support, see https://github.com/google/benchmark/pull/1090
2021-02-12 13:30:26 +03:00
Yannic 8df87f6c87
Revert "Add bazel target for benchmark_release (#1078)" (#1081)
This reverts commit d8254bb9eb.
2021-01-05 09:54:04 +00:00
Dominic Hamon a6d08aea4b
Create workflow to exercise bazel build (#1079)
* Create workflow to exercise bazel build
2020-12-22 11:47:52 +00:00
Aidan Wolter d8254bb9eb
Add bazel target for benchmark_release (#1078)
Fixes google#1077

Bazel clients currently cannot build the benchmark library in Release
mode. This commit adds a new target ":benchmark_release" to enable this.
2020-12-22 09:54:33 +00:00
feserr 378ed8ff25
Add 'seconds' time unit (#1076)
Fixes #1075.

* Add an option to report in seconds.

* Reduce the time of the test.

* Add CSV/JSON tests for new time reports.
2020-12-21 20:15:58 +03:00
Dominic Hamon bf585a2789 Fix some bazel warnings about missing sha256 on http_archives 2020-11-26 11:14:03 +00:00
Scott K Logan 17a6b21ee1
Fix Range when starting at zero (#1073)
The existing behavior results in the `0` value being added twice. Since
`lo` is always added to `dst`, we never want to explicitly add `0` if
`lo` is equal to `0`.
2020-11-26 11:12:45 +00:00