本文整理汇总了C++中Benchmark::cleanup方法的典型用法代码示例。如果您正苦于以下问题:C++ Benchmark::cleanup方法的具体用法?C++ Benchmark::cleanup怎么用?C++ Benchmark::cleanup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Benchmark
的用法示例。
在下文中一共展示了Benchmark::cleanup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
/**
Runs a benchmark.
It runs it a couple of times just to warm everything up, and then
does num_trials iterations of the benchmark for time.
*/
void SimpleBenchmarkRunner::run(Benchmark &bench) {
bench.setup();
// Warm up.
bench.run_iteration();
bench.run_iteration();
bench.finish_iteration();
// okay, now for time.
uint64_t start1 = nanotime();
for(int i = 0; i < mNumTrials; ++i) {
bench.finish_iteration();
}
uint64_t stop1 = nanotime();
uint64_t start2 = nanotime();
for(int i = 0; i < mNumTrials; ++i) {
bench.run_iteration();
bench.finish_iteration();
}
uint64_t stop2 = nanotime();
mTotalTime = (stop2 - start2) - (stop1 - start1);
bench.cleanup();
}