Commit Graph

1266 Commits

Author SHA1 Message Date
Vy Nguyen 4b99670c57
Fixed typo in doc: s/marcro/macro (#1274)
* Fixed typo s/marcro/macro

* undo stray NL

* abc
2021-11-08 10:04:03 +00:00
Bensuperpc 329fb06d99
Fix error with Fix Werror=old-style-cast (#1272)
* Fix Werror=old-style-cast

Signed-off-by: Bensuperpc <bensuperpc@gmail.com>

* Fix Werror=old-style-cast

Signed-off-by: Bensuperpc <bensuperpc@gmail.com>

* Fix Werror=old-style-cast

Signed-off-by: Bensuperpc <bensuperpc@gmail.com>

* Fix typo

Signed-off-by: Bensuperpc <bensuperpc@gmail.com>

* Fix build error with MacOS

Signed-off-by: Bensuperpc <bensuperpc@gmail.com>

* Revert "Fix build error with MacOS"

This reverts commit cee213bb95.
2021-11-04 12:09:10 +00:00
Bensuperpc 8826ef792f
Fix error Wshorten-64-to-32 (#1273)
Signed-off-by: Bensuperpc <bensuperpc@gmail.com>
2021-11-04 10:26:11 +00:00
Vy Nguyen 8aae0a4f67
[cleanup] Change `== ""` to `.empty()` on string to avoid clang-tidy warnings (#1271) 2021-11-03 14:54:07 +00:00
Vy Nguyen 4f31803ebb
Fix un-initted error in test and fix change the API previously proposed to use std::string instead of raw char* (#1266)
* Fix un-initted error in test.

Found by -Werror,-Wsometimes-uninitialized

* Update spec_arg_test.cc

* additional change:
- Change the API on GetBenchmarkFilter and the `spec` to std::string because google C++ styleguide internally kind of discouraged  using raw const char*
2021-10-29 11:48:56 +01:00
Dominic Hamon da01c5e662
use docker container for ubuntu-16.04 builds (#1265)
* use docker container for ubuntu-16.04 builds

* install some bits

* no sudo in docker container

* cmake, not cmake3

* include perfcounters

* still no sudo in docker containers

* yes please, apt
2021-10-27 16:29:37 +01:00
Vy Nguyen 4f47ed2c9a
[RFC] Adding API for setting/getting benchmark_filter flag? (#1254)
* [RFC] Adding API for setting/getting benchmark_filter flag?

This PR is more of a Request-for-comment - open to other ideas/suggestions as well.

Details:
This flag has different implementations(absl vs benchmark) and since the proposal to add absl as a dependency was rejected, it would be nice to have a reliable (and less hacky) way to access this flag internally.
(Actually, reading it isn't much a problem but setting it is).

Internally, we have a sizeable number users to use absl::SetFlags to set this flag. This will not work with benchmark-flags.

Another motivation is that not all users use the command line flag. Some prefer to programmatically set this value.

* fixed build errors

* fix lints again

* per discussion: add additional RunSpecifiedBenchmarks instead.

* add tests

* fix up tests

* clarify comment

* fix stray : in test

* more assertion in test

* add test file to test/CMakeLists.txt

* more test

* make test ISO C++ compliant

* fix up BUILD file to pass the flag
2021-10-27 08:52:57 +01:00
Vy Nguyen fca348296f
Allow template arguments to be specified directly on the BENCHMARK macro (#1262)
* Allow template arguments to be specifed directly on the BENCHMARK macro/

Use cases:
 - more convenient (than having to use a separate BENCHMARK_TEMPLATE)
 - feature parity with our internal library.

* fix tests

* updated docs
2021-10-26 15:38:12 +01:00
Vitaly Zaitsev 365670e432
Added Doxygen support. (#1228)
Signed-off-by: Vitaly Zaitsev <vitaly@easycoding.org>
2021-10-25 12:32:33 +01:00
Byoungchan Lee 80d70ddd94
Fix -Wdeprecated-declarations warning once more. (#1256)
In #1238, one of MemoryManager's Stop methods was marked as deprecated
and this method is used in the same header. This change generated
-Wdeprecated-declarations warning on every file that includes
"benchmark.h". Use gcc's diagnostics to fix this warning.
2021-10-21 10:10:38 +01:00
Roman Lebedev 1e3ab7fa43
Merge remote-tracking branch 'upstream/pr/1240'
* upstream/pr/1240:
  cmake: allow to use package config from build directory
2021-10-19 12:23:32 +03:00
Sergiu Deitsch 1be88c0683 cmake: allow to use package config from build directory 2021-10-19 11:11:11 +02:00
Roman Lebedev 3395949553
Merge remote-tracking branch 'upstream/pr/1244'
* upstream/pr/1244:
  cmake: make package config relocatable
2021-10-19 12:06:05 +03:00
Sergiu Deitsch eb9100bf41 cmake: make package config relocatable 2021-10-19 11:05:29 +02:00
Roman Lebedev 2f30903ca2
GoogleTest.cmake.in: mention BENCHMARK_USE_BUNDLED_GTEST 2021-10-19 11:32:26 +03:00
Roman Lebedev 8c8052aa7b
GoogleTest.cmake.in: immediately error-out after failure message, Closes #1255
Results in a bit nicer output when googletest was not found.
2021-10-19 11:31:32 +03:00
Vy Nguyen 7fad964a94
Introduce additional memory metrics (#1238)
- added total_allocs and net_allocs
  - updated reporter code to report these, if available.
2021-10-18 16:29:35 +01:00
Byoungchan Lee f730846b0a
Fix -Wdeprecated-declarations warning triggered by clang-cl. (#1245)
WebRTC uses Google Benchmarks as a dependency and uses Chromium's build
infrastructure. Chromium is compiled using clang-cl on Windows, and the
-Wdeprecated-declarations warning is triggered. Because clang-cl accepts
gcc's diagnostic prama and defines the __clang__ macro,
using it can solve this issue.

Bug: webrtc:13280
2021-10-18 11:31:51 +01:00
PhilipDeegan 285e5e9771
Cmake: options for controlling werror, disable werror for PGI compilers (#1246) 2021-10-18 09:41:25 +01:00
Sergiu Deitsch 59bbc7fd9d
cmake: eliminate redundant `target_include_directories` (#1242) 2021-10-17 15:07:19 +03:00
Dominic Hamon 0baacde361
Update policy to match reality 2021-09-20 10:19:51 +01:00
Vy Nguyen 713b917718
Fix mention of --benchmarks in comment (#1229)
This flag doesn't exist ever in OSS benchmark.
2021-09-13 21:00:14 +01:00
Vitaly Zaitsev 400ed3f57a
Added support of packaged GTest for running unit tests. (#1226)
Signed-off-by: Vitaly Zaitsev <vitaly@easycoding.org>
2021-09-12 18:57:57 +03:00
Vitaly Zaitsev 1bd8098d3d
Optimized docs installation (#1225)
* Use GNUInstallDirs to install docs.

Signed-off-by: Vitaly Zaitsev <vitaly@easycoding.org>

* Added an option to disable docs installation.

Signed-off-by: Vitaly Zaitsev <vitaly@easycoding.org>
2021-09-08 18:40:25 +01:00
Dominic Hamon c23a001252
Remove unused parameter from lambda. (#1223)
Fixes #1222
2021-09-07 17:54:23 +01:00
Dominic Hamon 92f50a22eb add to final releasing step 2021-09-07 12:24:12 +01:00
Dominic Hamon f91b6b42b1 bump version to 1.6 in preparation for release 2021-09-07 12:18:34 +01:00
Roman Lebedev 4f8070590c
COnsole reporter: if statistic produces percents, format it as such (#1221) 2021-09-06 11:33:27 +03:00
Roman Lebedev 45b194e4d4
Introduce Coefficient of variation aggregate (#1220)
* Introduce Coefficient of variation aggregate

I believe, it is much more useful / use to understand,
because it is already normalized by the mean,
so it is not affected by the duration of the benchmark,
unlike the standard deviation.

Example of real-world output:
```
raw.pixls.us-unique/GoPro/HERO6 Black$ ~/rawspeed/build-old/src/utilities/rsbench/rsbench GOPR9172.GPR --benchmark_repetitions=27 --benchmark_display_aggregates_only=true --benchmark_counters_tabular=true
2021-09-03T18:05:56+03:00
Running /home/lebedevri/rawspeed/build-old/src/utilities/rsbench/rsbench
Run on (32 X 3596.16 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)
Load Average: 7.00, 2.99, 1.85
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Benchmark                                                      Time             CPU   Iterations  CPUTime,s CPUTime/WallTime     Pixels Pixels/CPUTime Pixels/WallTime Raws/CPUTime Raws/WallTime WallTime,s
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
GOPR9172.GPR/threads:32/process_time/real_time_mean         11.1 ms          353 ms           27   0.353122          31.9473        12M       33.9879M        1085.84M      2.83232       90.4864  0.0110535
GOPR9172.GPR/threads:32/process_time/real_time_median       11.0 ms          352 ms           27   0.351696          31.9599        12M       34.1203M        1090.11M      2.84336       90.8425  0.0110081
GOPR9172.GPR/threads:32/process_time/real_time_stddev      0.159 ms         4.60 ms           27   4.59539m        0.0462064          0       426.371k        14.9631M    0.0355309       1.24692   158.944u
GOPR9172.GPR/threads:32/process_time/real_time_cv           1.44 %          1.30 %            27  0.0130136         1.44633m          0      0.0125448       0.0137802    0.0125448     0.0137802  0.0143795
```

Fixes https://github.com/google/benchmark/issues/1146

* Be consistent, it's CV, not 'rel std dev'
2021-09-03 18:44:10 +01:00
Roman Lebedev 12dc5eeafc
Statistics: add support for percentage unit in addition to time (#1219)
* Statistics: add support for percentage unit in addition to time

I think, `stddev` statistic is useful, but confusing.

What does it mean if `stddev` of `1ms` is reported?
Is that good or bad? If the `median` is `1s`,
then that means that the measurements are pretty noise-less.

And what about `stddev` of `100ms` is reported?
If the `median` is `1s` - awful, if the `median` is `10s` - good.

And hurray, there is just the statistic that we need:
https://en.wikipedia.org/wiki/Coefficient_of_variation

But, naturally, that produces a value in percents,
but the statistics are currently hardcoded to produce time.

So this refactors thinkgs a bit, and allows a percentage unit for statistics.

I'm not sure whether or not `benchmark` would be okay
with adding this `RSD` statistic by default,
but regales, that is a separate patch.

Refs. https://github.com/google/benchmark/issues/1146

* Address review notes
2021-09-03 15:36:56 +01:00
Roman Lebedev 67b77da3c0
report.py: adjust expected u-test values for tests
The test used to work with scipy 1.6, but does not work with 1.7.1
I believe this is because of https://github.com/scipy/scipy/pull/4933
Since there doesn't appear that there is anything wrong with how
we call the `mannwhitneyu()`, i guess we should just expect the new values.

Notably, the tests now fail with earlier scipy versions.
2021-09-03 14:54:06 +03:00
Roman Lebedev e7a8415876
CMake: add forgotten include(FeatureSummary) into FindPFM.cmake to fix build
Sorry!
2021-09-03 01:15:09 +03:00
Dominic Hamon 2b093325e1
replace #warning with #pragma message (#1216) 2021-08-24 15:08:15 +01:00
Dominic Hamon 04c466603f
force cmake version to 3.5.1 2021-08-24 14:30:36 +01:00
Roman Lebedev e7fa637cbe
[NFC] PFM: actually report package as found, and advertise description
This slightly prettifies the CMake's `feature_summary()` output,
should the library be built as part of some project that then prints
the CMake summary.
2021-08-23 19:36:34 +03:00
Marcel Jacobse 0a447f8a75
Fix links to further doc in user_guide.md (#1215)
Refactoring in 201b981a moved most of the documentation from `README.md` to `docs/user_guide.md`. Some links from `README.md` to other `docs/*.md` files ended up unchanged in `docs/user_guide.md`. Those links were now broken as they did not link from outside the `docs` directory anymore, but from inside it. Removing the leading `docs/` for these links fixes this.
2021-08-23 14:16:03 +01:00
Vy Nguyen dc1a97174d
Introduce accessors for currently public data members (threads and thread_index) (#1208)
* [benchmark] Introduce accessors for currently public data members `threads` and `thread_index`

Also deprecate the direct access to these fields.

Motivations:

Our internal library provides accessors for those fields because the styleguide disalows accessing classes' data members directly (even if they're const).
There has been a discussion to simply move internal library to make its fields public similarly to the OSS version here, however, the concern is that these kinds of direct access would prevent many types of future design changes (eg how/whether the values would be stored in the data member)

I think the concensus in the end is that we'd change the external library for this case.
AFAIK, there are three important third_party users that we'd need to migrate: tcmalloc, abseil and tensorflow.
Please let me know if I'm missing anyone else.

* [benchmark] Introduce accessors for currently public data members `threads` and `thread_index`

Also deprecate the direct access to these fields.

Motivations:

Our internal library provides accessors for those fields because the styleguide disalows accessing classes' data members directly (even if they're const).
There has been a discussion to simply move internal library to make its fields public similarly to the OSS version here, however, the concern is that these kinds of direct access would prevent many types of future design changes (eg how/whether the values would be stored in the data member)

I think the concensus in the end is that we'd change the external library for this case.
AFAIK, there are three important third_party users that we'd need to migrate: tcmalloc, abseil and tensorflow.
Please let me know if I'm missing anyone else.

* [benchmark] Introduce accessors for currently public data members `threads` and `thread_index`

Also deprecate direct access to `.thread_index` and make threads a private field

Motivations:

Our internal library provides accessors for those fields because the styleguide disalows accessing classes' data members directly (even if they're const).
There has been a discussion to simply move internal library to make its fields public similarly to the OSS version here, however, the concern is that these kinds of direct access would prevent many types of future design changes (eg how/whether the values would be stored in the data member)

I think the concensus in the end is that we'd change the external library for this case.
AFAIK, there are three important third_party users that we'd need to migrate: tcmalloc, abseil and tensorflow.
Please let me know if I'm missing anyone else.

* [benchmark] Introduce accessors for currently public data members `threads` and `thread_index`

Also deprecate direct access to `.thread_index` and make threads a private field

Motivations:

Our internal library provides accessors for those fields because the styleguide disalows accessing classes' data members directly (even if they're const).
There has been a discussion to simply move internal library to make its fields public similarly to the OSS version here, however, the concern is that these kinds of direct access would prevent many types of future design changes (eg how/whether the values would be stored in the data member)

I think the concensus in the end is that we'd change the external library for this case.
AFAIK, there are three important third_party users that we'd need to migrate: tcmalloc, abseil and tensorflow.
Please let me know if I'm missing anyone else.

* [benchmark] Introduce accessors for currently public data members `threads` and `thread_index`

Also deprecate direct access to `.thread_index` and make threads a private field

Motivations:

Our internal library provides accessors for those fields because the styleguide disalows accessing classes' data members directly (even if they're const).
There has been a discussion to simply move internal library to make its fields public similarly to the OSS version here, however, the concern is that these kinds of direct access would prevent many types of future design changes (eg how/whether the values would be stored in the data member)

I think the concensus in the end is that we'd change the external library for this case.
AFAIK, there are three important third_party users that we'd need to migrate: tcmalloc, abseil and tensorflow.
Please let me know if I'm missing anyone else.

* [benchmark] Introduce accessors for currently public data members `threads` and `thread_index`

Also deprecate direct access to `.thread_index` and make threads a private field

Motivations:

Our internal library provides accessors for those fields because the styleguide disalows accessing classes' data members directly (even if they're const).
There has been a discussion to simply move internal library to make its fields public similarly to the OSS version here, however, the concern is that these kinds of direct access would prevent many types of future design changes (eg how/whether the values would be stored in the data member)

I think the concensus in the end is that we'd change the external library for this case.
AFAIK, there are three important third_party users that we'd need to migrate: tcmalloc, abseil and tensorflow.
Please let me know if I'm missing anyone else.

* [benchmark] Introduce accessors for currently public data members `threads` and `thread_index`

Also deprecate direct access to `.thread_index` and make threads a private field

Motivations:

Our internal library provides accessors for those fields because the styleguide disalows accessing classes' data members directly (even if they're const).
There has been a discussion to simply move internal library to make its fields public similarly to the OSS version here, however, the concern is that these kinds of direct access would prevent many types of future design changes (eg how/whether the values would be stored in the data member)

I think the concensus in the end is that we'd change the external library for this case.
AFAIK, there are three important third_party users that we'd need to migrate: tcmalloc, abseil and tensorflow.
Please let me know if I'm missing anyone else.

* [benchmark] Introduce accessors for currently public data members `threads` and `thread_index`

Also deprecate direct access to `.thread_index` and make threads a private field

Motivations:

Our internal library provides accessors for those fields because the styleguide disalows accessing classes' data members directly (even if they're const).
There has been a discussion to simply move internal library to make its fields public similarly to the OSS version here, however, the concern is that these kinds of direct access would prevent many types of future design changes (eg how/whether the values would be stored in the data member)

I think the concensus in the end is that we'd change the external library for this case.
AFAIK, there are three important third_party users that we'd need to migrate: tcmalloc, abseil and tensorflow.
Please let me know if I'm missing anyone else.

* [benchmark] Introduce accessors for currently public data members `threads` and `thread_index`

Also deprecate direct access to `.thread_index` and make threads a private field

Motivations:

Our internal library provides accessors for those fields because the styleguide disalows accessing classes' data members directly (even if they're const).
There has been a discussion to simply move internal library to make its fields public similarly to the OSS version here, however, the concern is that these kinds of direct access would prevent many types of future design changes (eg how/whether the values would be stored in the data member)

I think the concensus in the end is that we'd change the external library for this case.
AFAIK, there are three important third_party users that we'd need to migrate: tcmalloc, abseil and tensorflow.
Please let me know if I'm missing anyone else.

* [benchmark] Introduce accessors for currently public data members `threads` and `thread_index`

Also deprecate direct access to `.thread_index` and make threads a private field

Motivations:

Our internal library provides accessors for those fields because the styleguide disalows accessing classes' data members directly (even if they're const).
There has been a discussion to simply move internal library to make its fields public similarly to the OSS version here, however, the concern is that these kinds of direct access would prevent many types of future design changes (eg how/whether the values would be stored in the data member)

I think the concensus in the end is that we'd change the external library for this case.
AFAIK, there are three important third_party users that we'd need to migrate: tcmalloc, abseil and tensorflow.
Please let me know if I'm missing anyone else.
2021-08-23 09:06:57 +01:00
Nico Weber 8fd49d6671
Fix a -Wunreachable-code-aggressive warning (#1214) 2021-08-19 16:09:49 +03:00
Dominic Hamon c4b06e5b79 Set theme jekyll-theme-minimal 2021-08-18 10:07:38 +01:00
Dominic Hamon 0fb4b75182
wrap things that look like tags but aren't with `{% raw %}` 2021-08-18 09:26:29 +01:00
Dominic Hamon 990299fff8
install docs folder when installing library (#1212)
fixes #470
2021-08-17 22:16:40 +01:00
Dominic Hamon 91ce110bbf
add .DS_Store to .gitignore 2021-08-17 21:46:11 +01:00
Dominic Hamon 201b981abd
refactor the documentation to minimise `README.md` (#1211) 2021-08-17 21:45:33 +01:00
Dominic Hamon 2d054b683f Merge branch 'main' of github.com:google/benchmark 2021-08-11 15:26:35 +01:00
Dominic Hamon ddc76e513e preparing v1.5.6 release 2021-08-11 15:22:36 +01:00
Dominic Hamon cb9afbbac4 Set theme jekyll-theme-modernist 2021-08-11 15:12:32 +01:00
Dominic Hamon 07f833d6b2 so much for googletest not failing any more 2021-08-11 15:10:02 +01:00
Dominic Hamon d0db4e01c1 turn back on strict mode for googletest as it no longer breaks 2021-08-11 15:01:17 +01:00
Vy Nguyen 4124223bf5
Change the default value of `--benchmark_filter` from "." to <empty> (#1207)
Both `.` and `<empty>` already means "run all benchmarks" here, as commented on this flag's declaration (and below around line 448-449).
So this is a NFC.

On the other hand, this help internally because internally, if the flag is empty (or if it's not a specified by a binary), we don't call the RunSpecifiedBenchmarks.
There is still a difference in what <empty> means internally (runs no benchmarks) and externally (runs all benchmarks).
But we can work around this.
2021-08-03 17:11:47 +01:00
Braedy 1067dfc91e
Remove dead code from PredictNumItersNeeded (#1206)
* Remove `min` with dead path.

When `isSignificant` is false, the smallest value `multiplier` can
approach is 14. Thus, min(10, multiplier) will always return 10.

Addresses part one of #1205.

* Remove always false condition.

   1. `multiplier <= 1.0` implies `i.seconds >= min_time * 1.4`
   2. By (1), `isSignficant` is true because `i.seconds > min_time * 1.4` implies `i.seconds > min_time` implies that `i.seconds / minTime > 1 > 0.1`. Thus, the ternary maintains the same multiplier value.
   3. `ShouldReportResults` is always called before `PredictNumItersNeeded`, if `i.seconds >= min_time` then the loop is broken and `PredictNumItersNeeded` is never called.
   4. 1 and 3 together imply that `multiplier <= 1.0` is never true.

Addresses part 2 of #1205.
2021-07-29 08:59:46 +01:00