9 #ifndef CPPBENCHMARK_CONTEXT_H
10 #define CPPBENCHMARK_CONTEXT_H
41 int x() const noexcept {
return _x; }
43 int y() const noexcept {
return _y; }
45 int z() const noexcept {
return _z; }
96 _canceled(std::make_shared<std::atomic<bool>>(
false))
Benchmark running context.
void StopPhase() override
Stop measurement of the current phase.
Context(int x, int y, int z) noexcept
Create benchmark running context.
PhaseCore * _current
Current benchmark phase.
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.
int x() const noexcept
Benchmark first parameter. Valid only if not negative!
void Cancel() noexcept
Cancel benchmark execution.
std::shared_ptr< Phase > StartPhase(const std::string &phase) override
Start a new sub-phase with a given name in a single-thread environment.
Context(const Context &) noexcept=default
Context(Context &&) noexcept=default
std::shared_ptr< std::atomic< bool > > _canceled
Benchmark canceled flag.
PhaseMetrics & metrics() noexcept
Benchmark mutable metrics.
virtual std::string description() const
Get description of the current benchmark running context.
const PhaseMetrics & metrics() const noexcept override
Get phase metrics.
int y() const noexcept
Benchmark second parameter. Valid only if not negative!
PhaseMetrics * _metrics
Current benchmark metrics.
const std::string & name() const noexcept override
Get phase name.
std::shared_ptr< Phase > StartPhaseThreadSafe(const std::string &phase) override
Start a new sub-phase with a given name in a multi-thread environment.
bool canceled() const noexcept
Is benchmark execution canceled?
int _x
Benchmark first parameter. Valid only if not negative!
int _z
Benchmark third parameter. Valid only if not negative!
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.
int _y
Benchmark second parameter. Valid only if not negative!
int z() const noexcept
Benchmark third parameter. Valid only if not negative!
void StopPhase() override
Stop measurement of the current phase.
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.
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.
Benchmark phase base class.
C++ Benchmark project definitions.
Benchmark phase core definition.