Commit graph

20 commits

Author SHA1 Message Date
Roman Lebedev b123abdcf4 Add Iteration-related Counter::Flags. Fixes #618 (#621)
Inspired by these [two](a1ebe07bea) [bugs](0891555be5) in my code due to the lack of those i have found fixed in my code:
* `kIsIterationInvariant` - `* state.iterations()`
  The value is constant for every iteration, and needs to be **multiplied** by the iteration count.
* `kAvgIterations` - `/ state.iterations()`
  The is global over all the iterations, and needs to be **divided** by the iteration count.

They play nice with `kIsRate`:
* `kIsIterationInvariantRate`
* `kAvgIterationsRate`.

I'm not sure how  meaningful they are when combined with `kAvgThreads`.
I guess the `kIsThreadInvariant` can be added, too, for symmetry with `kAvgThreads`.
2018-06-27 15:45:30 +01:00
Eric 7b03df7ff7
Add tests to verify assembler output -- Fix DoNotOptimize. (#530)
* Add tests to verify assembler output -- Fix DoNotOptimize.

For things like `DoNotOptimize`, `ClobberMemory`, and even `KeepRunning()`,
it is important exactly what assembly they generate. However, we currently
have no way to test this. Instead it must be manually validated every
time a change occurs -- including a change in compiler version.

This patch attempts to introduce a way to test the assembled output automatically.
It's mirrors how LLVM verifies compiler output, and it uses LLVM FileCheck to run
the tests in a similar way.

The tests function by generating the assembly for a test in CMake, and then
using FileCheck to verify the // CHECK lines in the source file are found
in the generated assembly.

Currently, the tests only run on 64-bit x86 systems under GCC and Clang,
and when FileCheck is found on the system.

Additionally, this patch tries to improve the code gen from DoNotOptimize.
This should probably be a separate change, but I needed something to test.

* Disable assembly tests on Bazel for now

* Link FIXME to github issue

* Fix Tests on OS X

* fix strip_asm.py to work on both Linux and OS X like targets
2018-03-23 16:10:47 -06:00
jmillikin-stripe a9beffda0b Add support for building with Bazel. (#533)
* Add myself to CONTRIBUTORS under the corp CLA for Stripe, Inc.

* Add support for building with Bazel.

Limitations compared to existing CMake rules:
* Defaults to using C++11 `<regex>`, with an override via Bazel flag
  `--define` of `google_benchmark.have_regex`. The TravisCI config sets
  the regex implementation to `posix` because it uses ancient compilers.
* Debug vs Opt mode can't be set per test. TravisCI runs all the tests
  in debug mode to satisfy `diagnostics_test`, which depends on `CHECK`
  being live.

* Set Bazel workspace name so other repos can refer to it by stable name.

This is recommended by the Bazel style guide to avoid each dependent
workspace defining its own name for the dependency.
2018-03-08 12:48:46 +00:00
Tim bc83262f9d .vs/ and CmakeSettings.json to gitignore (#522) 2018-02-03 22:04:36 -07:00
Eric 7db02be244
Add support for GTest based unit tests. (#485)
* Add support for GTest based unit tests.

As Dominic and I have previously discussed, there is some
need/desire to improve the testing situation in Google Benchmark.

One step to fixing this problem is to make it easier to write
unit tests by adding support for GTest, which is what this patch does.

By default it looks for an installed version of GTest. However the
user can specify -DBENCHMARK_BUILD_EXTERNAL_GTEST=ON to instead
download, build, and use copy of gtest from source. This is
quite useful when Benchmark is being built in non-standard configurations,
such as against libc++ or in 32 bit mode.
2017-12-13 16:26:47 -07:00
Matt Clarkson 36c1eb6975 Coverage support with LCOV and GCOV
This patch adds a `coverage` target that allows coverage statisitics to be
retrieved for the project. It requires that lcov and gcov is installed and
that the generator is unix makefiles but this can be improved upon in
future releases.

To make it work use the coverage build type:

```
cmake -DCMAKE_BUILD_TYPE=Coverage .
make coverage
```
2015-05-13 09:17:38 +01:00
Matt Clarkson 8b5016034f Ignore tests 2015-05-12 17:15:41 +01:00
Matt Clarkson b35b581e76 Ignore windows shared libraries 2015-03-31 10:13:11 +01:00
Matt Clarkson 07de09c94c Ignore python compiled files 2015-03-31 10:13:10 +01:00
Matt Clarkson 6880244eea Added windows executables to the ignore list 2015-03-31 10:13:07 +01:00
Dominic Hamon 5fe797b6f9 Add top-level folders to gitignore to enable out-of-source builds 2015-02-21 15:00:06 -08:00
Matt Clarkson 92ddf09f1d Ignore the result of make test 2014-08-15 11:09:23 +01:00
Matt Clarkson c927845d5a get_git_version CMake function 2014-08-01 15:02:32 +01:00
Matt Clarkson 57fdf38f74 Allow shared libraries with BUILD_SHARED_LIBS 2014-07-30 18:08:54 +01:00
Dominic Hamon 58e52ba386 Ignore stanza for ninja users 2014-07-23 19:32:37 -07:00
Pierre Phaneuf 338eb89671 Ignore backup files. 2014-07-23 17:18:23 +01:00
Pierre Phaneuf c96fb246b9 Add a few output files to .gitignore. 2014-06-04 15:34:58 +01:00
Dominic Hamon d098d4c12e For those using YCM 2014-01-15 16:11:09 -08:00
Dominic Hamon dd27ca30e6 ignore tags file 2014-01-07 17:02:54 -08:00
Dominic Hamon 403f354423 Initial commit
Benchmark library builds and runs but only single-threaded. Multithreaded
support needs a bit more love.

Currently requires some C++11 support (g++ 4.6.3 seems to work).
2013-12-18 16:58:23 -08:00