Benchmark phase scope.
More...
#include <phase_scope.h>
Benchmark phase scope.
Implements scope guard pattern for benchmark phase which stops attached benchmark phase on destructing instance. It also provides base Phase interface.
Definition at line 21 of file phase_scope.h.
◆ PhaseScope() [1/3]
CppBenchmark::PhaseScope::PhaseScope |
( |
const std::shared_ptr< Phase > & |
phase | ) |
|
|
inlineexplicitnoexcept |
Create benchmark phase scope and attach existing benchmark phase to it.
- Parameters
-
phase | - Attached benchmark phase |
Definition at line 28 of file phase_scope.h.
◆ PhaseScope() [2/3]
CppBenchmark::PhaseScope::PhaseScope |
( |
const PhaseScope & |
| ) |
|
|
defaultnoexcept |
◆ PhaseScope() [3/3]
CppBenchmark::PhaseScope::PhaseScope |
( |
PhaseScope && |
| ) |
|
|
defaultnoexcept |
◆ ~PhaseScope()
CppBenchmark::PhaseScope::~PhaseScope |
( |
| ) |
|
|
virtual |
◆ metrics()
const PhaseMetrics& CppBenchmark::PhaseScope::metrics |
( |
| ) |
const |
|
inlineoverridevirtualnoexcept |
◆ name()
const std::string& CppBenchmark::PhaseScope::name |
( |
| ) |
const |
|
inlineoverridevirtualnoexcept |
◆ operator bool()
CppBenchmark::PhaseScope::operator bool |
( |
| ) |
const |
|
inlineexplicitnoexcept |
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ ScopePhase()
std::shared_ptr< PhaseScope > CppBenchmark::PhaseScope::ScopePhase |
( |
const std::string & |
phase | ) |
|
|
overridevirtual |
Start a new sub-phase with a given name in a single-thread environment and wrap it in a PhaseScope.
Please note the method is not thread-safe and should not be called in multi-thread environment!
- Parameters
-
- Returns
- Shared pointer to the required benchmark sub-phase scope wrapper
Implements CppBenchmark::Phase.
Definition at line 44 of file phase_scope.cpp.
◆ ScopePhaseThreadSafe()
std::shared_ptr< PhaseScope > CppBenchmark::PhaseScope::ScopePhaseThreadSafe |
( |
const std::string & |
phase | ) |
|
|
overridevirtual |
Start a new sub-phase with a given name in a multi-thread environment and wrap it in a PhaseScope.
Please note the method is thread-safe and might be called in multi-thread environment!
- Parameters
-
- Returns
- Shared pointer to the required thread-safe benchmark sub-phase scope wrapper
Implements CppBenchmark::Phase.
Definition at line 49 of file phase_scope.cpp.
◆ StartPhase()
std::shared_ptr< Phase > CppBenchmark::PhaseScope::StartPhase |
( |
const std::string & |
phase | ) |
|
|
overridevirtual |
Start a new sub-phase with a given name in a single-thread environment.
This method will create or get existent sub-phase with a given name, start benchmark measurement and return it as a shared pointer. Please note the method is not thread-safe and should not be called in multi-thread environment!
- Parameters
-
- Returns
- Shared pointer to the required benchmark sub-phase
Implements CppBenchmark::Phase.
Definition at line 25 of file phase_scope.cpp.
◆ StartPhaseThreadSafe()
std::shared_ptr< Phase > CppBenchmark::PhaseScope::StartPhaseThreadSafe |
( |
const std::string & |
phase | ) |
|
|
overridevirtual |
Start a new sub-phase with a given name in a multi-thread environment.
This method will create or get existent sub-phase with a given name, start benchmark measurement and return it as a shared pointer. Please note the method is thread-safe and might be called in multi-thread environment!
- Parameters
-
- Returns
- Shared pointer to the thread safe benchmark sub-phase
Implements CppBenchmark::Phase.
Definition at line 30 of file phase_scope.cpp.
◆ StopPhase()
void CppBenchmark::PhaseScope::StopPhase |
( |
| ) |
|
|
overridevirtual |
The documentation for this class was generated from the following files: