Commit graph

464 commits

Author SHA1 Message Date
Eric Fiselier 6a45324e1d Address review comments. 2016-05-24 16:12:30 -06:00
Eric Fiselier 525858e687 Fix error-handling in reporters 2016-05-24 15:44:58 -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 f126852c8f simplify format string for complexity output 2016-05-24 13:15:16 -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 a24ef95e11 adapt complexity_n to leastsq inteface 2016-05-24 20:48:34 +02:00
Ismael 5e10e120db fixed overshadow 2016-05-24 20:26:21 +02:00
Ismael e5cf020d97 fixed warning 2016-05-24 20:06:54 +02: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 43017f8b15 Add SkipWithError(...) function. 2016-05-23 19:24:56 -06:00
Eric Fiselier 481e06e65a Address review comments 2016-05-23 15:27:43 -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
Ismael 0c23d2852f extracted BigO and GetBigO in own file 2016-05-23 22:31:40 +02:00
Ismael 266b3bd635 changed color and remove iterations 2016-05-23 22:09:55 +02:00
Ismael 43ef17441c refactor names 2016-05-23 20:50:35 +02:00
Ismael d577987fd7 changed indentation 2016-05-23 20:40:41 +02:00
Ismael ea69a84790 fix 2016-05-23 20:34:54 +02:00
Ismael fed9b6f211 refactor least square .h 2016-05-23 20:34:01 +02:00
Ismael 266addc3f5 fixed last_benchmark_instance 2016-05-23 20:21:34 +02:00
Ismael ac05c04533 refactor MinimalLEastSq 2016-05-23 20:12:54 +02:00
Ismael 5e52d2d6c0 refactor fitting curve 2016-05-23 19:19:29 +02:00
Ismael 5f9823bd92 fixed non-const reference arguments 2016-05-23 18:51:29 +02:00
Ismael 290bd60289 Refactor for pull request 2016-05-21 11:51:42 +02:00
Ismael 2e5c397b48 implemented complexity reporting 2016-05-21 08:55:43 +02:00
Ismael 872ff01a49 addaptation of minimal_leastsq library 2016-05-20 16:49:39 +02:00
Ismael b73dc22944 implemented Complexity for O(1) 2016-05-18 21:25:00 +02:00
Ismael 27f0baa190 Added test file and Complexity() interface 2016-05-18 19:59:34 +02:00
Ismael d2103de3d3 Modified check for range multiplier 2016-05-16 18:17:11 +02:00
Ismael c60eefdbb7 added option to change range multiplier 2016-05-14 15:56:34 +02:00
Jussi Knuuttila e253a28402 Manual timing support. 2016-05-05 23:24:13 +03:00
Jussi Knuuttila dce2ebb403 Fixed a warning caused by an implicit narrowing cast. 2016-05-05 20:34:44 +03:00
Dominic Hamon 02f409a71f Only output optional fields if they're set 2016-05-02 12:04:16 -07:00
Kai Wolf 1203b3cbe4 Fix missing <tuple> header in csv/json_reporter 2016-03-30 09:14:04 +02:00
Kai Wolf e6d62fd135 Add GetTimeAndMultiplier to json and csv reporter as well 2016-03-29 20:35:38 +02:00
Kai Wolf 0b4111c3b3 Refactor GetTimeUnitAndMultiplier and add example 2016-03-28 21:32:11 +02:00
Kai Wolf 7c69b36078 Add an additional parameter for time units 2016-03-26 01:04:17 +01:00
Kai Wolf cded70a166 Add optional ms time unit for console reporter
Some benchmarks may run a few milliseconds which makes it kind of hard to visually compare, since the currently only available nanoseconds numbers can get very large in this case. Therefore this commit adds an optional command line flag --benchmark_time_unit which lets the user choose between ns and ms time units for displaying the mean execution time.
2016-03-24 22:18:55 +01:00
Jakob Buchgraber 007efee751 Add number of threads to State.
Having access to the thread count from within a benchmark is useful,
for when one wants to distribute a workload dynamically among the
benchmarks running in parallel e.g when using ThreadRange() or
ThreadPerCpu().
2016-02-15 21:39:15 +01:00
Dominic Hamon af489cd4a3 Merge pull request #176 from enh/cycle-timer-aarch64
Add aarch64 support to src/cycleclock.h.
2016-02-13 13:05:16 -08:00
Elliott Hughes 930d3af052 Fix ARM /proc/cpuinfo parsing.
Also fix related warning message typos.
2016-02-10 16:20:05 -08:00
Elliott Hughes d9630aee88 Add aarch64 support to src/cycleclock.h.
From google3's base/cycleclock.
2016-02-10 15:48:27 -08:00
Eric Fiselier f662e8be5b Rename OS_MACOSX macro to new name BENCHMARK_OS_MACOSX. Fix #169 2015-12-14 15:02:30 -07:00
ryobg a863aead13 Fixes #159: Add inclusion of cstdio to files using stdout, vprintf, printf and etc. 2015-11-06 11:07:26 +02:00
guanqun 65cd2bac6c add static_cast to get rid of warnings for intel compiler on linux platform 2015-10-25 20:43:27 +08:00
Dominic Hamon 90e7cf000e Update macro names in comments. 2015-10-12 09:50:01 -07:00
Anton Danielsson 8c71c307ac Fixed OS macros changed in previous pull request. 2015-10-09 09:09:14 +02:00
Anton Danielsson a2f2a28b31 Changed date format to ISO 8601. 2015-10-09 09:05:19 +02:00
Anton Danielsson 032c190c4a Removed newline. 2015-10-09 09:00:42 +02:00
Anton Danielsson 7e9800e78a Added a comment why std::vsnprintf is not used. 2015-10-09 08:47:37 +02:00
Anton Danielsson c8f4690fd4 Sorted include of headers. 2015-10-09 08:47:36 +02:00
Anton Danielsson 0d35f5f68a Only include "sys/sysctl.h" if it is needed.
sys/sysctl.h is not available in the android-ndk.
2015-10-09 08:47:34 +02:00
Anton Danielsson c1e03a4b58 Changed "std::vsnprintf" to "vsnprintf" to be able to build with the android-ndk. 2015-10-09 08:47:34 +02:00
Anton Danielsson aecd746691 Added include of cstdlib needed for strtol, strtod and getenv. 2015-10-09 08:47:33 +02:00
Mayeul d'Avezac da80193de9 Fixes compilation issue on Macs
ba141ac0d9 renamed OS_MACOSX -> BENCHMARK_OS_MACOSX,
except for an include guard in src/cycleclock.h
2015-10-08 18:35:06 +01:00
Dominic Hamon e2327733e6 Merge pull request #150 from DiracResearch/visual-studio-warnings-fix
Visual studio warnings fix
2015-10-08 10:06:01 -07:00
Anton Danielsson 5cced076d2 Fixed int to char warning. 2015-10-08 10:48:40 +02:00
Anton Danielsson fcf4e99e01 Use IsWindowsXPOrGreater instead of the deprecated GetVersionEx. 2015-10-08 10:48:34 +02:00
Anton Danielsson e605cb0802 Changed "while(true)" to "for(;;)" to avoid warning in visual studio. 2015-10-08 10:48:32 +02:00
Anton Danielsson 2589e69e05 Fixed double to float warning. 2015-10-08 10:48:22 +02:00
Anton Danielsson e7f6c42a79 Fixed bug in "ToExponentAndMantissa" when negative exponents where created.
Unary minus where applied to an unsigned type.
2015-10-08 10:48:19 +02:00
Anton Danielsson a822c71655 Removed default constructor, copy constructor and assignment operator for CheckHandler. 2015-10-08 10:48:16 +02:00
Anton Danielsson 96ca9a7aba Fixed int64 to double cast warning. 2015-10-08 10:48:01 +02:00
Anton Danielsson ba141ac0d9 Renamed the internal os macros to avoid a name clash in Shlwapi.h where OS_WINDOWS is defined to 0. 2015-10-08 10:47:49 +02:00
izaid 14c4ce5ebf Removed unneeded #include <cstddef> 2015-10-06 15:10:15 +01:00
Eric Fiselier 3dd14f0724 Make the type of kMaxIterations consistent with the type of the iteration count 2015-10-01 18:46:39 -06:00
Eric Fiselier ed0a2eb741 use size_t instead of int for the iteration count 2015-10-01 15:08:44 -06:00
Eric Fiselier bcb933a9fb dynamically allocate WallTimeImp 2015-10-01 14:53:46 -06:00
Eric Fiselier e0441ef5d0 Merge branch 'master' into remove-check 2015-10-01 14:52:46 -06:00
Greg Miller 2463339d0b Updates Initialize() to work with an argv as 'char**' 2015-09-30 16:14:50 -04:00
Jean-Louis Leroy 11042c7fe7 Remove unused FormatKV(..., size_t) overload. 2015-09-25 09:37:03 -04:00
Jean-Louis Leroy 0f5503e9a2 Address Dominic's (stylistic) remarks. 2015-09-08 15:37:07 -04:00
Eric Fiselier a69f566e0a Remove std::is_trivially_destructible assertion because the trait may not be provided by the STL. 2015-09-07 19:33:23 -06:00
Jean-Louis Leroy 5ec78d7d44 Do not CpuScalingEnabled on Windows. 2015-09-03 15:11:12 -04:00
Jean-Louis Leroy cf830f731f Fix division in CPU usage calculation on Windows. 2015-09-03 15:11:11 -04:00
Jean-Louis Leroy 2cf277b6f6 Iterations declared as size_t but printf'ed as a long long. Make it a long long. 2015-09-03 15:11:10 -04:00
Jean-Louis Leroy d49516bc99 Make it compile with Visual Studio 2013. 2015-09-03 15:11:09 -04:00
Jean-Louis Leroy 693967fe19 Remove unnecessary `typename'. 2015-09-03 15:11:08 -04:00
Kaito Udagawa 72ce39de3e Fix the compilation error against G++ on Mac OS X.
Using `0` as a null pointer is illegal when `-Wzero-as-null-pointer-constant`
is given to G++.  To avoid the warning `zero-as-null-pointer-constant`,
`nullptr` (C++11 keyword) instead of `0` is used in the `sysctl` invocation.
2015-06-13 19:34:20 +09:00
myd7349 9afa6c986c Fix issue #127 2015-06-05 09:25:11 +08:00
Eric Fiselier 9ed538f511 address review comments 2015-04-06 17:56:05 -04:00
Eric Fiselier 12f4405870 add ability to use benchmark filters 2015-04-06 17:00:06 -04:00
Dominic Hamon 1e0ed3a21c Rearrange the pieces 2015-04-03 13:33:54 -07:00
Geoff Romer dcb1a3dad4 Drop down to CMake 2.8.11, and drop INTERFACE since that version doesn't
support it.
2015-04-03 13:30:59 -07:00
Geoff Romer 3078ce9bc5 Link pthread as an INTERFACE library. 2015-04-03 13:30:59 -07:00
Geoff Romer 89a1edae15 Require cmake 2.8.12 in order to support target_include_directories, and
simplify thread linking logic.
2015-04-03 13:30:59 -07:00
Geoff Romer a6ad799a4d Configure 'benchmark' cmake target so that when other targets depend on it,
they get the appropriate include directories and link libraries automatically.
2015-04-03 13:30:59 -07:00
Eric Fiselier 8fcfa81d51 Fix comment about linking threading 2015-04-01 11:40:22 -04:00
Eric Fiselier 8bb991d099 Remove BENCHMARK_ENABLE_SHARED and prefer BUILD_SHARED_LIBS 2015-04-01 11:34:38 -04:00
Dominic Hamon 9934396e1f Add missing paranthesis and documentation 2015-04-01 10:51:37 -04:00
Matt Clarkson d676c5b375 Libraries are treated as runtime objects on Windows
When the library is created as a *.dll on Windows it is treated like a
runtime object so we must proivde the destination for the runtime
objects in our install command
2015-04-01 10:57:08 +01:00
Dominic Hamon 25e46848f9 Clarify build type warning 2015-03-31 14:43:38 -04:00
Eric 006d23ccca Merge pull request #108 from google/list-tests
Add --benchmark_list_tests option and change filter to match generated name.
2015-03-31 14:16:58 -04:00
Eric Fiselier ba1becca1a Add braces for one line conditionals and loops 2015-03-31 13:28:41 -04:00
Matt Clarkson b2a43b491c NT definition of MyCPUUsage and ChildrenCPUUsage
The children CPU usage doesn't seem to have a equivalent on NT systems
so it just returns zero.
2015-03-31 10:13:10 +01:00
Matt Clarkson 05eb1f2545 Use int64_t rather than int64
For cross platform and cross compiler portability we use the
standard integer type for a 64-bit integer. MinGW on Windows doesn't
have the definition for `int64`.
2015-03-31 10:13:09 +01:00
Matt Clarkson 65a5ebd638 Use the WINAPI Sleep function 2015-03-31 10:13:09 +01:00
Matt Clarkson 6bc54ba028 Use CMake to link Shlwapi on Windows
We use the SHGetValueA on Windows to retrieve the MHz of the processor
but this requires the shlwapi library. Previous to this patch the
library was linked with a MSVC specific pragma but there is no
guarantee that on Windows we will be using MSVC. Therefore, it is much
compile agnostic to use the standard CMAKE library linking mechanism
to provide the definition of SHGetValueA
2015-03-31 10:13:08 +01:00
Matt Clarkson dd61391c5d Only include the correct platform headers 2015-03-31 10:13:08 +01:00
Eric Fiselier 12f1c5f471 add list test internals 2015-03-30 23:32:37 -04:00
Dominic Hamon 2924aaa747 Deal with names with embedded quotes 2015-03-30 10:41:22 -07:00
Dominic Hamon b6e4f67d75 Add csv to help output 2015-03-27 14:08:46 -07:00
Dominic Hamon 680a399a93 Add double-quotes where necessary 2015-03-27 14:07:23 -07:00
Dominic Hamon 71c41cde57 Introduce CSV reporter 2015-03-27 14:07:23 -07:00
Eric Fiselier 9ed1082c33 Merge branch 'master' into new-benchmark-interface 2015-03-27 16:36:40 -04:00
Eric Fiselier e428b9eec3 Add 'benchmark::DoNotOptimize(...)' to help users prevent optimizations 2015-03-27 16:35:46 -04:00
Eric Fiselier 4f9ce87e8c Merge branch 'master' into new-benchmark-interface 2015-03-27 16:26:36 -04:00
Eric Fiselier c5f238b18c Fix column width calculation and remove duplicate test 2015-03-27 12:28:22 -04:00
Eric Fiselier cfa3e181ab Make DateTimeString part of the internal implementation 2015-03-27 12:13:02 -04:00
Eric Fiselier 4bf6ceb50d Change the available benchmark options 2015-03-26 23:37:26 -04:00
Eric Fiselier b07fee6b64 address review comments 2015-03-26 18:32:31 -04:00
Eric Fiselier 1b9e55c281 Remove walltime implementation tests and expose less internals 2015-03-26 17:56:27 -04:00
Eric Fiselier d3e0671a87 finish selection of clock with debug information 2015-03-26 17:52:28 -04:00
Eric Fiselier 48c4c9cf50 Revert "prevent unneeded calculation of Slow()"
The calculation was actually inside the loop for a reason.

This reverts commit 47442b9054.
2015-03-26 16:22:29 -04:00
Eric Fiselier 47442b9054 prevent unneeded calculation of Slow() 2015-03-26 16:01:29 -04:00
Eric Fiselier 725f1f066d add walltime benchmark and fix unused variable. 2015-03-26 14:56:52 -04:00
Eric Fiselier d0df7ef2de cleanup whitespace and includes 2015-03-26 14:30:16 -04:00
Eric Fiselier a3308c6d86 Introduce use of std::chrono and remove Walltime printing 2015-03-26 14:26:07 -04:00
Eric Fiselier 92fc9b99b2 Add newline after every benchmark to improve readability of the json output. 2015-03-18 12:09:18 -04:00
Eric Fiselier 6429348e0d address review comments and fix array type declaration 2015-03-18 00:23:43 -04:00
Eric Fiselier ffb67dcabf address review comments 2015-03-17 18:42:41 -04:00
Eric Fiselier f65da9d581 add json reporter 2015-03-17 18:18:06 -04:00
Eric Fiselier 20f1c0e2a8 Apply reporter interface changes. Make report methods non-const and add a Finalize method. 2015-03-17 16:16:36 -04:00
Eric Fiselier e45252e6f5 move ConsoleReporter out of internal namespace 2015-03-17 14:15:16 -04:00
Eric Fiselier 4242f2f1d7 move reporter internals in both headers and source 2015-03-17 13:46:16 -04:00
Eric Fiselier 7f2ef46255 merge master 2015-03-17 12:35:11 -04:00
Eric Fiselier 1924b30a6c Merge null pointer warnings 2015-03-17 12:21:20 -04:00
Eric Fiselier 66bf7c8f71 add floating point comparison warnings 2015-03-12 20:27:29 -04:00
Eric Fiselier 180981716b replace instances of NULL with nullptr 2015-03-12 19:32:50 -04:00
Eric Fiselier 64ba272911 Enable zero as NULL warnings and fix all occurences 2015-03-12 19:16:06 -04:00
Eric Fiselier 2b34b5d937 remove unneeded includes 2015-03-12 18:45:52 -04:00
Eric Fiselier 937987b63d pimpl benchmark 2015-03-12 18:40:34 -04:00
Eric Fiselier 7a767012f1 Adopt new benchmark timing internals.
This patch adopts a new internal structure for how timings are performed.
Currently every iteration of a benchmark checks to see if it has been running
for an appropriate amount of time. Checking the clock introduces noise into
the timings and this can cause inconsistent output from each benchmark.

Now every iteration of a benchmark only checks an iteration count to see if it
should stop running. The iteration count is determined before hand by testing
the benchmark on a series of increasing iteration counts until a suitable count
is found. This increases the amount of time it takes to run the actual benchmarks
but it also greatly increases the accuracy of the results.

This patch introduces some breaking changes. The notable breaking changes are:
1. Benchmarks run on multiple threads no generate a report per thread. Instead
   only a single report is generated.
2. ::benchmark::UseRealTime() was removed and replaced with State::UseRealTime().
2015-03-12 18:03:33 -04:00
Dominic Hamon d68127d8ad Enable UseRealTime and fix documentation for SetLabel.
Fixes #89

UseRealTime was defined in the internal namespace by mistake.
Similarly, documentation suggested that benchmark::SetLabel should be
used to set a label, and a function was declared but not defined, while
actually the call should be 'state.SetLabel'.
2015-03-11 09:47:15 -07:00
Eric Fiselier 75686a8f22 remove forward declarations 2015-03-09 18:00:04 -04:00
Eric Fiselier 60e26b7022 fix missing newline and header guard name 2015-03-09 16:18:10 -04:00
Eric Fiselier 5cfd6bcc14 update more copyright 2015-03-09 16:15:05 -04:00
Eric Fiselier 8f5cd9760f Merge branch 'upgrade-step2' into upgrade-step3 2015-03-09 16:03:06 -04:00
Eric Fiselier d20cdf19ca address comments 2015-03-09 15:48:51 -04:00
Eric Fiselier e60561a779 Force static initialization of walltime. 2015-03-09 14:56:47 -04:00
Eric Fiselier a187aa0803 Third step in moving towards adopting new timer semantics 2015-03-06 17:01:05 -05:00
Eric Fiselier f1c398adb4 invert check in GetLogInstanceForLevel() 2015-03-06 14:19:06 -05:00
Eric Fiselier 8ed7d7664b The second step towards merging the timer changes.
This patch does two things:

1. It overhalls the static initialization in Walltime to be simplier. It uses
   a static variable inside WallTime::Now() to initialize the timer.

2. Add a logging mechanism so that the -v flag actually has meaning and
   reimplement the CHECK macros to allow extra messages to be streamed in.
2015-03-06 14:07:24 -05:00
Eric Fiselier b1f34d3880 address comments 2015-03-06 13:20:47 -05:00
Eric Fiselier 5b41e128b3 Step one towards merging timer changes.
This patch cleans up our use of generic macros and also merges changes in the
build system.

It adds options -DBENCHMARK_ENABLE_TESTING and -DBENCHMARK_ENABLE_SHARED.
2015-03-06 12:35:00 -05:00
Eric cff940a727 Merge pull request #78 from pdavydov108/master
Fix #77 build on freebsd 10
2015-03-02 20:10:20 +01:00
Eric 5e77de62a1 Merge pull request #76 from google/64-32
One more 64-bit to 32-bit conversion
2015-03-02 17:47:02 +01:00
Pavel Davydov 8e3e78fc3d Fix #77 add comment to headers in wrong order 2015-02-25 10:41:26 +03:00
Pavel Davydov c8d05fcc96 Fix #77 build on FreeBSD 10 2015-02-21 17:05:13 +03:00
Eric Fiselier 9a11834048 add includes for stdint.h 2015-02-19 16:37:05 -05:00
Dominic Hamon 2789aba1ce One more 64-bit to 32-bit conversion 2015-02-18 22:21:39 -08:00
Dominic Hamon 3968ff45ba Fix #72 by avoiding 64-to-32-bit shortenings 2015-02-18 11:18:40 -08:00
Dominic Hamon a3b5e44c52 Remove CHECK_* from public API.
CHECK_* are now private and used internally in the library. The test
uses have been replaced with asserts.

Fixes #62.
2014-10-31 21:54:55 -07:00
x.zhou 4a3348ce22 Turn the global mutex into instance variables
To fix #52
2014-10-12 18:01:45 +08:00
Matt Clarkson f043826542 C++11 regular expressions 2014-08-22 14:55:46 +01:00
Matt Clarkson fac16a662e CMakeLists.txt comments 2014-08-20 08:42:30 +01:00
Matt Clarkson 373cc41100 C++11 concurrency instead of pthread 2014-08-06 10:50:21 -07:00
Matt Clarkson 57fdf38f74 Allow shared libraries with BUILD_SHARED_LIBS 2014-07-30 18:08:54 +01:00
Lei Xu 3460bf1aa6 Fixed compiling on Mac 10.9.3 with g++-4.8, clang or system c++ 2014-07-24 23:57:09 -07:00
Paul Redmond b33d1f1d39 fix signed/unsigned comparison warning 2014-07-23 10:35:12 -04:00
pleroy 10dc155372 Fix a bug in the destruction of BenchmarkFamilies. 2014-06-09 13:31:51 +02:00
pleroy fe1b75b87e Merge branch 'GoogleMaster' into PausePure
Conflicts:
	src/benchmark.cc
2014-06-05 23:02:22 +02:00
pleroy bcf08705f5 Comment. 2014-06-04 23:17:09 +02:00
pleroy 640dd5a492 Less of a hack: avoid the division/multiplication if the stddev is 0. 2014-06-04 23:13:22 +02:00
pleroy db4248e21e Merge branch 'TwoBugs' into StatsPure 2014-06-04 22:51:29 +02:00
pleroy e189ec0283 Print mean/stddev of the # of iterations. 2014-06-04 22:02:28 +02:00
pleroy 0d9a060f5b Two bug fixes in KeepRunning. 2014-06-04 21:21:24 +02:00
pleroy ec1e09f939 Ignore the CPU time consumed when timing is paused.
Conflicts:
	src/benchmark.cc
2014-05-29 16:01:11 +02:00
pleroy 291ff1faed Fix the stddev/mean computations which had be garbled since commit e5f5a0d30e, leading to a mean that was not in the min/max range and to zero-divide in the stddev computation, among others. 2014-05-29 15:25:24 +02:00
Dominic Hamon e5a431998d Merge pull request #23 from ckennelly/clock_initialization
Resolve race on approx_time_ in FastClock.
2014-05-05 10:03:11 -07:00
Dominic Hamon 46507cb276 Merge pull request #22 from ckennelly/mutex_initialization
Statically initialize benchmark_mutex and extend its lifetime.
2014-05-05 10:02:50 -07:00
Chris Kennelly 2c9b29c9ff Resolve race on approx_time_ in FastClock.
InitType should hold a lock before storing to approx_time_, which is later
read by the background worker.  When the worker is actively running (i.e., not
blocked on bg_cond_) it holds bg_mutex_.

InitType is called during benchmark setup only, so any contention induced for
the mutex should not have performance/accuracy consequences.
2014-05-05 09:45:27 -07:00
Chris Kennelly 77106c1f68 Statically initialize benchmark_mutex and extend its lifetime.
RunSpecifiedBenchmarks destroys benchmark_mutex before its last usage,
typically in RemoveBenchmark during cleanup of the BenchmarkFamilies singleton.
2014-05-05 09:42:13 -07:00
Chris Kennelly 54e18b8992 Resolve benchmark cleanup race condition in issue #20.
The multithreaded API for benchmarks provides that teardown can happen in
thread 0.  For this to be safe, all other threads executing the benchmark
function need to have exited.  Otherwise, thread 0 may begin to teardown shared
resources before the other threads have stopped using these resources as they
are in their last loop of while (KeepRunning()) { ... }.

This change creates a single exit point for KeepRunning() to return false.
When running a multithreaded benchmark, thread 0 blocks on KeepRunning() until
all other threads have exited.  This approach allows for there to be no change
to the user-facing API exemplified in the BM_MultiThreaded example.
2014-05-05 09:38:08 -07:00
Chris Kennelly 9f27edbb16 Resolve memory leak from benchmark instances in google/benchmark#17.
This shifts registration from a global vector to a singleton that manages
benchmark destruction during shutdown.
2014-04-23 01:17:47 -07:00
Chris Kennelly fa908926c7 Partially resolve google/benchmark#17 by fixing regular expression leak.
This adds a unit test to validate the wrapper without running the entirety of
benchmark_test.
2014-04-23 00:56:17 -07:00
Chris Kennelly e38fde6450 Setup targets from each directory, rather than the top-level. 2014-04-23 00:47:07 -07:00
Arne Beer feea2f022f Compile warning removed, adding myself to contributors 2014-04-06 22:03:51 +02:00
Arne Beer 50f459d2c0 Unable to compile because of unused parameter
There is a unused parameter at benchmark:866 Benchmark::MeasurePeakHeapMemory .
The function is marked as TODO and the code that uses the parameter is commented out.
I just removed the parameter so it can compile again without editing the CMake compile flags.
2014-04-06 16:42:24 +02:00
Felix Homann a7c57939c8 Fix cycleclock.h for gcc/ARM.
Currently there are tests for ARMV3 and ARMV6 in cycleclock.h which are not
defined using gcc on ARM. Since there is also a cast to the unknown type
int64 I assume that the ARM code has not been tested. Therefore this patch
replaces the checks for ARMV3 and ARMV6 by checks for __ARM_ARCH. Also, the
cast to int64 is fixed by casting to int64_t.
2014-03-18 17:04:40 +01:00
Yusuke Suzuki 45b79c3e01 Check families is not nullptr before using it
When there's no benchmarks, families becomes nullptr. So before touching
it, we need to ensure families is not nullptr.
2014-02-23 20:19:07 +09:00
Dominic Hamon be84ed0373 Remove old NOTEs 2014-01-21 19:27:04 -08:00
Eugene Zhuk 772ff6f1f1 [#4] Cleaned up FastClock background thread. 2014-01-20 23:18:25 -08:00
Eugene Zhuk ceea4cb380 [#4] A few minor changes. 2014-01-20 22:32:16 -08:00
Eugene Zhuk 4ed4ff9574 Fix shutting down FastClock's thread on OSX. 2014-01-18 00:50:45 -08:00
Dominic Hamon d184b2be2b Move linux-only variable into linux/cygwin block 2014-01-16 13:20:59 -08:00
Dominic Hamon e2633b9bd7 sysinfo conditional compilation fixes for OSX 2014-01-16 09:13:18 -08:00
Dominic Hamon c44662e7e9 Missing headers for sysctl stuff on OSX 2014-01-15 16:09:18 -08:00
Dominic Hamon 77cd9803ce add pedantic errors and fix them 2014-01-10 15:07:04 -08:00
Dominic Hamon 5a71bd6e66 More formatting tweaks 2014-01-09 12:19:02 -08:00
Dominic Hamon 78fa0b93ab Merged with upstream 2014-01-09 12:16:51 -08:00
Dominic Hamon 4ce184d86d Code reformat 2014-01-09 12:12:11 -08:00
Dominic Hamon 8009351938 Minimum iteration and overhead support.
Ensure we run at least 1 iteration.
Take into account overhead of an empty benchmark.
Minor cleanup of code.
2014-01-09 11:53:14 -08:00
Dominic Hamon 3fb8268eab Add LICENSE and copyright headers 2014-01-09 08:01:34 -08:00
Dominic Hamon 577f7410d1 Explicitly remove unsupported memory usage support 2014-01-08 09:11:50 -08:00
Dominic Hamon dc5b533adb Remove tunable estimate for cycles per second 2014-01-08 09:11:07 -08:00
Dominic Hamon acc65f48d3 Allow custom reporters 2014-01-07 16:33:40 -08:00
Dominic Hamon 2ff306af30 Fix right-alignment of items/s 2014-01-07 14:33:59 -08:00
Dominic Hamon fc52b86270 Remove dead code, tidy output 2014-01-07 13:45:50 -08:00
Dominic Hamon e5f5a0d30e Report mean/stddev times as mean/stddev 2014-01-07 13:33:45 -08:00
Dominic Hamon 2923a481ed Multithreaded tests are reenabled 2014-01-07 13:15:26 -08:00
Dominic Hamon 15bf66750c Really drop multithreading support 2013-12-20 15:10:46 -08:00
Dominic Hamon d44b01a9cc Merging in work from branch 2013-12-20 14:39:09 -08:00
Dominic Hamon 902fb91226 benchmark_repetitions now work 2013-12-20 14:38:15 -08:00
Dominic Hamon 3a6f24c67b benchmark_iterations works as expected 2013-12-19 17:21:34 -08:00
Dominic Hamon b3f0d71e50 benchmark_min_time now works as expected 2013-12-19 17:16:40 -08:00
Dominic Hamon d4ed240426 Added some missing atomics in FastClock 2013-12-19 17:04:54 -08:00
Dominic Hamon a94b0a6741 Remove duplicated macros header 2013-12-19 16:45:53 -08:00
Dominic Hamon 9a25f47250 Fix printing of time 2013-12-19 16:23:25 -08:00
Dominic Hamon e390e4ebc3 Adding benchmark namespace and removing broken flags 2013-12-19 16:18:09 -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