Commit Graph

1110 Commits

Author SHA1 Message Date
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
Dominic Hamon 5b72b6c2da
Remove "BENCHMARK_" prefix from env var version of command line flags (#997)
As noted in #995, this causes issues when the command line flag already
starts with "benchmark_", which they all do.

Not caught by tests as the test flags didn't start with "benchmark".

Fixes #995
2020-08-18 10:02:20 +01:00
Dominic Hamon 4986d0b2ea
Create build-and-test.yml (#1013)
First attempt at a non-travis/non appveyor CI solution
2020-08-18 08:53:21 +01:00
Dominic Hamon 1302d2ce09
Add missing breaks for QNX cache counting (#1012) 2020-07-30 09:51:48 +01:00
Alexander Enaldiev 9901011880
JSONReporter: don't report on scaling if we didn't get it (#1005) (#1008)
* JSONReporter: don't report on scaling if we didn't get it (#1005)

* JSONReporter: fix due to review (std::pair<bool, bool> -> enum)

* JSONReporter: scaling: fix the algo (due to review discussion)

* benchmark.h: revert to old-fashioned enum's (C++03 compatibility); rreporter_output_test: let's skip scaling
2020-07-28 12:46:07 +01:00
Chris Jones 37177a84b7
Fix python extension import (#1000) 2020-07-09 12:54:41 +01:00
Chris Jones 39c8d58a76
Rename python bindings package to `google_benchmark`. (#999)
A few people have complained that `benchmark` is too generic. Also, add
Python 3.8.
2020-07-09 09:23:06 +01:00
Skye Wanderman-Milne 7f27afe83b
Expose methods for custom main functions in Python. (#993) 2020-06-30 09:51:30 +01:00
Jonas Otto 8f5e6ae091
Add requirements.txt for python dependencies (#994)
* add requirements.txt for python tools

* adds documentation for requirements.txt

Adds installation instructions for python dependencies using pip and requirements.txt
2020-06-29 13:22:03 +01:00
Jonas Otto 39b6e703f8
adds a "--no-color" flag to the compare.py script (#990) 2020-06-25 13:46:13 +03:00
Reid Paape 15e6dfd718
timers: silence strncat truncation warning (#984) 2020-06-17 14:58:12 +03:00
Dominic Hamon 76efbcdd1b
Merge pull request #980 from brianwolfe/wolfe-fix-overflow-warning
timers: silence format overflow warning
2020-06-16 07:11:50 +01:00
Brian Wolfe 7cc06ef80c timers: just make the buffers big enough 2020-06-15 16:16:19 -07:00
Brian Wolfe f25ea40ae1 timers: use snprintf instead of sprintf 2020-06-15 14:16:20 -07:00
Brian Wolfe f6ac240cd2 timers: silence format overflow warning 2020-06-15 14:02:15 -07:00
Brian Wolfe 99c52f1414
use rfc3339-formatted timestamps in output [output format change] (#965)
* timestamp: use rfc3339-formatted timestamps in output

Replace localized timestamps with machine-readable IETF RFC 3339 format
timestamps. This is an attempt to make the output timestamps easily
machine-readable. ISO8601 specifies standards for time interchange
formats. IETF RFC 3339: https://tools.ietf.org/html/rfc3339 defines a
subset of these for use in the internet. The general form for these
timestamps is:

YYYY-MM-DDTHH:mm:SS[+-]hhmm

This replaces the localized time formats that are currently being used
in the benchmark output to prioritize interchangeability and
machine-readability.

This might break existing programs that rely on the particular date-time
format. This might also may make times less human readable. RFC3339 was
intended to balance human readability and simplicity for machine
readability, but it is primarily intended as an internal representation.

* timers: remove utc string formatting

We only ever need local time printing. Remove the UTC printing
and cosnolidate the logic slightly.

* timers: manually create rfc3339 string

The C++ standard library does not output the time offset in RFC3339
format, it is missing the : between hours and minutes. VS does not
appear to support timezone information by default. To avoid adding too
much complexity to benchmark around timezone handling e.g. a full
date library like https://github.com/HowardHinnant/date, we fall back
to outputting GMT time with a -00:00 offset for those cases.

* timers: use reentrant form for localtime_r & tmtime_r

For non-windows, use the reentrant form for the time conversion
functions.

* timers: cleanup

Use strtol instead of brittle moving characters around.

* timers: only call strftime twice.

Also size buffers to known maximum necessary size and name constants
more appropriately.

* timers: fix unused variable warning
2020-06-15 17:28:17 +01:00
Dominic Hamon 8039b40307
Upgrade bazel from 0.10.1 to 3.2.0 (#976) 2020-06-09 09:50:20 +01:00
Dominic Hamon 4ecb5f31e8 Merge branch 'master' of github.com:google/benchmark 2020-06-08 17:35:36 +01:00
Chris Jones 22e55e18eb
Add some simple docs for installing the Python bindings from source. (#975) 2020-06-08 17:29:43 +01:00
Dominic Hamon 74b4612c73 Add absl dependency as needed 2020-06-08 15:21:52 +01:00
Dominic Hamon b63da7b84e Ignore python bindings build artifacts 2020-06-08 15:20:36 +01:00
Dominic Hamon 4e88f582a9 move releasing doc to docs 2020-06-05 09:40:34 +01:00
Chris Jones 6746c65bcf
Expose `SkipWithError` in Python bindings. (#968) 2020-05-28 09:33:06 +01:00
Christian Clauss 9284e90f28
Drop unused mingw.py (#966)
* Use ==/!= to compare constant literals (str, bytes, int, float, tuple)

Avoid Syntax Warning on Python 3.8: `3 is 3`  # —> Syntax Warning

* Delete mingw.py
2020-05-27 00:20:07 +03:00
Chris Jones d3ad0b9d11
Add Python bindings. (#957)
* Add Python bindings.

* Add license headers.

* Change example to a test.

* Add example usage to module docstring.
2020-05-06 17:28:29 +01:00
Kai Wolf 56898e9a92
Add missing <cerrno> header include - fixes Android build (#960)
* Add missing <cerrno> header

This commit fixes a current build error on Android where 'errno' is an unidentified
symbol due to a missing header

* Update string_util.cc

Conditionally adds <cerrno> if BENCHMARK_STL_ANDROID_GNUSTL is defined
2020-04-23 14:19:19 +03:00
Luís Marques ecc1685340
Fix formatting issues introduced by a77d5f7 (#959) 2020-04-17 19:31:49 +03:00
Keith Moyer 8cead00783
Remove warnings for internal use of CSVReporter (#956)
In a previous commit[1], diagnostic pragmas were used to avoid this
warning. However, the incorrect warning flag was indicated, leaving the
warning in place. -Wdeprecated is for deprecated features while
-Wdeprecated-declarations for deprecated functions, variables, and
types[2].

[1] c408461983
[2] https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
2020-04-14 10:20:22 +01:00
Luís Marques a77d5f70ef
Fix cycleclock::Now for RISC-V and PPC (#955)
Fixes the following issues with the implementation of `cycleclock::Now`:

- The RISC-V implementation wouldn't compile due to a typo;

- Both the PPC and RISC-V implementation's asm statements lacked the
  volatile keyword. This resulted in the repeated read of the counter's
  high part being optimized away, so overflow wasn't handled at all.
  Multiple counter reads could also be misoptimized, especially in LTO
  scenarios.

- Relied on the zero/sign-extension of inline asm operands, which isn't
  guaranteed to occur and differs between compilers, namely GCC and Clang.

The PowerPC64 implementation was improved to do a single 64-bit read of
the time-base counter.

The RISC-V implementation was improved to do the overflow handing in
assembly, since Clang would generate a branch, defeating the purpose
of the non-branching counter reading approach.
2020-04-10 17:02:13 +01:00
Dominic Hamon 0ab2c2906b
Fix type conversion warnings. (#951)
* Fix type conversion warnings.

Fixes #949

Tested locally (Linux/clang), but warnings are on MSVC so may differ.

* Drop the ULP so the double test passes
2020-04-06 13:52:09 +01:00
Konstantin Khlebnikov b23d35573b
Fix Travis-ci builds (#950)
Line "- /usr/local/bin:$PATH" is misformatted.
It must be something like "- PATH=/usr/local/bin:$PATH".

It seems something changed in tarvis-ci month ago and now this leads to:

Setting environment variables from .travis.yml
$ export PATH=

Defailt PATH is /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
so already containts /usr/local/bin.


Image "xcode8.3" contains macOS 10.12 (sierra) which has no bottles
with precompiled gcc-7 in homebrew storage.

Image "xcode9.4" is a current default with macOS 10.13 (high_sierra).

Link: https://docs.travis-ci.com/user/reference/osx/
Link: https://formulae.brew.sh/formula/gcc@7

Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
2020-03-30 09:22:37 +03:00
Roman Lebedev e30cac6b06
Revert "Add d postfix to Debug libraries (#923)" (#947)
This reverts commit 5ce2429af7.

Reverts https://github.com/google/benchmark/pull/923
Reopens https://github.com/google/benchmark/issues/922
Fixes https://github.com/google/benchmark/issues/928
Closes https://github.com/google/benchmark/pull/930

See discussion in https://github.com/google/benchmark/issues/928
this broke pkg-config support, since there we don't account
for the suffix, nor is it trivial to do so.
2020-03-16 14:32:08 +03:00
Roman Lebedev 70d89ac519
Revert "Add d postfix to Debug libraries (#923)"
This reverts commit 5ce2429af7.

Reverts https://github.com/google/benchmark/pull/923
Reopens https://github.com/google/benchmark/issues/922
Fixes https://github.com/google/benchmark/issues/928
Closes https://github.com/google/benchmark/pull/930

See discussion in https://github.com/google/benchmark/issues/928
this broke pkg-config support, since there we don't account
for the suffix, nor is it trivial to do so.
2020-03-16 14:29:27 +03:00
Dominic Hamon 8e0b1913d4 Update issue templates 2020-02-25 11:21:58 +00: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
Ben Clayton 8982e1ee6a
Fix MSVC warning. (#935)
This fixes the Visual Studio 2019 warning:

`C4244: '=': conversion from 'int' to 'char', possible loss of data`

When implicitly casting the return value of tolower() (int) to char.

Fixes: #932
2020-02-08 02:48:01 +03:00
Alex Reinking e5ea03ce07
Fix cxx03 standard selection, option override in CMake 3.13+. Fixes #933 (#934) 2020-01-31 10:16:25 +00:00
Dominic Hamon 5ac80de037 Disable pedantic warnings and errors until googletest/gmock is fixed 2020-01-30 13:29:17 +00: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
Szitár Gergő 5ce2429af7 Add d postfix to Debug libraries (#923)
* Add DEBUG_POSTFIX to libraries.

Makes it possible to install Debug and Release versions on the
same system. Without this, there were only linker errors when using
the wrong configuration.

* Update CONTRIBUTORS and AUTHORS according to guide
2020-01-05 12:32:40 +00:00
Tetsuo Kiso 0811f1d782 Fix typo in mutex.h (#917) 2019-12-15 13:38:54 +03:00
Roman Lebedev 367119482f CPU caches are binary units, not SI. (#911)
As disscussed in https://github.com/google/benchmark/issues/899,
it is all but certain that the multiplier should be 1024, not 1000.

Fixes https://github.com/google/benchmark/issues/899
2019-12-02 09:29:16 +00: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
Dominic Hamon 49aa79b635
update header guard to match style 2019-11-25 13:05:13 +00:00
Roman Lebedev a8b3693321
Merge pull request #905 from LebedevRI/misc-cleanup
Fix some issues seen in some static analysis reports
2019-11-23 01:53:34 +03:00
Roman Lebedev 51d991f1d7
ParseCommandLineFlags(): do not dereference argc if it is null
Higher up we dereference argc only if it is not null.
But here we do no such check.
2019-11-23 00:23:11 +03:00