CppBenchmark 1.0.5.0
C++ Benchmark Library
Loading...
Searching...
No Matches
phase.h
Go to the documentation of this file.
1
9#ifndef CPPBENCHMARK_PHASE_H
10#define CPPBENCHMARK_PHASE_H
11
13
14#include <memory>
15
16namespace CppBenchmark {
17
18class PhaseScope;
19
21
25class Phase
26{
27public:
28 Phase() noexcept = default;
29 Phase(const Phase&) = default;
30 Phase(Phase&&) noexcept = default;
31 virtual ~Phase() = default;
32
33 Phase& operator=(const Phase&) = default;
34 Phase& operator=(Phase&&) noexcept = default;
35
37 virtual const std::string& name() const noexcept = 0;
39 virtual const PhaseMetrics& metrics() const noexcept = 0;
40
42
50 virtual std::shared_ptr<Phase> StartPhase(const std::string& phase) = 0;
51
53
60 virtual std::shared_ptr<Phase> StartPhaseThreadSafe(const std::string& phase) = 0;
61
63 virtual void StopPhase() = 0;
64
66
72 virtual std::shared_ptr<PhaseScope> ScopePhase(const std::string& phase) = 0;
73
75
81 virtual std::shared_ptr<PhaseScope> ScopePhaseThreadSafe(const std::string& phase) = 0;
82};
83
84} // namespace CppBenchmark
85
86#endif // CPPBENCHMARK_PHASE_H
Benchmark phase base class.
Definition phase.h:26
virtual const PhaseMetrics & metrics() const noexcept=0
Get phase metrics.
virtual const std::string & name() const noexcept=0
Get phase name.
virtual std::shared_ptr< PhaseScope > ScopePhase(const std::string &phase)=0
Start a new sub-phase with a given name in a single-thread environment and wrap it in a PhaseScope.
virtual std::shared_ptr< Phase > StartPhase(const std::string &phase)=0
Start a new sub-phase with a given name in a single-thread environment.
virtual std::shared_ptr< Phase > StartPhaseThreadSafe(const std::string &phase)=0
Start a new sub-phase with a given name in a multi-thread environment.
virtual void StopPhase()=0
Stop measurement of the current phase.
virtual std::shared_ptr< PhaseScope > ScopePhaseThreadSafe(const std::string &phase)=0
Start a new sub-phase with a given name in a multi-thread environment and wrap it in a PhaseScope.
Phase() noexcept=default
Benchmark phase metrics.
Benchmark phase scope.
Definition phase_scope.h:22
C++ Benchmark project definitions.
Definition barrier.h:15
Benchmark phase metrics definition.