Commit Graph

29 Commits

Author SHA1 Message Date
jpmag
a9a66c85bb Add user-defined counters. (#262)
* Added user counters, and move use of bytes_processed and items_processed to user counter logic.

Each counter is a string-value pair. The counters were
made available through the State class. Two helper virtual
methods were added to the Fixture class to allow convenient
initialization and termination of the counters: InitState()
and TerminateState(). The reporting of the counters is buggy
and is still a work in progress, to be completed in the next commits.

* fix bad removal of BenchmarkCounters code during the merge

* add myself to AUTHORS/CONTRIBUTORS

* fix printing to std::cout in csv_reporter

* bytes_per_second and items_per_second are now in the UserCounters class

* add user counters to json reporter

* moving bytes_per_second and items_per_second to their old state

* console reporter dealing ok with user counters.

* update unit tests for user counters

* CSVReporter now prints user counters too.

* cleanup user counters

* reverted changes to cmake files which should have gone into later commits

* fixture_test: fix gcc 4.6 compilation

* remove ctor with default argument

see https://github.com/google/benchmark/pull/262#discussion_r72298055

* use (auto-defined) BENCHMARK_HAS_CXX11 instead of BENCHMARK_INITLIST.

https://github.com/google/benchmark/pull/262#discussion_r72298310

* leanify counters API

Discussions:
API complexity: https://github.com/google/benchmark/pull/262#discussion_r72298731
remove std::string dependency (WIP): https://github.com/google/benchmark/pull/262#discussion_r72298142
spacing & alignment: https://github.com/google/benchmark/pull/262#discussion_r72298422

* remove std::string dependency on public API - changed counter name storage to char*

* Counter ctor: use overloads instead of default arguments

discussion:
https://github.com/google/benchmark/pull/262#discussion_r72298055

* Use raw pointers to remove dependency on std::vector from public API .

For more info, see discussion at https://github.com/google/benchmark/pull/262#discussion_r72319678 .

* Move counter implementation from benchmark.cc to counter.cc.

    See discussion: https://github.com/google/benchmark/pull/262#discussion_r72298980 .

* Remove unused (commented-out) code.

* Moved thread counters to ThreadStats.

* Counters: fixed copy and move constructors.

* Counter: use an inplace buffer for small names.

* benchmark_test: move counters test out of CXX11 preprocessor conditional.

* Counter: fix VS2013 compilation error in char[] initialization.

* Fix typo.

* Expose counters from State.

See discussion: https://github.com/google/benchmark/pull/262#issuecomment-237156951

* Changed counters interface to map-like.

* Fix printing of user counters in ConsoleReporter.

* Applied clang-format to counter.cc and console_reporter.cc.

Command was `clang-format -style=Google -i counter.cc console_reporter.cc`
I also applied to all other files, but the changes were very
far-reaching so I rolled those back.

* Rename Counter::Flags_e to Counter::Flags

* Fix use of reserved names in Counter and BenchmarkCounters.

* Counter: Fix move ctor bug + change order of members.

* Fixture: remove tentative methods InitState() and TerminateState().

* Update fixture_test to the new Fixture interface.

* BenchmarkCounters: fixed a bug in the move ctor. Remove call to CHECK_LT().

CHECK_LT() was making the size_t lookup take ~double the time of a string lookup!

* BenchmarkCounters: add option to not print zero counters (defaults to false).

* Add test to compare counter storage and access with std::map.

* README: clarify cost of counter access modes.

* move counter access test to an own test.

* BenchmarkCounters: add move Insert()

* Counters access test: add accelerated lookup by name.

* Fix old range syntax.

* Fix missing include of cstdio

* Fix Visual Studio warning

* VS2013 and lower: fix use of snprintf()

* VS2013: fix use of char[] as a member of std::pair<>.

* change counter storage to std::map

* Remove skipZeroCounters logic

* Fix VS compilation error.

* Implemented request changes to PR #262.

* PR #262: More requested changes.

* README: cleanup counter text.

* PR #262: remove clang-format changes for preexisting code

* Complexity+Counters: fix counter flags which were being ignored.

* Document all Counter::Flag members

* fixed loss of counter values

* ConsoleReporter: remove tabular printing of user counters.

* ConsoleReporter: header printing should not be contingent on user counter names.

* Minor white space and alignment fixes.

* cxx03_test + counters: reuse the BM_empty() function.

* user counters: add note to README on how counters are gathered across threads
2017-03-01 17:23:42 -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
Albert Pretorius
74e82e822f Force DoNotOptimize operand to memory for both gcc and clang 2016-05-26 07:43:07 +01:00
Dominic Hamon
a86545874a Merge branch 'ismaelJimenez-complexity' 2016-05-24 13:15:55 -07:00
Eric Fiselier
f434ce3fb6 Add myself to the CONTRIBUTORS file 2016-05-23 12:59:12 -06:00
Ismael
290bd60289 Refactor for pull request 2016-05-21 11:51:42 +02:00
Billy Robert O'Neal III
fa8b2d6171 Add myself to the contributors list 2016-05-10 16:46:26 -07:00
Jussi Knuuttila
e253a28402 Manual timing support. 2016-05-05 23:24:13 +03:00
Kai Wolf
3a02c462c7 Add myself to the contributors list 2016-03-24 22:34:23 +01:00
Dominik Czarnota
d2917bcded Fixes #165: CustomArguments ret type in README
* adds myself to AUTHORS/CONTRIBUTORS
2015-11-30 16:15:00 +01:00
ryobg
13a67d20e6 Add myself to AUTHORS and CONTRIBUTORS as requested wrt Fix #159. 2015-11-06 20:10:50 +02:00
Zbigniew Skowron
cd2e633fe5 Fix get_git_version to use GIT_EXECUTABLE.
get_git_version CMake function uses 'git' command directly, instead of
GIT_EXECUTABLE variable. This causes CMake errors while generating
project files in environments, where 'git' command is not present
in PATH.
2015-10-18 02:13:37 +02:00
Tobias Ulvgard
c06da04bcf Adds Dirac Research and me as Author and Contributor 2015-10-07 17:28:00 +02:00
Kaito Udagawa
f72d24942a Add Kaito Udagawa to AUTHORS and CONTRIBUTORS 2015-06-16 22:45:57 +09:00
Evgeny Safronov
1bc73789e4 Update AUTHORS and CONTRIBUTORS. 2014-11-14 23:39:38 +04:00
zjx20
0fcd190cd6 Update CONTRIBUTORS 2014-10-05 16:13:35 +08:00
Matt Clarkson
4fae2944c7 Added Matt Clarkson as a contributor 2014-07-30 18:06:52 +01:00
Matt Clarkson
ace6464b28 Made AUTHORS and CONTRIBUTES alphabetical 2014-07-30 18:06:52 +01:00
Lei Xu
0b19192fb0 Add Lei Xu to AUTHORS and CONTRIBUTORS 2014-07-25 08:15:46 -07:00
Pierre Phaneuf
c7eb316e7e Add @predmond to the AUTHORS and CONTRIBUTORS files. 2014-07-23 17:18:40 +01:00
pleroy
556002bec1 Adding myself to the contributors 2014-06-04 21:18:52 +02:00
Chris Kennelly
193e4eb9a1 Add Chris Kennelly to the contributors list. 2014-04-22 20:07:37 -07:00
Shuo Chen
92b6f020ea Add Shuo Chen to CONTRIBUTORS. 2014-04-17 13:55:35 -07:00
Arne Beer
feea2f022f Compile warning removed, adding myself to contributors 2014-04-06 22:03:51 +02:00
Felix Homann
44b64c9370 Added AUTHOR/CONTRIBUTOR information. 2014-03-19 08:58:21 +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
Pierre Phaneuf
254a6f9a78 Christopher Seymour has signed the CLA. 2014-02-13 16:18:56 -05:00
Dominic Hamon
dbb0beff57 Update CONTRIBUTORS 2014-02-11 22:17:58 -08:00
Pierre Phaneuf
6200a22998 Add AUTHORS and CONTRIBUTORS files. 2014-02-10 18:32:08 -05:00