Commit Graph

36 Commits

Author SHA1 Message Date
feserr 378ed8ff25
Add 'seconds' time unit (#1076)
Fixes #1075.

* Add an option to report in seconds.

* Reduce the time of the test.

* Add CSV/JSON tests for new time reports.
2020-12-21 20:15:58 +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
Eric Fiselier c408461983 Disable deprecated warnings when touching CSVReporter internally.
The CSVReporter is deprecated, but we still need to reference it in
a few places. To avoid breaking the build when warnings are errors,
we need to disable the warning when we do so.
2019-08-07 15:55:40 -04:00
Eric 4528c76b71
Print at least three significant digits for times. (#701)
Some benchmarks are particularly sensitive and they run in less than
a nanosecond. In order for the console reporter to provide meaningful
output for such benchmarks it needs to be able to display the times
using more resolution than a single nanosecond.

This patch changes the console reporter to print at least three
significant digits for all results.

Unlike the initial attempt, this patch does not align the decimal point.
2018-12-13 22:49:21 -05:00
Eric eafa34a5e8
Remove use of std::tmpnam. (#734)
std::tmpnam is deprecated and its use is discouraged. For our purposes
in the tests, we really just need a file name which is unlikely to
exist.

This patch converts the tests to using a dummy random file name
generator, which should hopefully avoid name conflicts.
2018-11-29 22:51:44 -05:00
Denis Glazachev 56f5cd6a72 Fix C++17 mode compilation with Apple clang (#721) 2018-11-21 21:38:24 -05:00
Roman Lebedev 507c06e636
Aggregates: use non-aggregate count as iteration count. (#706)
It is incorrect to say that an aggregate is computed over
run's iterations, because those iterations already got averaged.
Similarly, if there are N repetitions with 1 iterations each,
an aggregate will be computed over N measurements, not 1.
Thus it is best to simply use the count of separate reports.

Fixes #586.
2018-10-18 17:17:14 +03:00
Roman Lebedev c614dfc0d4
*Display* aggregates only. (#665)
There is a flag 
d9cab612e4/src/benchmark.cc (L75-L78)
and a call
d9cab612e4/include/benchmark/benchmark.h (L837-L840)
But that affects everything, every reporter, destination:
d9cab612e4/src/benchmark.cc (L316)


It would be quite useful to have an ability to be more picky.


More specifically, i would like to be able to only see the aggregates in the on-screen output,
but for the file output to still contain everything. The former is useful in case of a lot of repetition
(or even more so if every iteration is reported separately), while the former is **great** for tooling.

Fixes https://github.com/google/benchmark/issues/664
2018-09-12 16:26:17 +03:00
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
BaaMeow 4c2af07889 (clang-)format all the things (#610)
* format all documents according to contributor guidelines and specifications
use clang-format on/off to stop formatting when it makes excessively poor decisions

* format all tests as well, and mark blocks which change too much
2018-06-01 11:14:19 +01:00
Eric Fiselier dd8dcc8da1 Make output tests more stable on slow machines.
The appveyor bot sometimes fails because the time it
outputs is 6 digits long, but the output test regex expects at most
5 digits. This patch increases the size to 6 digits to placate the
test. This should not *really* affect the correctness of the test.
2018-02-12 19:07:19 -07:00
Joao Paulo Magalhaes ec6f03579e Trying again to fix error caused by -Wunused-function.
This thing with the pragma ignore was getting out of hand: now
MinGW (and probably GCC) was erroring too. So I chose to move
the definition of IsZero() out of the anonymous namespace into
benchmark.cc.
2017-05-03 00:05:15 +01:00
Joao Paulo Magalhaes 1735413188 Fix pragma clang ignore with gcc. 2017-05-02 23:35:46 +01:00
Joao Paulo Magalhaes 160770fd08 Fix dropped-style elses. 2017-05-02 23:30:36 +01:00
Joao Paulo Magalhaes a31088632a Fix (that is, ignore) clang compile error. 2017-05-02 23:25:22 +01:00
Joao Paulo Magalhaes 17a012d754 Fix: --benchmark_counters_tabular was not being passed to tests. 2017-05-02 20:31:54 +01:00
Joao Paulo Magalhaes b57b2cfd77 Improve some comments. 2017-05-01 23:02:35 +01:00
Joao Paulo Magalhaes 64b5f3ff2d Make Results::GetTime() receive an enum. 2017-05-01 23:02:23 +01:00
Joao Paulo Magalhaes 3443ac2103 Fix brace formatting (Habits die hard!). 2017-05-01 23:02:11 +01:00
Joao Paulo Magalhaes cdbcaaf2b6 Fix g++-4.8 compile errors. 2017-04-29 20:47:32 +01:00
Joao Paulo Magalhaes 55876610f1 Remove unused prototype. 2017-04-29 20:02:19 +01:00
Joao Paulo Magalhaes 180719d0d6 Rename ResultsCheckerEntry to Results. 2017-04-29 20:01:18 +01:00
Joao Paulo Magalhaes f3b82a8eda Adopt standard style. 2017-04-29 19:44:13 +01:00
Joao Paulo Magalhaes 86249c57a5 Result checking: move some function definitions to source file. 2017-04-29 19:40:39 +01:00
Joao Paulo Magalhaes 92034a8b84 Make result checkers execute on all regex-matching benchmarks. 2017-04-29 19:02:07 +01:00
Joao Paulo Magalhaes 738fcd9e6a Add log of the benchmark name when checking results. 2017-04-29 18:30:28 +01:00
Joao Paulo Magalhaes 6452883027 Unit testing: add facilities to check benchmark results.
This is needed for examining the values of user counters (needed
for #348). It is also needed for checking the values of standard
benchmark results like items_processed or complexities (for example,
checking the standard deviation is needed for unit testing #357
as discussed in #362).
2017-04-28 15:02:27 +01:00
Joao Paulo Magalhaes 3c2d7f5348 User counter tests: first version. 2017-04-27 19:25:20 +01:00
Joao Paulo Magalhaes b273d9b7d5 Reporter tests: reuse csv header. 2017-04-27 19:24:06 +01:00
rolandschulz 9b92ed76a8 Fix ICC compiler warnings (#358)
fixes #354

The build fails with ICC17 because of warnings and Werror. What is the correct solution to fix it?
Should a patch

disable Werror for ICC (or maybe all non known compilers)
disable the false postive warnings for all files. This could be done using:
add_cxx_compiler_flag(-wd2102) #ICC17u2: Many false positives for Wstrict-aliasing
add_cxx_compiler_flag(-wd2259) #ICC17u2: non-pointer conversion from "long" to "int" may lose significant bits (even for explicit static cast, sleep.cc(44))
add_cxx_compiler_flag(-wd654) #ICC17u2: overloaded virtual function "benchmark::Fixture::SetUp" is only partially overridden (because of deprecated overload)
disable warnings at file level or some other granularity
2017-03-27 18:30:54 -06:00
Marek Kurdej 0064c56abd Add tests for reporters (#307)
* Test bytes_per_second and items_per_second.

* Test SetLabel.

* Reformat.

* Make State::error_occurred_ private.

* Fix tests with floats.

* Merge private blocks
2016-10-28 09:13:57 -07:00
Marek Kurdej 8aeb20f16b Add tests. 2016-10-21 14:59:06 +02:00
Eric Fiselier 2555035f44 Use correct RE for floating point numbers in reporter_output_test.cc 2016-10-07 21:56:22 -06:00
Dominic Hamon 1100e91907 Simplify clang-format and apply to tests (#302) 2016-10-07 11:04:50 -07: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