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.
const PhaseMetrics & metrics() const noexcept override
Get phase metrics.
PhaseCore * _current
Current benchmark phase.
PhaseMetrics & metrics() noexcept
Benchmark mutable metrics.
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.
const std::string & name() const noexcept override
Get phase name.
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.
Context(const Context &) noexcept=default
std::shared_ptr< Phase > StartPhaseThreadSafe(const std::string &phase) override
Start a new sub-phase with a given name in a multi-thread environment.
Context(Context &&) noexcept=default
std::shared_ptr< std::atomic< bool > > _canceled
Benchmark canceled flag.
virtual std::string description() const
Get description of the current benchmark running context.
int y() const noexcept
Benchmark second parameter. Valid only if not negative!
PhaseMetrics * _metrics
Current benchmark metrics.
std::shared_ptr< Phase > StartPhase(const std::string &phase) override
Start a new sub-phase with a given name in a single-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!
int _y
Benchmark second parameter. Valid only if not negative!
int z() const noexcept
Benchmark third parameter. Valid only if not negative!
const std::string & name() const noexcept override
Get phase name.
void StopPhase() override
Stop measurement of the current 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.
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.
const PhaseMetrics & metrics() const noexcept override
Get phase metrics.
std::shared_ptr< Phase > StartPhase(const std::string &phase) override
Start a new sub-phase with a given name in a single-thread environment.
Benchmark phase base class.
C++ Benchmark project definitions.
Benchmark phase core definition.