9 #ifndef CPPBENCHMARK_PHASE_CORE_H
10 #define CPPBENCHMARK_PHASE_CORE_H
53 const std::string&
name() const noexcept
override {
return _name; }
55 std::shared_ptr<Phase>
StartPhase(
const std::string& phase)
override;
58 std::shared_ptr<PhaseScope>
ScopePhase(
const std::string& phase)
override
59 {
return std::make_shared<PhaseScope>(
StartPhase(phase)); }
71 std::vector<std::shared_ptr<PhaseCore>>
_child;
Producers/Consumers benchmark base class.
Threads benchmark base class.
Dynamic benchmarks executor class.
PhaseCore(const PhaseCore &)=delete
void InitLatencyHistogram(const std::tuple< int64_t, int64_t, int > &latency) noexcept
Initialize latency histogram for the current phase.
void StopPhase() override
Stop measurement of the current phase.
PhaseCore(const std::string &name)
Create a new benchmark phase core with a given name.
PhaseMetrics _metrics_current
Current phase metrics.
void PrintLatencyHistogram(FILE *file, int32_t resolution) const noexcept
Print result latency histogram.
void ResetMetrics() noexcept
Reset current phase metrics.
const std::string & name() const noexcept override
Get phase name.
std::shared_ptr< PhaseScope > ScopePhaseThreadSafe(const std::string &phase) override
Start a new sub-phase with a given name in a multi-thread environment and wrap it in a PhaseScope.
std::shared_ptr< Phase > StartPhaseThreadSafe(const std::string &phase) override
Start a new sub-phase with a given name in a multi-thread environment.
void StopCollectingMetrics() noexcept
Stop collecting metrics in the current phase.
PhaseMetrics _metrics_result
Result phase metrics.
virtual ~PhaseCore()=default
PhaseCore & operator=(const PhaseCore &)=delete
PhaseCore & operator=(PhaseCore &&)=delete
std::shared_ptr< PhaseScope > ScopePhase(const std::string &phase) override
Start a new sub-phase with a given name in a single-thread environment and wrap it in a PhaseScope.
std::shared_ptr< Phase > StartPhase(const std::string &phase) override
Start a new sub-phase with a given name in a single-thread environment.
const PhaseMetrics & metrics() const noexcept override
Get phase metrics.
PhaseMetrics & current()
Current benchmark phase metrics.
uint64_t _thread
Thread Id.
void MergeMetrics(PhaseCore &phase)
Merge metrics of the two phases.
std::string _name
Phase name.
std::vector< std::shared_ptr< PhaseCore > > _child
Child phases container.
std::mutex _mutex
Synchronization mutex.
void StartCollectingMetrics() noexcept
Start collecting metrics in the current phase.
PhaseCore(PhaseCore &&)=delete
void MergeMetrics()
Merge phase metrics (current to result)
Benchmark phase base class.
System management static class.
C++ Benchmark project definitions.
Benchmark phase metrics definition.
Benchmark phase scope definition.
System management definition.