Commit Graph

133 Commits

Author SHA1 Message Date
Eric 6e25917001 Add -DBENCHMARK_USE_LIBCXX:BOOL=<value> option. (#280)
* Add BENCHMARK_USE_LIBCXX option.

* Add comments

* re-add zero null pointer warning
2016-08-29 12:43:30 -06:00
Eric 49bbff2c66 Supply old `RangePair` and `ArgPair` API for C++03 compatibility. (#278)
* changes

* remove other changes

* remove unneeded test

* cleanup unused include
2016-08-29 10:59:46 -07:00
Eric Fiselier db1af86d16 Fix out-of-bounds std::vector access.
In the `Ranges(...)` generation code a "control" vector which stores
the current index for each range passed to `Ranges`. Previously this vector
was incorrectly initialized to the size of the subranges not the number
of subranges.

Additionally this patch suppresses unused warnings generated by
`stream_init_anchor`.
2016-08-28 23:07:38 -06:00
Eric Fiselier aaa25ac376 Improve diagnostic output for output tests. 2016-08-28 14:22:11 -06:00
Eric 0ed4456097 Refactor output test runner into standalone module. (#277)
* refactor

* Move default substitutions into library

* Move default substitutions to the *right* place in the library

* Fix init order issues that caused test failures

* improve diagnostics

* add missing include

* general cleanup

* Address review comments
2016-08-28 13:24:16 -06:00
Eric a11fb69c89 Add --benchmark_report_aggregates_only={true|false} flag for better summary output. (#267) 2016-08-10 18:20:54 -06:00
Eric Fiselier a7a7c56152 Workaround flaky complexity_test.cc test case.
See https://github.com/google/benchmark/issues/272
2016-08-09 14:14:15 -06:00
Eric Fiselier ee54a3f03e Rework Appveyor config
Currently the Appveyor bot is a PIT. It never passes and it often hangs
or gives very poor output. This patch rewrites the configuration.

This patch also attempts to fix a flaky complexity test as a drive-by.
2016-08-08 02:04:59 -06:00
Eric Fiselier 8267117a92 Add ASAN and UBSAN builders to travis for both GCC and Clang.
This patch adds new builders that test against GCC 6 and Clang 3.8 respectivly.
They also enable both address and undefined sanitizer. MSAN currently won't work
since it requires a sanitized STL.
2016-08-07 19:25:19 -06:00
Eric Fiselier f30028b2a8 Attempt to fix VC 2013 build.
VC 2013 injects valid when  assigning an initializer list to std::set.
This attempts to work around this issue by using std::set's constructors
instead of the assignment operators.
2016-08-07 14:57:39 -06:00
Marcin Kolny dfe0260754 Support multiple ranges in the benchmark (#257)
* Support multiple ranges in the benchmark

google-benchmark library allows to provide up to two ranges to the
benchmark method (range_x and range_y). However, in many cases it's not
sufficient. The patch introduces multi-range features, so user can easily
define multiple ranges by passing a vector of integers, and access values
through the method range(i).

* Remove redundant API

Functions State::range_x() and State::range_y() have been removed. They should
be replaced by State::range(0) and State::range(1).
Functions Benchmark::ArgPair() and Benchmark::RangePair() have been removed.
They should be replaced by Benchmark::Args() and Benchmark::Ranges().
2016-08-04 12:30:14 -07:00
Eric Fiselier 7f1da4a68b Hide yet another test from MSVC 2013 2016-08-02 22:09:06 -06:00
Eric 5f5ca31ce0 Add `RegisterBenchmark(name, func, args...)` for creating/registering benchmarks. (#259)
* Add RegisterBenchmark

* fix test inputs

* fix UB caused by unitialized value

* Add RegisterBenchmark

* fix test inputs

* fix UB caused by unitialized value

* Work around GCC 4.6/4.7/4.8 bug
2016-08-02 16:22:46 -07:00
Eric Fiselier 44128d87d2 Add --benchmark_out=<filename> and --benchmark_out_format=<format> options.
These options allow you to write the output of a benchmark to the specified
file and with the specified format. The goal of this change is to help support
tooling.
2016-08-02 15:12:43 -06:00
Eric Fiselier 950c8b7440 Fix suprious failures in complexity_test.cc 2016-07-22 17:31:05 -06:00
Eric Fiselier 440df36e7a Improve failure mode in complexity_test.cc 2016-07-22 16:18:34 -06:00
Eric Fiselier 1bd62bd0be Revert "Workaround missing std::this_thread::sleep_for function in tests."
GCC 4.6 doesn't provide std::chrono::steady_clock and GCC 4.7 doesn't provide
std::this_thread::sleep_for. I would prefer to support GCC 4.7 but I'm
reverting this since the bots are GCC 4.6.

This reverts commit c5f454957d.
2016-07-22 15:42:26 -06:00
Eric Fiselier c5f454957d Workaround missing std::this_thread::sleep_for function in tests.
GCC 4.7 doesn't provide std::this_thread::sleep_for on my system.
This patch changes the tests to use a different method for wasting
cycles.
2016-07-22 15:35:26 -06:00
Ismael 3fdd76bd14 fix issue 235 (#236) 2016-06-03 09:33:17 -07:00
Ismael 8ba94b4c18 changed global string to const char * 2016-06-02 22:40:21 +02:00
Ismael 240ba4e64e changed BigOFunc argument from size_t to int 2016-06-02 22:21:52 +02:00
Ismael 109f528a40 removed functional library not needed 2016-06-02 19:48:53 +02:00
Ismael 212cfe1c2e removed check on automatic fit, to avoid random convergence misfits breaking the build 2016-06-02 19:01:10 +02:00
Ismael 8c73d49b77 fixed reporter_output_test 2016-06-01 23:13:10 +02:00
Ismael 867f9145a0 added lambdas to complexity report 2016-06-01 23:08:01 +02:00
Eric Fiselier 74a278e206 Fix flaky test 2016-05-30 17:13:41 -06:00
Eric 1b263fe6d9 Cleanup reporters (#226)
* Move ComputeStats call out of the reporters

* Cleanup adjusted time calculations in reporters

* Move ComputeBigO call out of reporters

* Remove ReportComplexity interface using ReportRuns instead

* Factor out reporting of basic context information

* Attempt to fix GCC 4.6 build errors

* Move ComputeStats to complexity.cc
2016-05-27 16:45:25 -06:00
Eric 238e558fdb Allow benchmarks to take arbitrary arguments. (#221)
* Add lambda benchmarks

* Remove lambda capture since the lambda is not at a block scope

* Remove LambdaBenchmark helper since FunctionBenchmark can be used with non-capturing lambas

* Add lambda benchmarks

* Remove lambda capture since the lambda is not at a block scope

* Remove LambdaBenchmark helper since FunctionBenchmark can be used with non-capturing lambas

* Add more docs for BENCHMARK_CAPTURE.

* Fix use of misnamed parameter

* Guard BENCHMARK_CAPTURE tests against non-c++11 compilers

* Move tests out of basic_test.cc
2016-05-27 12:37:10 -07:00
Eric 5686bf1b38 Change reporters to use a specified output and error stream. Add tests for output. (#219)
* Add test for reporter output.

* setup err_stream tests

* Fix warnings in tests

* whitespace

* Fix build errors caused by super pedantic compilers

* Pass streams by pointer not non-const reference
2016-05-27 12:34:37 -07:00
Dominic Hamon d6bc7e1581 Merge branch 'update_complexity' of git://github.com/ismaelJimenez/benchmark into ismaelJimenez-update_complexity 2016-05-26 14:01:28 -07:00
Albert Pretorius 74e82e822f Force DoNotOptimize operand to memory for both gcc and clang 2016-05-26 07:43:07 +01:00
Ismael 290ac9ee0e updated complexity_test.cc to new interface for auto 2016-05-25 23:19:32 +02:00
Ismael e246699f25 added auto as default value for complexity 2016-05-25 21:18:56 +02:00
Dominic Hamon 9686f1769e Merge branch 'skip_with_error' of git://github.com/efcs/benchmark into efcs-skip_with_error 2016-05-25 09:00:31 -07:00
Eric Fiselier 84bc4d703b Add a per benchmark 'Repetitions' option. 2016-05-24 21:52:23 -06:00
Eric Fiselier b195f82554 Merge branch 'master' into skip_with_error 2016-05-24 15:45:02 -06:00
Eric Fiselier 1080b17bf5 Fix build error with libc++ 2016-05-24 15:09:31 -06:00
Eric Fiselier bdeb38718e merge 2016-05-24 15:01:07 -06:00
Dominic Hamon 2440b752fd Formatting updates 2016-05-24 13:26:32 -07:00
Dominic Hamon a86545874a Merge branch 'ismaelJimenez-complexity' 2016-05-24 13:15:55 -07:00
Dominic Hamon 31cdabf6bb Merge pull request #216 from efcs/diagnostic-checks
Add checks that <Resume|Pause>Timing functions are not called outside of the KeepRunning() loop. Fixes #204
2016-05-24 13:09:41 -07:00
Ismael 36a9ae197f added SetComplexityN 2016-05-24 19:56:49 +02:00
Eric Fiselier 9341d705a1 Change --benchmark_list_tests to respect the benchmark filter.
This behavior mirrors how GTest handles these two flags.
2016-05-24 00:42:11 -06:00
Eric Fiselier e0de8171c6 Change RunSpecifiedBenchmarks to return the number of benchmarks run. Fixes #145 2016-05-23 23:35:09 -06:00
Eric Fiselier c7108df977 Only compile and run the C++03 test when -std=c++03 is supported. Fixes #164 2016-05-23 20:44:10 -06:00
Eric Fiselier 43017f8b15 Add SkipWithError(...) function. 2016-05-23 19:24:56 -06:00
Eric Fiselier 029f37446d Allow test to compile with -fno-exceptions 2016-05-23 15:38:30 -06:00
Eric Fiselier 481e06e65a Address review comments 2016-05-23 15:27:43 -06:00
Eric Fiselier 751e07d42d add newline 2016-05-23 15:07:54 -06:00
Eric Fiselier 69d1a52407 Add checks that <Resume|Pause>Timing functions are not called outside of the benchmark. Fixes #204 2016-05-23 15:05:55 -06:00