| 23 | } |
| 24 | |
| 25 | void ThroughputTestSession::run() |
| 26 | { |
| 27 | auto testInstance = m_testInfo.factory(); |
| 28 | |
| 29 | checkProcessorsRequirements(testInstance); |
| 30 | |
| 31 | std::cout << "Throughput Test to run => " << m_testInfo.name << ", Runs => " << m_runs << std::endl; |
| 32 | std::cout << "Starting throughput tests" << std::endl; |
| 33 | |
| 34 | Stopwatch stopwatch; |
| 35 | |
| 36 | for (auto i = 0; i < m_runs; i++) |
| 37 | { |
| 38 | stopwatch.reset(); |
| 39 | |
| 40 | std::int64_t totalOperationsInRun; |
| 41 | |
| 42 | try |
| 43 | { |
| 44 | totalOperationsInRun = testInstance->run(stopwatch); |
| 45 | } |
| 46 | catch (std::exception& ex) |
| 47 | { |
| 48 | ThroughputTestSessionResult result(ex); |
| 49 | std::cout << result.toString() << std::endl; |
| 50 | |
| 51 | m_results.push_back(result); |
| 52 | continue; |
| 53 | } |
| 54 | |
| 55 | ThroughputTestSessionResult result(totalOperationsInRun, stopwatch.elapsed()); |
| 56 | std::cout << result.toString() << std::endl; |
| 57 | |
| 58 | m_results.push_back(result); |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | std::int64_t ThroughputTestSession::getAverageThroughput() |
| 63 | { |