本文整理汇总了C++中TestResult::IterationTimeAverage方法的典型用法代码示例。如果您正苦于以下问题:C++ TestResult::IterationTimeAverage方法的具体用法?C++ TestResult::IterationTimeAverage怎么用?C++ TestResult::IterationTimeAverage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestResult
的用法示例。
在下文中一共展示了TestResult::IterationTimeAverage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EndTest
virtual void EndTest(const std::string& fixtureName,
const std::string& testName,
const std::string& parameters,
const TestResult& result)
{
#define PAD(x) std::cout << std::setw(34) << x << std::endl;
#define PAD_DEVIATION(description, \
deviated, \
average, \
unit) \
{ \
double _d_ = \
double(deviated) - double(average); \
\
PAD(description << \
deviated << " " << unit << " (" << \
(deviated < average ? \
Console::TextRed : \
Console::TextGreen) << \
(deviated > average ? "+" : "") << \
_d_ << " " << unit << " / " << \
(deviated > average ? "+" : "") << \
(_d_ * 100.0 / average) << " %" << \
Console::TextDefault << ")"); \
}
#define PAD_DEVIATION_INVERSE(description, \
deviated, \
average, \
unit) \
{ \
double _d_ = \
double(deviated) - double(average); \
\
PAD(description << \
deviated << " " << unit << " (" << \
(deviated > average ? \
Console::TextRed : \
Console::TextGreen) << \
(deviated > average ? "+" : "") << \
_d_ << " " << unit << " / " << \
(deviated > average ? "+" : "") << \
(_d_ * 100.0 / average) << " %" << \
Console::TextDefault << ")"); \
}
std::cout << Console::TextGreen << "[ DONE ]"
<< Console::TextYellow << " "
<< fixtureName << "."
<< testName
<< parameters
<< Console::TextDefault << " ("
<< std::setprecision(6)
<< (result.TimeTotal() / 1000000.0) << " ms)"
<< std::endl;
std::cout << Console::TextBlue << "[ RUNS ] "
<< Console::TextDefault
<< " Average time: "
<< std::setprecision(3)
<< result.RunTimeAverage() / 1000.0 << " us"
<< std::endl;
PAD_DEVIATION_INVERSE("Fastest: ",
(result.RunTimeMinimum() / 1000.0),
(result.RunTimeAverage() / 1000.0),
"us");
PAD_DEVIATION_INVERSE("Slowest: ",
(result.RunTimeMaximum() / 1000.0),
(result.RunTimeAverage() / 1000.0),
"us");
std::cout << std::setprecision(5);
PAD("");
PAD("Average performance: " <<
result.RunsPerSecondAverage() << " runs/s");
PAD_DEVIATION("Best performance: ",
result.RunsPerSecondMaximum(),
result.RunsPerSecondAverage(),
"runs/s");
PAD_DEVIATION("Worst performance: ",
result.RunsPerSecondMinimum(),
result.RunsPerSecondAverage(),
"runs/s");
std::cout << Console::TextBlue << "[ITERATIONS] "
<< Console::TextDefault
<< std::setprecision(3)
<< " Average time: "
<< result.IterationTimeAverage() / 1000.0 << " us"
<< std::endl;
PAD_DEVIATION_INVERSE("Fastest: ",
(result.IterationTimeMinimum() / 1000.0),
(result.IterationTimeAverage() / 1000.0),
"us");
PAD_DEVIATION_INVERSE("Slowest: ",
(result.IterationTimeMaximum() / 1000.0),
(result.IterationTimeAverage() / 1000.0),
"us");
//.........这里部分代码省略.........