Commit Graph

141 Commits

Author SHA1 Message Date
Dominic Hamon 201b981abd
refactor the documentation to minimise `README.md` (#1211) 2021-08-17 21:45:33 +01:00
Manuel Binna 38b767e58a
Bazel qnx (#1192)
* Don't link pthread on QNX

On QNX, pthread is part of libc [1]. There's no separate pthread library
to link.

[1] https://www.qnx.com/developers/docs/7.1/index.html#com.qnx.doc.neutrino.lib_ref/topic/p/pthread_create.html

* Explain that QNX doesn't have pthread lib
2021-06-28 13:46:08 +01:00
PCMan c932169e76
Provide helpers to create integer lists for the given ranges. (#1179)
This can be used together with ArgsProduct() to allow multiple ranges
with different multipliers and mixing dense and sparse ranges.

Example:
BENCHMARK(MyTest)->ArgsProduct({
  CreateRange(0, 1024, /*multi=*/32),
  CreateRange(0, 100, /*multi=*/4),
  CreateDenseRange(0, 4, /*step=*/1)
});

Co-authored-by: Jen-yee Hong <pcmantw@google.com>
2021-06-16 12:56:24 +01:00
Roman Lebedev fbc31405b2
Random interleaving of benchmark repetitions - the sequel (fixes #1051) (#1163)
Inspired by the original implementation by Hai Huang @haih-g
from https://github.com/google/benchmark/pull/1105.

The original implementation had design deficiencies that
weren't really addressable without redesign, so it was reverted.

In essence, the original implementation consisted of two separateable parts:
* reducing the amount time each repetition is run for, and symmetrically increasing repetition count
* running the repetitions in random order

While it worked fine for the usual case, it broke down when user would specify repetitions
(it would completely ignore that request), or specified per-repetition min time (while it would
still adjust the repetition count, it would not adjust the per-repetition time,
leading to much greater run times)

Here, like i was originally suggesting in the original review, i'm separating the features,
and only dealing with a single one - running repetitions in random order.

Now that the runs/repetitions are no longer in-order, the tooling may wish to sort the output,
and indeed `compare.py` has been updated to do that: #1168.
2021-06-03 21:16:54 +03:00
Dominic Hamon d17ea66551
Fix leak in test, and provide path to remove leak from library (#1169)
* Fix leak in test, and provide path to remove leak from library

* make doc change
2021-06-03 16:08:00 +01:00
Dominic Hamon e025dd5a54
Revert "Implementation of random interleaving. (#1105)" (#1161)
This reverts commit a6a738c1cc.
2021-06-01 16:05:50 +01:00
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
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
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
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 0882a74c8b
Add bazel status to README 2021-04-19 17:25:59 +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
Phoenix Meadowlark 5c43112eb3
Update 'Output Files' section to reflect csv support. (#1095) 2021-02-22 09:55:59 +00:00
Dominic Hamon 2d9bfe1ef8
Include github workflows status in README 2020-09-28 10:54:55 +01:00
Christian Wassermann 4857962394
Add CartesianProduct with associated test (#1029)
* Add CartesianProduct with associated test

* Use CartesianProduct in Ranges to avoid code duplication
* Add new cartesian_product_test to CMakeLists.txt
* Update AUTHORS & CONTRIBUTORS

* Rename CartesianProduct to ArgsProduct

* Rename test & fixture accordingly
* Add example for ArgsProduct to README
2020-08-25 13:47:44 +01:00
Dominic Hamon 5c25ad3acb
Ctest support (#1025)
* ctest is now working

* Update README

* remove commented out lines

* Tweaked docs

Added note to use parallel and cleaned build config notes

* Response to comments

* revert all but the readme

* make error message clearer

* drop --parallel
2020-08-21 16:25:56 +01:00
Adam Badura bb978c06d0
Update build instructions to better use CMake (#1017)
Build instructions needlessly referred to make when CMake offers
a command-line interface to abstract away from the specific build
system.

Furthermore, CMake offers command-line "tool mode" which performs basic
filesystem operations. While the syntax is a bit more verbose than
Linux commands it is platform-independent. Now the commands can be
copy-pasted on both Linux and Windows and will just work.

Finally, the Release build type is included in initial commands. A natural flow
for a new-comer is to read and execute the commands and only then learn
that one has to go back and redo them again this time with proper parameters.
Now instead the parameters are only explained later but present already in the
initial commands.
2020-08-19 11:57:19 +01:00
Paweł Bylica c078337494
Relax CHECK condition in benchmark_runner.cc (#938)
* Add State::error_occurred()

* Relax CHECK condition in benchmark_runner.cc

If the benchmark state contains an error, do not expect any iterations has been run.
This allows using SkipWithError() and return early from the benchmark function.

* README.md: document new possible usage of SkipWithError()
2020-02-21 17:53:25 +03:00
Nick 168604d8f8
[docs] Use `benchmark::IterationCount` rather than `int64_t` in lambda to complexity (#940) 2020-02-18 15:04:45 +03:00
Jordan Williams daff5fead3 Alias CMake Targets. Fixes #921 (#926)
* add Jordan Williams to both CONTRIBUTORS and AUTHORS

* alias benchmark libraries

Provide aliased CMake targets for the benchmark and benchmark_main targets.
The alias targets are namespaced under benchmark::, which is the namespace when they are exported.
I chose not to use either the PROJECT_NAME or the namespace variable but to hard-code the namespace.
This is because the benchmark and benchmark_main targets are hard-coded by name themselves.
Hard-coding the namespace is also much cleaner and easier to read.

* link to aliased benchmark targets

It is safer to link against namespaced targets because of how CMake interprets the double colon.
Typo's will be caught by CMake at configuration-time instead of during compile / link time.

* document the provided alias targets

* add "Usage with CMake" section in documentation

This section covers linking against the alias/import CMake targets and including them using either find_package or add_subdirectory.

* format the "Usage with CMake" README section

Added a newline after the "Usage with CMake" section header.
Dropped the header level of the section by one to make it a direct subsection of the "Usage" section.
Wrapped lines to be no longer than 80 characters in length.
2020-01-14 23:21:24 +03:00
Roman Lebedev 318d07113d
README.md: a few adjustments after #894 2019-12-01 13:42:52 +03:00
Martin Blanchard daf276ff94 Document environment variables options usage (#894)
See https://github.com/google/benchmark/issues/881
2019-12-01 13:40:10 +03:00
Chunsheng Pei b8bce0c7ed fixed the param order in g++ command and fixed the path for -L (#879)
* fixed the param order in g++ command and fixed the path for -L

* reorder the parameters for g++ command
2019-09-27 12:09:23 +01:00
Colin Braley e7e3d976ef Add missing parenthesis to code sample, and fix spacing. (#877)
* Fix missing paren in README code sample, and fix code spacing.

* Add Colin Braley to AUTHORS and CONTRIBUTORS.
2019-09-21 23:55:05 +03:00
sharpe5 bf4f2ea0bd Addresses issue #634. (#866)
* Update with instructions to build under Visual Studio

Fixes Issue #634.

I spent 3 days trying to build this library under Visual Studio 2017, only to discover on has to link to `Shlwapi.lib`.

Became so frustrated with the docs that I added full build instructions for Visual Studio 2015, 2017 and Intel Comiler 2015 and 2019.

* Update headings
2019-09-16 09:05:05 +01:00
Sayan Bhattacharjee ffadb65d3a Documentation of basic use of DenseRange. (#855)
Documentation of basic use of `DenseRange` was added to README.md.
2019-08-21 09:51:31 -07:00
Roman Lebedev 3523f11d36
Update README.md: fix MS VS version requirement
VS2013 is unsupported since https://github.com/google/benchmark/pull/691 / eb8cbec077
but i forgot to update docs.
References:
* https://github.com/google/benchmark/issues/689
* https://github.com/google/benchmark/pull/691
* https://github.com/google/googletest/pull/1815
* https://github.com/google/benchmark/issues/853
* https://github.com/google/benchmark/pull/854
2019-08-21 15:14:27 +03:00
Roman Lebedev 7d97a057e1
Custom user counters: add invert modifier. (#850)
While current counters can e.g. answer the question
"how many items is processed per second", it is impossible to get
it to tell "how many seconds it takes to process a single item".

The solution is to add a yet another modifier `kInvert`,
that is *always* considered last, which simply inverts the answer.

Fixes #781, #830, #848.
2019-08-12 17:47:46 +03:00
LesnyRumcajs 140fc22ab2 Corrected the installation procedure (#849)
* Corrected the installation procedure

Now it can be put into a script.

* Updated the file tree

Necessary after installation instruction change
2019-08-06 13:36:36 +03:00
Xinye Tao 140db8a229 fix typo in README (#844) 2019-07-30 09:03:15 +03:00
blackliner 66482d538d README.md: corrected cmake commands (#846)
* corrected cmake commands

* Update README.md
2019-07-29 23:59:25 +03:00
Boris Dergachov ff7e2d45a5 README.md: Spelling fix (#845) 2019-07-29 23:59:06 +03:00
Jason Cooke df4f9fe362 docs: fix typo (#837) 2019-07-17 10:01:07 +03:00
Dominic Hamon 13b8bdc2b5
Bump required cmake version from 2.x to 3.x (#801) 2019-05-01 09:06:12 +01:00
astee 05d8c1c5d0 Improve README (#804)
* Update and organize README

* Update AUTHORS and CONTRIBUTORS

Fixes #803.
2019-04-25 14:48:56 +03:00
Bryan Lunt 7a1c370283 Add process_time for better OpenMP and user-managed thread timing
* Google Benchmark now works with OpenMP and other user-managed threading.
2019-04-09 13:01:33 +01:00
Roman Lebedev b8ca0c4217
README.md: mention that fixture has SetUp() / TearDown() 2019-02-04 16:26:51 +03:00
Roman Lebedev 57bf879d49
README.md: document State::{Pause,Resume}Timing()
As pointed out in IRC, these are not documented.
2018-12-14 01:20:01 +03:00
Roman Lebedev 19f7d5c2bc
README.md: complexity lambda takes int64_t arg. Fixes #719 2018-11-29 01:23:25 +03:00
Roman Lebedev c9311a44e1
README.md: BM_Sequential(): the return type is 'void'
Used that example as a snippet, and it took a moment to notice
what needed to be changed to make it compile..
2018-11-26 15:39:36 +03:00
Roman Lebedev c614dfc0d4
*Display* aggregates only. (#665)
There is a flag 
d9cab612e4/src/benchmark.cc (L75-L78)
and a call
d9cab612e4/include/benchmark/benchmark.h (L837-L840)
But that affects everything, every reporter, destination:
d9cab612e4/src/benchmark.cc (L316)


It would be quite useful to have an ability to be more picky.


More specifically, i would like to be able to only see the aggregates in the on-screen output,
but for the file output to still contain everything. The former is useful in case of a lot of repetition
(or even more so if every iteration is reported separately), while the former is **great** for tooling.

Fixes https://github.com/google/benchmark/issues/664
2018-09-12 16:26:17 +03:00
Roman Lebedev caa2fcb19c
Counter(): add 'one thousand' param. (#657)
* Counter(): add 'one thousand' param.

Needed for https://github.com/google/benchmark/pull/654

Custom user counters are quite custom. It is not guaranteed
that the user *always* expects for these to have 1k == 1000.
If the counter represents bytes/memory/etc, 1k should be 1024.

Some bikeshedding points:
1. Is this sufficient, or do we really want to go full on
   into custom types with names?
   I think just the '1000' is sufficient for now.
2. Should there be a helper benchmark::Counter::Counter{1000,1024}()
   static 'constructor' functions, since these two, by far,
   will be the most used?
3. In the future, we should be somehow encoding this info into JSON.

* Counter(): use std::pair<> to represent 'one thousand'

* Counter(): just use a new enum with two values 1000 vs 1024.

Simpler is better. If someone comes up with a real reason
to need something more advanced, it can be added later on.

* Counter: just store the 1000 or 1024 in the One_K values directly

* Counter: s/One_K/OneK/
2018-08-29 21:11:06 +03:00
Roman Lebedev 94c4d6d5c6 [Tools] Drop compare_bench.py, compare.py is to be used, add U-test docs. (#645)
As discussed in IRC, time to deduplicate.
2018-08-13 07:42:35 -07:00
Dominic Hamon d939634b8c
README improvements (#648)
* Clarifications and cleaning of the core documentation.
2018-07-26 14:29:33 +01:00
Yoshinari Takaoka 847c006902 fixed Google Test (Primer) Documentation link (#628) 2018-06-28 10:25:54 +01:00
Dominic Hamon ec0f69c28e
Update README.md 2018-05-29 10:36:54 +01:00