17 std::shared_ptr<PhaseCore> result;
20 auto it = std::find_if(
_child.begin(),
_child.end(), [&phase](
const std::shared_ptr<PhaseCore>& item) { return item->name() == phase; });
23 result = std::make_shared<PhaseCore>(phase);
24 _child.emplace_back(result);
30 result->StartCollectingMetrics();
33 result->_metrics_current.AddOperations(1);
40 std::shared_ptr<PhaseCore> result;
44 std::scoped_lock lock(
_mutex);
47 auto it = std::find_if(
_child.begin(),
_child.end(), [&phase](
const std::shared_ptr<PhaseCore>& item)
49 return ((item->name() == phase) && (item->_thread == System::CurrentThreadId()));
53 result = std::make_shared<PhaseCore>(phase);
54 _child.emplace_back(result);
61 result->StartCollectingMetrics();
64 result->_metrics_current.AddOperations(1);
std::shared_ptr< Phase > StartPhaseThreadSafe(const std::string &phase) override
Start a new sub-phase with a given name in a multi-thread environment.
std::shared_ptr< Phase > StartPhase(const std::string &phase) override
Start a new sub-phase with a given name in a single-thread environment.
std::vector< std::shared_ptr< PhaseCore > > _child
Child phases container.
std::mutex _mutex
Synchronization mutex.
C++ Benchmark project definitions.
Benchmark phase core definition.