本文整理汇总了C++中Test::AfterRun方法的典型用法代码示例。如果您正苦于以下问题:C++ Test::AfterRun方法的具体用法?C++ Test::AfterRun怎么用?C++ Test::AfterRun使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Test
的用法示例。
在下文中一共展示了Test::AfterRun方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RunAllTests
//.........这里部分代码省略.........
if (timeRunMax < time)
timeRunMax = time;
// Dispose of the test instance.
delete test;
}
// Calculate different metrics.
double timeRunAverage = double(timeTotal) / double(descriptor->Runs);
double runsPerSecondAverage = 1000000.0 / timeRunAverage;
double runsPerSecondMax = 1000000.0 / double(timeRunMin);
double runsPerSecondMin = 1000000.0 / double(timeRunMax);
double timeIterationAverage = timeRunAverage / double(descriptor->Iterations);
double timeIterationMin = double(timeRunMin) / double(descriptor->Iterations);
double timeIterationMax = double(timeRunMax) / double(descriptor->Iterations);
double iterationsPerSecondAverage = 1000000.0 / timeIterationAverage;
double iterationsPerSecondMax = 1000000.0 / timeIterationMin;
double iterationsPerSecondMin = 1000000.0 / timeIterationMax;
// Describe the end of the run.
std::cout << Console::TextGreen << "[ DONE ]"
<< Console::TextYellow << " "
<< descriptor->FixtureName << "."
<< descriptor->TestName
<< descriptor->Parameters
<< Console::TextDefault << " ("
<< (double(timeTotal) / 1000.0) << " ms)"
<< std::endl;
std::cout << Console::TextBlue << "[ RUNS ] "
<< Console::TextDefault
<< " Average time: " << timeRunAverage
<< " us" << std::endl;
PAD_DEVIATION_INVERSE("Fastest: ",
timeRunMin,
timeRunAverage,
"us");
PAD_DEVIATION_INVERSE("Slowest: ",
timeRunMax,
timeRunAverage,
"us");
PAD("");
PAD("Average performance: " << runsPerSecondAverage << " runs/s");
PAD_DEVIATION("Best performance: ",
runsPerSecondMax,
runsPerSecondAverage,
"runs/s");
PAD_DEVIATION("Worst performance: ",
runsPerSecondMin,
runsPerSecondAverage,
"runs/s");
std::cout << Console::TextBlue << "[ITERATIONS] "
<< Console::TextDefault
<< " Average time: " << timeIterationAverage
<< " us" << std::endl;
PAD_DEVIATION_INVERSE("Fastest: ",
timeIterationMin,
timeIterationAverage,
"us");
PAD_DEVIATION_INVERSE("Slowest: ",
timeIterationMax,
timeIterationAverage,
"us");
PAD("");
PAD("Average performance: " << iterationsPerSecondAverage << " iterations/s");
PAD_DEVIATION("Best performance: ",
iterationsPerSecondMax,
iterationsPerSecondAverage,
"iterations/s");
PAD_DEVIATION("Worst performance: ",
iterationsPerSecondMin,
iterationsPerSecondAverage,
"iterations/s");
hooks->AfterRun(
timeRunAverage,
runsPerSecondAverage, runsPerSecondMax, runsPerSecondMin,
timeIterationAverage, timeIterationMax, timeIterationMin,
iterationsPerSecondAverage, iterationsPerSecondMax, iterationsPerSecondMin
);
delete hooks;
}
#undef PAD
// Final output.
std::cout << Console::TextGreen << "[==========]"
<< Console::TextDefault << " Ran "
<< ran
<< (ran == 1 ?
" benchmark." :
" benchmarks.")
<< std::endl;
}