Commit graph

857 commits

Author SHA1 Message Date
guray fef203bd02 Fix typename for powerpc (#337) 2017-01-30 12:50:21 -08:00
Matt Sieren 246ee86428 Disable iOS CPU Frequency readout (#335)
* Add macro definition for iOS

Add an additional macro definition for iOS.
iOS is defined as a Mac OSX invariant in the TargetConditionals include,
thus we treat it as a subset of OSX within the defines.

* Skip error for hw.cpufrequency on iOS

hw.cpufrequency is not available on iOS devices. As there is no way to reliably
retrieve the CPU frequency on iOS we are printing out a warning
that we were unable to detect the CPU frequency and set it to 0.

This only disables cpu frequency readouts on actual physical iOS devices.
Running this code on the simulator still gives the cpu architecture of
the host computer as the simulator passes down the sysctl calls to OSX.
2017-01-24 11:31:14 -08:00
Niklas Rosenstein 817bfee273 Report unrecognized arguments from BENCHMARK_MAIN() macro (#332)
* BENCHMARK_MAIN() now reports unrecognised command-line flags (see google/benchmark#320)

* add benchmark::ReportUnrecognizedArguments()

Update BENCHMARK_MAIN() to use ReportUnrecognizedArguments() instead of
having the reporting code directly in the macro.

See issue google/benchmark#320 for reference

* let's stick to american english -- fix type in ReportUnrecognizedArguments()

* make ReportUnrecognizedArguments() print to stderr

* make ReportUnrecognizedArguments() return true if any arguments have been reported (i.e. argc > 1)
2017-01-17 19:28:20 -08:00
jpmag b4fdf6e9df HumanReadableNumber(): Simplify output for simple numbers. Examples: (#291)
* HumanReadableNumber(): Simplify output for simple numbers. Examples:

HumanReadableNumber(    0.0)=      0    ---->         0
HumanReadableNumber(    0.5)=   512m    ---->       0.5
HumanReadableNumber(    0.9)= 921.6m    ---->       0.9
HumanReadableNumber(    1.0)=  1024m    ---->         1
HumanReadableNumber(   1.05)=1075.2m    ---->      1.05
HumanReadableNumber(    1.1)=    1.1    ---->       1.1
HumanReadableNumber(    1.2)=    1.2    ---->       1.2
HumanReadableNumber( 0.0e-1)=      0    ---->         0
HumanReadableNumber( 0.5e-1)=  51.2m    ---->      0.05
HumanReadableNumber( 0.9e-1)= 92.16m    ---->      0.09
HumanReadableNumber( 1.0e-1)= 102.4m    ---->       0.1
HumanReadableNumber(1.05e-1)=107.52m    ---->     0.105
HumanReadableNumber( 1.1e-1)=112.64m    ---->      0.11
HumanReadableNumber( 1.2e-1)=122.88m    ---->      0.12
HumanReadableNumber( 0.0e-3)=      0    ---->         0
HumanReadableNumber( 0.5e-3)=524.288u   ---->   524.288u
HumanReadableNumber( 0.9e-3)=943.718u   ---->   943.718u
HumanReadableNumber( 1.0e-3)=1048.58u   ---->   1048.58u
HumanReadableNumber(1.05e-3)=  1101u    ---->   0.00105
HumanReadableNumber( 1.1e-3)=1.1264m    ---->    0.0011
HumanReadableNumber( 1.2e-3)=1.2288m    ---->    0.0012

* HumanReadableNumber(): change simple printing threshold to 0.01.

* ToExponentAndMantissa(): refactor branch sequence.
2017-01-13 14:19:42 -08:00
Alt 34010beecb Fix librt linking on systems which has it (#331) 2017-01-13 08:41:29 -08:00
BRevzin 4bf28e611b Issue 327 (#328)
Arguments shouldn't be AppendHumanReadable()-ed, they should just be shown as-is.
2016-12-20 11:37:17 -08:00
Pavel Campr e381139474 fix compare script - output formatting - correctly align numbers >9999 (#322)
* fix compare script - output formatting - correctly align numbers >9999

* fix failing test (report.py); fix compare script output formatting (large numbers alignment)
2016-12-09 05:24:31 -07:00
Niklas Rosenstein 56336e70f1 fix argv accessed out of bounds in ParseCommandLineFlags() (#321) 2016-12-06 08:38:03 -08:00
Eric efd4e992a6 Add support for building w/o exceptions (#317) 2016-12-05 09:24:09 -08:00
Eric a3eac442c2 Update the required CMake version to 2.8.12 (#316) 2016-12-05 09:22:46 -08:00
Eric 83ac086fbd Add compare_bench.py documentation. Fixes #309 (#318) 2016-12-02 19:47:27 -07:00
Eric Fiselier a8aa40c596 Fix obvious typo in string formatting 2016-11-19 05:17:52 -07:00
Eric Fiselier 2373382284 Rewrite compare_bench.py argument parsing.
This patch cleans up a number of issues with how compare_bench.py handled
the command line arguments.

* Use the 'argparse' python module instead of hand rolled parsing. This gives
  better usage messages.

* Add diagnostics for certain --benchmark flags that cannot or should not
  be used with compare_bench.py (eg --benchmark_out_format=csv).

* Don't override the user specified --benchmark_out flag if it's provided.

In future I would like the user to be able to capture both benchmark output
files, but this change is big enough for now.

This fixes issue #313.
2016-11-18 15:42:02 -07:00
Dominic Hamon 4f8bfeae47 Report error when no benchmarks match regex. (#308)
Fixes #306
2016-10-28 14:22:22 -07: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
Dominic Hamon 8e08aa75d9 Merge branch 'mkurdej-arg-names' 2016-10-26 09:22:18 -07:00
Marek Kurdej 3f23832a09 Allow calling Args and ArgNames in any order. 2016-10-26 09:36:39 +02:00
Marek Kurdej cfee1a54e4 Check argument count in ArgName and ArgNames. 2016-10-26 09:29:28 +02:00
Marek Kurdej c1c01b2cd3 Handle the case when the argument name is an empty string. 2016-10-25 09:45:35 +02:00
Marek Kurdej 17e1c405dd Add ArgName() and ArgNames() methods to name arguments/ranges. 2016-10-24 09:57:40 +02:00
Dominic Hamon 44c25c892a Merge branch 'mkurdej-fix-time-unit' 2016-10-21 09:24:46 -07:00
Marek Kurdej 8aeb20f16b Add tests. 2016-10-21 14:59:06 +02:00
Marek Kurdej 5aa3855627 Fix displayed time unit in mean and standard deviation. 2016-10-21 14:33:23 +02:00
Eric Fiselier 57a22c69b3 Fix typo in timer.cc that caused negative CPU times on OS X. Fixes #293 2016-10-08 02:12:40 -06:00
Eric Fiselier 721c9224b9 Fix getting the CPU frequency on OS X 2016-10-08 01:38:09 -06:00
Eric Fiselier f67ee4ad9b Fix #294. Add -D_GNU_SOURCE when building under Cygwin 2016-10-08 01:03:23 -06:00
Eric Fiselier 03c4485d84 Fix #295. Remove use of BSD extensions for comparing strings 2016-10-07 22:54:06 -06:00
Eric Fiselier 36a251ab3e Fix #300. Emit RMS as a float not a percentage in JSON 2016-10-07 22:26:01 -06: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 332f677b8b Apply clang-format to all headers and source (#303) 2016-10-07 11:35:03 -07:00
Dominic Hamon 1100e91907 Simplify clang-format and apply to tests (#302) 2016-10-07 11:04:50 -07:00
ktnyt d1daeee4e9 Pass flag string to check_cxx_compiler_flag (#298) 2016-10-05 09:19:14 -07:00
Eric Fiselier 2aca242bf6 Fix various uninitialized members 2016-09-28 18:21:36 -06:00
Alt 6cadcf7f14 Fix working on mac clock_gettime (#292)
* fix working on mac clock_gettime

* Comment fixme
2016-09-26 15:48:25 -07:00
Dominic Hamon 62c68ba4f0 s/resolved/unresolved/ 2016-09-23 12:44:22 -07:00
Nicholas Hutchinson 917b86e615 Auto-detect whether Benchmark should produce colorized output (#126)
* Auto-detect whether to produce colorized output

Rename --color_print to --benchmark_color for consistency with the other
flags (and Google Test). Old flag name is kept around for compatibility.

The --benchmark_color/--color_print flag takes a third option, "auto",
which is the new default. In this mode, we attempt to auto-detect
whether to produce colorized output. (The logic for deciding whether to
use colorized output was lifted from GTest:
<https://github.com/google/googletest/blob/master/googletest/src/gtest.cc#L2925>.)

* Update CONTRIBUTORS, AUTHORS
2016-09-15 15:10:35 -06:00
Nicholas Hutchinson b826143ac2 Flush reporters' output streams after writing a benchmark run (#288)
If a reporter's output stream isn't line-buffered (e.g. it's not writing
to a terminal) then it can be some time before a write to it becomes
visible.

This is problematic if, say, you're wanting to use tail -f to view the
file written to via --benchmark_out. Or if the application crashes,
leaving you with no results.

Addressed by flushing the reporters' output streams whenever we invoke
methods that may write to them.
2016-09-11 15:36:14 -06:00
Eric c6f3f0eb9c Cleanup RunBenchmark code. (#289)
* Cleanup the code for generating and running benchmarks

* Rework calculation of real/manual time

* Add back TSAN builder
2016-09-06 02:28:35 -06:00
Eric d038472c18 Refactor benchmark.cc into benchmark_register.cc and benchmark.cc (#287)
* Refactor benchmark.cc into benchmark_register.cc and benchmark_run.cc

The benchmark.cc file is getting really big and it contains a bunch of
unrelated components. This patch separates the files into two separate
parts. The "runtime" parts and the "registration" parts.

This patch also removes the PIMPL used by Benchmark. Previously we couldn't
have STL types in the interface but now we can. Therefore there is no reason
to keep BenchmarkImp.

* add missing include

* rework windows timers again

* Guard timespec on older Windows versions

* Remove old thread safety annotation workarounds
2016-09-05 15:48:40 -06:00
Eric Fiselier 9c26168126 Document --benchmark_filter. Thanks to NAThompson for the original patch 2016-09-05 15:40:12 -06:00
Ronny 72be9523bb Add Benchmark::ThreadRange() version with increment instead of multiply (#283)
* add additive thread range

* add test
2016-09-03 13:56:46 -06:00
Eric Fiselier 60e88c21e4 Remove TSAN builder for now. 2016-09-03 02:11:42 -06:00
Eric Fiselier db376c8654 Tweak TSAN flags 2016-09-03 01:45:59 -06:00
Eric Fiselier 183999c002 Add Thread Sanitizer bot to Travis 2016-09-03 00:40:44 -06:00
Eric Fiselier 07ee194092 Fix wording because an idiot came up with it. 2016-09-03 00:19:37 -06:00
Eric Fiselier 309ecb737f Increase complexity_test runtime slightly less. 2016-09-03 00:18:02 -06:00
Eric Fiselier f261c68074 Try and add MSVC NORETURN attribute again 2016-09-03 00:13:20 -06:00
Eric Fiselier 756f069918 Increase complexity_test.cc runtime to attempt to avoid appveyor failures 2016-09-03 00:06:51 -06:00
Eric Fiselier 2314368cb5 Add another workaround for Appveyor warnings 2016-09-02 23:59:07 -06:00
Eric Fiselier 5224b63c35 Fix BENCHMARK_NORETURN on MSVC 2016-09-02 23:54:58 -06:00