| 47 | } |
| 48 | |
| 49 | void BenchmarkBase::UpdateBenchmarkThreads(std::vector<std::shared_ptr<PhaseCore>>& phases) |
| 50 | { |
| 51 | // Merge benchmark phases with a same name for different threads |
| 52 | for (auto it = phases.begin(); it != phases.end(); ++it) |
| 53 | { |
| 54 | for (auto next = it + 1; next != phases.end(); ++next) |
| 55 | { |
| 56 | if ((*it)->name() == (*next)->name()) |
| 57 | { |
| 58 | // Merge metrics results |
| 59 | (*it)->MergeMetrics(**next); |
| 60 | |
| 61 | // Append child phases |
| 62 | (*it)->_child.insert((*it)->_child.end(), (*next)->_child.begin(), (*next)->_child.end()); |
| 63 | |
| 64 | // Mark to delete |
| 65 | (*next)->_thread = 0; |
| 66 | } |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | // Remove phases marked to delete |
| 71 | phases.erase(std::remove_if(phases.begin(), phases.end(), [](const std::shared_ptr<PhaseCore>& p) { return p->_thread == 0; }), phases.end()); |
| 72 | |
| 73 | // Perform the same operation for child phases |
| 74 | for (const auto& phase : phases) |
| 75 | UpdateBenchmarkThreads(phase->_child); |
| 76 | } |
| 77 | |
| 78 | void BenchmarkBase::UpdateBenchmarkNames(std::vector<std::shared_ptr<PhaseCore>>& phases) |
| 79 | { |
nothing calls this directly
no test coverage detected