diff options
| author | Wladimir J. van der Laan <[email protected]> | 2016-11-22 10:22:08 +0100 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2016-11-22 12:20:57 +0100 |
| commit | 35328187463a7078b4206e394c21d5515929c7de (patch) | |
| tree | e310e5beca1e7ad006cb48423c64f72d6a4d00fd /src/bench/bench.h | |
| parent | Merge #9200: bench: Fix subtle counting issue when rescaling iteration count (diff) | |
| download | discoin-35328187463a7078b4206e394c21d5515929c7de.tar.xz discoin-35328187463a7078b4206e394c21d5515929c7de.zip | |
bench: Add support for measuring CPU cycles
This adds cycle min/max/avg to the statistics.
Supported on x86 and x86_64 (natively through rdtsc), as well as Linux
(perf syscall).
Diffstat (limited to 'src/bench/bench.h')
| -rw-r--r-- | src/bench/bench.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/bench/bench.h b/src/bench/bench.h index f13b145aa..caf73e949 100644 --- a/src/bench/bench.h +++ b/src/bench/bench.h @@ -41,12 +41,18 @@ namespace benchmark { double maxElapsed; double beginTime; double lastTime, minTime, maxTime, countMaskInv; - int64_t count; - int64_t countMask; + uint64_t count; + uint64_t countMask; + uint64_t beginCycles; + uint64_t lastCycles; + uint64_t minCycles; + uint64_t maxCycles; public: State(std::string _name, double _maxElapsed) : name(_name), maxElapsed(_maxElapsed), count(0) { minTime = std::numeric_limits<double>::max(); maxTime = std::numeric_limits<double>::min(); + minCycles = std::numeric_limits<uint64_t>::max(); + maxCycles = std::numeric_limits<uint64_t>::min(); countMask = 1; countMaskInv = 1./(countMask + 1); } |