Commit Graph

1075 Commits

Author SHA1 Message Date
Abhina Sree a9704c268d
Nanosleep workaround for z/OS in sleep.cc (#1067)
* z/OS does not support nanosleep, add workaround to use sleep() and usleep() instead

* change unsigned to int, and fix while loop
2020-10-29 08:49:02 +00:00
Fanbo Meng dce3322a54
Add support for z/OS XL compiler inline asm syntax (#1063)
On s390 architecture, z/OS XL compiler uses HLASM inline assembly, which has different syntax and needs to be distinguished to avoid compilation error.
2020-10-21 16:39:54 +01:00
Sergei Trofimovich 3d1c267768
src/benchmark_register.h: add missing <limits> inclusion (#1060)
Noticed missing header when was building llvm with gcc-11:

```
llvm-project/llvm/utils/benchmark/src/benchmark_register.h:17:30:
  error: 'numeric_limits' is not a member of 'std'
   17 |   static const T kmax = std::numeric_limits<T>::max();
      |                              ^~~~~~~~~~~~~~
```
2020-10-15 11:12:40 +03:00
Michael Neumann af72911f2f
Add support for DragonFly BSD (#1058)
Without this commit, compilation fails on DragonFly with the following message:

```
/home/mneumann/Dev/benchmark.old/src/sysinfo.cc:446:2: error: #warning "HOST_NAME_MAX not defined. using 64" [-Werror=cpp]
^~~~~~~
```

Also note that the sysctl is actually `hw.tsc_frequency` on DragonFly:

```
$ sysctl hw.tsc_frequency
hw.tsc_frequency: 3498984022
```

Tested on:

```
$ uname -a
DragonFly box.localnet 5.9-DEVELOPMENT DragonFly v5.9.0.742.g4b29dd-DEVELOPMENT #5: Tue Aug 18 00:21:31 CEST 2020
```
2020-10-12 23:41:49 +03:00
Min-Yih Hsu ffe1342eb2
Add CycleTimer implementation for M68K architecture (#1050)
As per discussions in here [1], LLVM is going to get backend support on
Motorola 68000 series CPUs (a.k.a M68K or M680x0). So it's necessary to
add CycleTimer implementation here, which is simply using `gettimeofday`
same as MIPS. This fixes #1049

[1] https://reviews.llvm.org/D88389
2020-09-29 09:35:18 +03:00
Dominic Hamon 2d9bfe1ef8
Include github workflows status in README 2020-09-28 10:54:55 +01:00
Jusufadis Bakamovic 949f5bb11f
Add support for JSON dumps of benchmark diff reports. (#1042). Fixes #737.
NOTE: This is a fresh-start of #738  pull-request which I messed up by re-editing the commiter email which I forgot to modify before pushing. Sorry for the inconvenience.

This PR brings proposed solution for functionality described in #737 

Fixes #737.
2020-09-21 13:25:28 +03:00
Vitaly Zaitsev 7efada2dac
Fixed pkg-config on other than Ubuntu GNU/Linux distributions. (#1043)
Signed-off-by: Vitaly Zaitsev <vitaly@easycoding.org>
2020-09-12 18:56:43 +03:00
Antoine Prouvost 73d4d5e8d6
Bind benchmark builder to Python (#1040)
* Fix setup.py and reformat

* Bind benchmark

* Add benchmark option to Python

* Add Python examples for range, complexity, and thread

* Remove invalid multithreading in Python

* Bump Python bindings version to 0.2.0

Co-authored-by: Dominic Hamon <dominichamon@users.noreply.github.com>
2020-09-11 10:55:18 +01:00
Dominic Hamon df9e2948fa
Add workflow to exercise bindings (#1041)
* Initial version to try to run python bindings example

* python indent issue in setup.py

* better naming
2020-09-10 16:32:25 +01:00
Antoine Prouvost 12e85b2eeb
Bind more State methods/attributes to Python (#1037)
* Bind Counter to Python

* Bind State methods to Python

* Bind state.counters to Python

* Import _benchmark.Counter

* Add Python example of state usage

Co-authored-by: Dominic Hamon <dominichamon@users.noreply.github.com>
2020-09-10 09:57:30 +01:00
Dominic Hamon beb360d03e
Create pylint.yml (#1039)
* Create pylint.yml

* improve file matching

* fix some pylint issues

* run on PR and push (force on master only)

* more pylint fixes

* suppress noisy exit code and filter to fatals

* add conan as a dep so the module is importable

* fix lint error on unreachable branch
2020-09-09 09:43:26 +01:00
Yesudeep Mangalapilly 4751550871
Revert previous linker additions for FreeBSD as the problem is Bazel using /usr/bin/clang instead of /usr/bin/clang++ to link C++ code. (#1035) 2020-09-03 10:59:15 +01:00
Yesudeep Mangalapilly 4475ff6b8a
Adds -lm linker flag for FreeBSD/OpenBSD and uses github.com/bazelbuil… (#1032)
* Adds -lm linker flag for (Free|Open)BSD and uses github.com/bazelbuild/platforms for platform detection.

* Prefer selects.with_or to select the linkopts.

* @platforms appears to be implicitly available. @bazel_skylib would require updating every dependent repository.

* Re-enable platforms package.
2020-08-28 08:46:12 +01:00
Jeremy Ong 01c0ab7cbb
Fix Clang builds on Windows (#1021)
Fixes #974. The `cxx_feature_check` now has an additional
optional argument which can be used to supply extra cmake flags
to pass to the `try_compile` command. The `CMAKE_CXX_STANDARD=14`
flag was determined to be the minimum flag necessary to correctly
compile and run the regex feature checks when compiling with Clang
under Windows (n.b. this does *not* refer to clang-cl, the frontend
to the MSVC compiler). The additional flag is not enabled for any
other compiler/platform tuple.
2020-08-27 11:17:19 +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
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