CppBenchmark 1.0.6.0
C++ Benchmark Library
Loading...
Searching...
No Matches
CppBenchmark::ContextThreads Class Reference

Benchmark thread running context. More...

#include <context_threads.h>

Inheritance diagram for CppBenchmark::ContextThreads:
CppBenchmark::Context CppBenchmark::Phase

Public Member Functions

 ContextThreads ()=delete
 ContextThreads (const ContextThreads &) noexcept=default
 ContextThreads (ContextThreads &&) noexcept=default
virtual ~ContextThreads () noexcept=default
ContextThreads & operator= (const ContextThreads &) noexcept=default
ContextThreads & operator= (ContextThreads &&) noexcept=default
int threads () const noexcept
 Benchmark threads count.
std::string description () const override
 Get description of the current benchmark running context.
Public Member Functions inherited from CppBenchmark::Context
 Context ()=delete
 Context (const Context &) noexcept=default
 Context (Context &&) noexcept=default
virtual ~Context () noexcept=default
Context & operator= (const Context &) noexcept=default
Context & operator= (Context &&) noexcept=default
int x () const noexcept
 Benchmark first parameter. Valid only if not negative!
int y () const noexcept
 Benchmark second parameter. Valid only if not negative!
int z () const noexcept
 Benchmark third parameter. Valid only if not negative!
PhaseMetrics & metrics () noexcept
 Benchmark mutable metrics.
bool canceled () const noexcept
 Is benchmark execution canceled?
void Cancel () noexcept
 Cancel benchmark execution.
const std::string & name () const noexcept override
 Get phase name.
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.
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 StopPhase () override
 Stop measurement of the current phase.
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< 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.
Public Member Functions inherited from CppBenchmark::Phase
 Phase () noexcept=default
 Phase (const Phase &)=default
 Phase (Phase &&) noexcept=default
virtual ~Phase ()=default
Phase & operator= (const Phase &)=default
Phase & operator= (Phase &&) noexcept=default

Protected Member Functions

 ContextThreads (int threads, int x, int y, int z) noexcept
 Create benchmark running context.
Protected Member Functions inherited from CppBenchmark::Context
 Context (int x, int y, int z) noexcept
 Create benchmark running context.

Protected Attributes

int _threads
 Benchmark threads count.
Protected Attributes inherited from CppBenchmark::Context
int _x
 Benchmark first parameter. Valid only if not negative!
int _y
 Benchmark second parameter. Valid only if not negative!
int _z
 Benchmark third parameter. Valid only if not negative!
PhaseCore * _current
 Current benchmark phase.
PhaseMetrics * _metrics
 Current benchmark metrics.
std::shared_ptr< std::atomic< bool > > _canceled
 Benchmark canceled flag.

Friends

class BenchmarkThreads

Detailed Description

Benchmark thread running context.

Provides access to the current threads benchmark context information:

Definition at line 25 of file context_threads.h.

Constructor & Destructor Documentation

◆ ContextThreads() [1/4]

CppBenchmark::ContextThreads::ContextThreads ( )
delete

◆ ContextThreads() [2/4]

CppBenchmark::ContextThreads::ContextThreads ( const ContextThreads & )
defaultnoexcept

◆ ContextThreads() [3/4]

CppBenchmark::ContextThreads::ContextThreads ( ContextThreads && )
defaultnoexcept

◆ ~ContextThreads()

virtual CppBenchmark::ContextThreads::~ContextThreads ( )
virtualdefaultnoexcept

◆ ContextThreads() [4/4]

CppBenchmark::ContextThreads::ContextThreads ( int threads,
int x,
int y,
int z )
inlineprotectednoexcept

Create benchmark running context.

Parameters
threads- Benchmark threads count
x- Benchmark first parameter
y- Benchmark second parameter
z- Benchmark third parameter

Definition at line 55 of file context_threads.h.

Member Function Documentation

◆ description()

std::string CppBenchmark::ContextThreads::description ( ) const
overridevirtual

Get description of the current benchmark running context.

Reimplemented from CppBenchmark::Context.

Definition at line 13 of file context_threads.cpp.

◆ operator=() [1/2]

ContextThreads & CppBenchmark::ContextThreads::operator= ( const ContextThreads & )
defaultnoexcept

◆ operator=() [2/2]

ContextThreads & CppBenchmark::ContextThreads::operator= ( ContextThreads && )
defaultnoexcept

◆ threads()

int CppBenchmark::ContextThreads::threads ( ) const
inlinenoexcept

Benchmark threads count.

Definition at line 39 of file context_threads.h.

◆ BenchmarkThreads

friend class BenchmarkThreads
friend

Definition at line 27 of file context_threads.h.

Member Data Documentation

◆ _threads

int CppBenchmark::ContextThreads::_threads
protected

Benchmark threads count.

Definition at line 46 of file context_threads.h.


The documentation for this class was generated from the following files: