当前位置: 首页>>代码示例>>C++>>正文


C++ Test::AfterRun方法代码示例

本文整理汇总了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;
        }
开发者ID:nevkontakte,项目名称:hayai,代码行数:101,代码来源:hayai-benchmarker.hpp


注:本文中的Test::AfterRun方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。