aboutsummaryrefslogtreecommitdiff
path: root/src/bench/bench.h
diff options
context:
space:
mode:
authorGavin Andresen <gavinandresen@gmail.com>2015-09-29 17:17:24 -0400
committerGavin Andresen <gavinandresen@gmail.com>2015-09-30 09:24:42 -0400
commit7072c544b52774ac5a22835121e8e2747ad61158 (patch)
tree61bab3fc434f5c058ef43a73cf2cc3b4fd78661a /src/bench/bench.h
parent535ed9223dcb32bf90ead5b2c95052838b780620 (diff)
Support very-fast-running benchmarks
Avoid calling gettimeofday every time through the benchmarking loop, by keeping track of how long each loop takes and doubling the number of iterations done between time checks when they take less than 1/16'th of the total elapsed time.
Diffstat (limited to 'src/bench/bench.h')
-rw-r--r--src/bench/bench.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/bench/bench.h b/src/bench/bench.h
index fee9b8c38d..bf591a2be6 100644
--- a/src/bench/bench.h
+++ b/src/bench/bench.h
@@ -41,10 +41,12 @@ namespace benchmark {
double beginTime;
double lastTime, minTime, maxTime;
int64_t count;
+ int64_t timeCheckCount;
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();
+ timeCheckCount = 1;
}
bool KeepRunning();
};