Classes | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | Friends | List of all members
benchmark::State Class Reference

#include <benchmark.h>

Classes

class  Iterator
 
struct  StateIterator
 

Public Member Functions

Iterator begin ()
 
BENCHMARK_ALWAYS_INLINE StateIterator begin ()
 
BENCHMARK_ALWAYS_INLINE size_t bytes_processed () const
 
BENCHMARK_ALWAYS_INLINE size_t bytes_processed () const
 
BENCHMARK_ALWAYS_INLINE int64_t bytes_processed () const
 
BENCHMARK_ALWAYS_INLINE int complexity_length_n ()
 
BENCHMARK_ALWAYS_INLINE int complexity_length_n ()
 
BENCHMARK_ALWAYS_INLINE int64_t complexity_length_n () const
 
Iterator end ()
 
BENCHMARK_ALWAYS_INLINE StateIterator end ()
 
bool error_occurred () const
 
BENCHMARK_ALWAYS_INLINE size_t items_processed () const
 
BENCHMARK_ALWAYS_INLINE size_t items_processed () const
 
BENCHMARK_ALWAYS_INLINE int64_t items_processed () const
 
int64_t iterations () const
 
BENCHMARK_ALWAYS_INLINE size_t iterations () const
 
BENCHMARK_ALWAYS_INLINE size_t iterations () const
 
BENCHMARK_ALWAYS_INLINE IterationCount iterations () const
 
bool KeepRunning ()
 
bool KeepRunning ()
 
bool KeepRunning ()
 
bool KeepRunningBatch (IterationCount n)
 
void PauseTiming ()
 
void PauseTiming ()
 
void PauseTiming ()
 
int64_t range (int pos) const
 
BENCHMARK_ALWAYS_INLINE int range (std::size_t pos=0) const
 
BENCHMARK_ALWAYS_INLINE int range (std::size_t pos=0) const
 
BENCHMARK_ALWAYS_INLINE int64_t range (std::size_t pos=0) const
 
int range_x () const
 
int range_x () const
 
int64_t range_x () const
 
int range_y () const
 
int range_y () const
 
int64_t range_y () const
 
void ResumeTiming ()
 
void ResumeTiming ()
 
void ResumeTiming ()
 
void SetBytesProcessed (int64_t b)
 
BENCHMARK_ALWAYS_INLINE void SetBytesProcessed (int64_t bytes)
 
BENCHMARK_ALWAYS_INLINE void SetBytesProcessed (size_t bytes)
 
BENCHMARK_ALWAYS_INLINE void SetBytesProcessed (size_t bytes)
 
BENCHMARK_ALWAYS_INLINE void SetComplexityN (int complexity_n)
 
BENCHMARK_ALWAYS_INLINE void SetComplexityN (int complexity_n)
 
BENCHMARK_ALWAYS_INLINE void SetComplexityN (int64_t complexity_n)
 
void SetItemsProcessed (int64_t i)
 
BENCHMARK_ALWAYS_INLINE void SetItemsProcessed (int64_t items)
 
BENCHMARK_ALWAYS_INLINE void SetItemsProcessed (size_t items)
 
BENCHMARK_ALWAYS_INLINE void SetItemsProcessed (size_t items)
 
void SetIterationTime (double seconds)
 
void SetIterationTime (double seconds)
 
void SetIterationTime (double seconds)
 
void SetLabel (const char *label)
 
void SetLabel (const char *label)
 
void SetLabel (const char *label)
 
void BENCHMARK_ALWAYS_INLINE SetLabel (const std::string &str)
 
void BENCHMARK_ALWAYS_INLINE SetLabel (const std::string &str)
 
void BENCHMARK_ALWAYS_INLINE SetLabel (const std::string &str)
 
void SkipWithError (const char *msg)
 
void SkipWithError (const char *msg)
 
void SkipWithError (const char *msg)
 
 State (int64_t iters)
 
 State (int64_t iters, int64_t arg)
 
 State (size_t max_iters, const std::vector< int > &ranges, int thread_i, int n_threads, internal::ThreadTimer *timer, internal::ThreadManager *manager)
 
 State (size_t max_iters, const std::vector< int > &ranges, int thread_i, int n_threads, internal::ThreadTimer *timer, internal::ThreadManager *manager)
 
BENCHMARK_ALWAYS_INLINE int thread_index () const
 
BENCHMARK_ALWAYS_INLINE int threads () const
 

Public Attributes

UserCounters counters
 
const size_t max_iterations
 
const IterationCount max_iterations
 
const int thread_index
 
const int threads
 

Private Member Functions

 BENCHMARK_DISALLOW_COPY_AND_ASSIGN (State)
 
 BENCHMARK_DISALLOW_COPY_AND_ASSIGN (State)
 
void FinishKeepRunning ()
 
void FinishKeepRunning ()
 
void FinishKeepRunning ()
 
bool KeepRunningInternal (IterationCount n, bool is_batch)
 
Stateoperator= (const State &)=delete
 
void StartKeepRunning ()
 
void StartKeepRunning ()
 
void StartKeepRunning ()
 
 State (const State &)=delete
 
 State (IterationCount max_iters, const std::vector< int64_t > &ranges, int thread_i, int n_threads, internal::ThreadTimer *timer, internal::ThreadManager *manager, internal::PerfCountersMeasurement *perf_counters_measurement)
 

Private Attributes

int64_t arg_
 
IterationCount batch_leftover_
 
size_t bytes_processed_
 
int complexity_n_
 
int64_t complexity_n_
 
bool error_occurred_
 
bool finished_
 
bool has_arg_
 
size_t items_processed_
 
int64_t iters_
 
internal::ThreadManagermanager_
 
internal::ThreadManager *const manager_
 
internal::PerfCountersMeasurement *const perf_counters_measurement_
 
std::vector< intrange_
 
std::vector< int64_trange_
 
bool started_
 
const int thread_index_
 
const int threads_
 
internal::ThreadTimertimer_
 
internal::ThreadTimer *const timer_
 
size_t total_iterations_
 
IterationCount total_iterations_
 

Friends

class internal::BenchmarkInstance
 
struct StateIterator
 

Detailed Description

Definition at line 503 of file benchmark/include/benchmark/benchmark.h.

Constructor & Destructor Documentation

◆ State() [1/6]

benchmark::State::State ( IterationCount  max_iters,
const std::vector< int64_t > &  ranges,
int  thread_i,
int  n_threads,
internal::ThreadTimer timer,
internal::ThreadManager manager,
internal::PerfCountersMeasurement perf_counters_measurement 
)
private

Definition at line 136 of file benchmark/src/benchmark.cc.

◆ State() [2/6]

benchmark::State::State ( size_t  max_iters,
const std::vector< int > &  ranges,
int  thread_i,
int  n_threads,
internal::ThreadTimer timer,
internal::ThreadManager manager 
)

◆ State() [3/6]

benchmark::State::State ( size_t  max_iters,
const std::vector< int > &  ranges,
int  thread_i,
int  n_threads,
internal::ThreadTimer timer,
internal::ThreadManager manager 
)

◆ State() [4/6]

benchmark::State::State ( int64_t  iters)
inlineexplicit

Definition at line 63 of file re2/util/benchmark.h.

◆ State() [5/6]

benchmark::State::State ( int64_t  iters,
int64_t  arg 
)
inline

Definition at line 66 of file re2/util/benchmark.h.

◆ State() [6/6]

benchmark::State::State ( const State )
privatedelete

Member Function Documentation

◆ begin() [1/2]

Iterator benchmark::State::begin ( )
inline

Definition at line 69 of file re2/util/benchmark.h.

◆ begin() [2/2]

BENCHMARK_ALWAYS_INLINE State::StateIterator benchmark::State::begin ( )
inline

Definition at line 816 of file benchmark/include/benchmark/benchmark.h.

◆ BENCHMARK_DISALLOW_COPY_AND_ASSIGN() [1/2]

benchmark::State::BENCHMARK_DISALLOW_COPY_AND_ASSIGN ( State  )
private

◆ BENCHMARK_DISALLOW_COPY_AND_ASSIGN() [2/2]

benchmark::State::BENCHMARK_DISALLOW_COPY_AND_ASSIGN ( State  )
private

◆ bytes_processed() [1/3]

BENCHMARK_ALWAYS_INLINE size_t benchmark::State::bytes_processed ( ) const
inline

◆ bytes_processed() [2/3]

BENCHMARK_ALWAYS_INLINE size_t benchmark::State::bytes_processed ( ) const
inline

◆ bytes_processed() [3/3]

BENCHMARK_ALWAYS_INLINE int64_t benchmark::State::bytes_processed ( ) const
inline

Definition at line 607 of file benchmark/include/benchmark/benchmark.h.

◆ complexity_length_n() [1/3]

BENCHMARK_ALWAYS_INLINE int benchmark::State::complexity_length_n ( )
inline

◆ complexity_length_n() [2/3]

BENCHMARK_ALWAYS_INLINE int benchmark::State::complexity_length_n ( )
inline

◆ complexity_length_n() [3/3]

BENCHMARK_ALWAYS_INLINE int64_t benchmark::State::complexity_length_n ( ) const
inline

Definition at line 622 of file benchmark/include/benchmark/benchmark.h.

◆ end() [1/2]

Iterator benchmark::State::end ( )
inline

Definition at line 75 of file re2/util/benchmark.h.

◆ end() [2/2]

BENCHMARK_ALWAYS_INLINE State::StateIterator benchmark::State::end ( )
inline

Definition at line 819 of file benchmark/include/benchmark/benchmark.h.

◆ error_occurred()

bool benchmark::State::error_occurred ( ) const
inline

Definition at line 584 of file benchmark/include/benchmark/benchmark.h.

◆ FinishKeepRunning() [1/3]

void benchmark::State::FinishKeepRunning ( )
private

◆ FinishKeepRunning() [2/3]

void benchmark::State::FinishKeepRunning ( )
private

◆ FinishKeepRunning() [3/3]

void benchmark::State::FinishKeepRunning ( )
private

Definition at line 237 of file benchmark/src/benchmark.cc.

◆ items_processed() [1/3]

BENCHMARK_ALWAYS_INLINE size_t benchmark::State::items_processed ( ) const
inline

◆ items_processed() [2/3]

BENCHMARK_ALWAYS_INLINE size_t benchmark::State::items_processed ( ) const
inline

◆ items_processed() [3/3]

BENCHMARK_ALWAYS_INLINE int64_t benchmark::State::items_processed ( ) const
inline

Definition at line 637 of file benchmark/include/benchmark/benchmark.h.

◆ iterations() [1/4]

int64_t benchmark::State::iterations ( ) const
inline

Definition at line 81 of file re2/util/benchmark.h.

◆ iterations() [2/4]

BENCHMARK_ALWAYS_INLINE size_t benchmark::State::iterations ( ) const
inline

◆ iterations() [3/4]

BENCHMARK_ALWAYS_INLINE size_t benchmark::State::iterations ( ) const
inline

◆ iterations() [4/4]

BENCHMARK_ALWAYS_INLINE IterationCount benchmark::State::iterations ( ) const
inline

Definition at line 683 of file benchmark/include/benchmark/benchmark.h.

◆ KeepRunning() [1/3]

bool benchmark::State::KeepRunning ( )
inline

◆ KeepRunning() [2/3]

bool benchmark::State::KeepRunning ( )
inline

◆ KeepRunning() [3/3]

BENCHMARK_ALWAYS_INLINE bool benchmark::State::KeepRunning ( )
inline

Definition at line 740 of file benchmark/include/benchmark/benchmark.h.

◆ KeepRunningBatch()

BENCHMARK_ALWAYS_INLINE bool benchmark::State::KeepRunningBatch ( IterationCount  n)
inline

Definition at line 744 of file benchmark/include/benchmark/benchmark.h.

◆ KeepRunningInternal()

BENCHMARK_ALWAYS_INLINE bool benchmark::State::KeepRunningInternal ( IterationCount  n,
bool  is_batch 
)
inlineprivate

Definition at line 748 of file benchmark/include/benchmark/benchmark.h.

◆ operator=()

State& benchmark::State::operator= ( const State )
privatedelete

◆ PauseTiming() [1/3]

void benchmark::State::PauseTiming ( )

◆ PauseTiming() [2/3]

void benchmark::State::PauseTiming ( )

◆ PauseTiming() [3/3]

void benchmark::State::PauseTiming ( )

Definition at line 183 of file benchmark/src/benchmark.cc.

◆ range() [1/4]

int64_t benchmark::State::range ( int  pos) const
inline

Definition at line 83 of file re2/util/benchmark.h.

◆ range() [2/4]

BENCHMARK_ALWAYS_INLINE int benchmark::State::range ( std::size_t  pos = 0) const
inline

◆ range() [3/4]

BENCHMARK_ALWAYS_INLINE int benchmark::State::range ( std::size_t  pos = 0) const
inline

◆ range() [4/4]

BENCHMARK_ALWAYS_INLINE int64_t benchmark::State::range ( std::size_t  pos = 0) const
inline

Definition at line 663 of file benchmark/include/benchmark/benchmark.h.

◆ range_x() [1/3]

int benchmark::State::range_x ( ) const
inline

◆ range_x() [2/3]

int benchmark::State::range_x ( ) const
inline

◆ range_x() [3/3]

int64_t benchmark::State::range_x ( ) const
inline

Definition at line 669 of file benchmark/include/benchmark/benchmark.h.

◆ range_y() [1/3]

int benchmark::State::range_y ( ) const
inline

◆ range_y() [2/3]

int benchmark::State::range_y ( ) const
inline

◆ range_y() [3/3]

int64_t benchmark::State::range_y ( ) const
inline

Definition at line 672 of file benchmark/include/benchmark/benchmark.h.

◆ ResumeTiming() [1/3]

void benchmark::State::ResumeTiming ( )

◆ ResumeTiming() [2/3]

void benchmark::State::ResumeTiming ( )

◆ ResumeTiming() [3/3]

void benchmark::State::ResumeTiming ( )

Definition at line 198 of file benchmark/src/benchmark.cc.

◆ SetBytesProcessed() [1/4]

void benchmark::State::SetBytesProcessed ( int64_t  b)
inline

Definition at line 79 of file re2/util/benchmark.h.

◆ SetBytesProcessed() [2/4]

BENCHMARK_ALWAYS_INLINE void benchmark::State::SetBytesProcessed ( int64_t  bytes)
inline

Definition at line 601 of file benchmark/include/benchmark/benchmark.h.

◆ SetBytesProcessed() [3/4]

BENCHMARK_ALWAYS_INLINE void benchmark::State::SetBytesProcessed ( size_t  bytes)
inline

◆ SetBytesProcessed() [4/4]

BENCHMARK_ALWAYS_INLINE void benchmark::State::SetBytesProcessed ( size_t  bytes)
inline

◆ SetComplexityN() [1/3]

BENCHMARK_ALWAYS_INLINE void benchmark::State::SetComplexityN ( int  complexity_n)
inline

◆ SetComplexityN() [2/3]

BENCHMARK_ALWAYS_INLINE void benchmark::State::SetComplexityN ( int  complexity_n)
inline

◆ SetComplexityN() [3/3]

BENCHMARK_ALWAYS_INLINE void benchmark::State::SetComplexityN ( int64_t  complexity_n)
inline

Definition at line 619 of file benchmark/include/benchmark/benchmark.h.

◆ SetItemsProcessed() [1/4]

void benchmark::State::SetItemsProcessed ( int64_t  i)
inline

Definition at line 80 of file re2/util/benchmark.h.

◆ SetItemsProcessed() [2/4]

BENCHMARK_ALWAYS_INLINE void benchmark::State::SetItemsProcessed ( int64_t  items)
inline

Definition at line 631 of file benchmark/include/benchmark/benchmark.h.

◆ SetItemsProcessed() [3/4]

BENCHMARK_ALWAYS_INLINE void benchmark::State::SetItemsProcessed ( size_t  items)
inline

◆ SetItemsProcessed() [4/4]

BENCHMARK_ALWAYS_INLINE void benchmark::State::SetItemsProcessed ( size_t  items)
inline

◆ SetIterationTime() [1/3]

void benchmark::State::SetIterationTime ( double  seconds)

◆ SetIterationTime() [2/3]

void benchmark::State::SetIterationTime ( double  seconds)

◆ SetIterationTime() [3/3]

void benchmark::State::SetIterationTime ( double  seconds)

Definition at line 220 of file benchmark/src/benchmark.cc.

◆ SetLabel() [1/6]

void benchmark::State::SetLabel ( const char *  label)

◆ SetLabel() [2/6]

void benchmark::State::SetLabel ( const char *  label)

◆ SetLabel() [3/6]

void benchmark::State::SetLabel ( const char *  label)

Definition at line 224 of file benchmark/src/benchmark.cc.

◆ SetLabel() [4/6]

void BENCHMARK_ALWAYS_INLINE benchmark::State::SetLabel ( const std::string &  str)
inline

◆ SetLabel() [5/6]

void BENCHMARK_ALWAYS_INLINE benchmark::State::SetLabel ( const std::string &  str)
inline

◆ SetLabel() [6/6]

void BENCHMARK_ALWAYS_INLINE benchmark::State::SetLabel ( const std::string &  str)
inline

Definition at line 657 of file benchmark/include/benchmark/benchmark.h.

◆ SkipWithError() [1/3]

void benchmark::State::SkipWithError ( const char *  msg)

◆ SkipWithError() [2/3]

void benchmark::State::SkipWithError ( const char *  msg)

◆ SkipWithError() [3/3]

void benchmark::State::SkipWithError ( const char *  msg)

Definition at line 206 of file benchmark/src/benchmark.cc.

◆ StartKeepRunning() [1/3]

void benchmark::State::StartKeepRunning ( )
private

◆ StartKeepRunning() [2/3]

void benchmark::State::StartKeepRunning ( )
private

◆ StartKeepRunning() [3/3]

void benchmark::State::StartKeepRunning ( )
private

Definition at line 229 of file benchmark/src/benchmark.cc.

◆ thread_index()

BENCHMARK_ALWAYS_INLINE int benchmark::State::thread_index ( ) const
inline

Definition at line 680 of file benchmark/include/benchmark/benchmark.h.

◆ threads()

BENCHMARK_ALWAYS_INLINE int benchmark::State::threads ( ) const
inline

Definition at line 676 of file benchmark/include/benchmark/benchmark.h.

Friends And Related Function Documentation

◆ internal::BenchmarkInstance

friend class internal::BenchmarkInstance
friend

Definition at line 737 of file benchmark/include/benchmark/benchmark.h.

◆ StateIterator

friend struct StateIterator
friend

Definition at line 505 of file benchmark/include/benchmark/benchmark.h.

Member Data Documentation

◆ arg_

int64_t benchmark::State::arg_
private

Definition at line 87 of file re2/util/benchmark.h.

◆ batch_leftover_

IterationCount benchmark::State::batch_leftover_
private

Definition at line 699 of file benchmark/include/benchmark/benchmark.h.

◆ bytes_processed_

size_t benchmark::State::bytes_processed_
private

◆ complexity_n_ [1/2]

int benchmark::State::complexity_n_
private

◆ complexity_n_ [2/2]

int benchmark::State::complexity_n_
private

Definition at line 712 of file benchmark/include/benchmark/benchmark.h.

◆ counters

UserCounters benchmark::State::counters

Definition at line 716 of file benchmark/include/benchmark/benchmark.h.

◆ error_occurred_

bool benchmark::State::error_occurred_
private

Definition at line 707 of file benchmark/include/benchmark/benchmark.h.

◆ finished_

bool benchmark::State::finished_
private

Definition at line 706 of file benchmark/include/benchmark/benchmark.h.

◆ has_arg_

bool benchmark::State::has_arg_
private

Definition at line 88 of file re2/util/benchmark.h.

◆ items_processed_

size_t benchmark::State::items_processed_
private

◆ iters_

int64_t benchmark::State::iters_
private

Definition at line 86 of file re2/util/benchmark.h.

◆ manager_ [1/2]

internal::ThreadManager* benchmark::State::manager_
private

◆ manager_ [2/2]

internal::ThreadManager * benchmark::State::manager_
private

Definition at line 734 of file benchmark/include/benchmark/benchmark.h.

◆ max_iterations [1/2]

const size_t benchmark::State::max_iterations

◆ max_iterations [2/2]

const size_t benchmark::State::max_iterations

Definition at line 702 of file benchmark/include/benchmark/benchmark.h.

◆ perf_counters_measurement_

internal::PerfCountersMeasurement* const benchmark::State::perf_counters_measurement_
private

Definition at line 735 of file benchmark/include/benchmark/benchmark.h.

◆ range_ [1/2]

std::vector<int> benchmark::State::range_
private

◆ range_ [2/2]

std::vector< int > benchmark::State::range_
private

Definition at line 710 of file benchmark/include/benchmark/benchmark.h.

◆ started_

bool benchmark::State::started_
private

Definition at line 705 of file benchmark/include/benchmark/benchmark.h.

◆ thread_index

const int benchmark::State::thread_index

◆ thread_index_

const int benchmark::State::thread_index_
private

Definition at line 730 of file benchmark/include/benchmark/benchmark.h.

◆ threads

const int benchmark::State::threads

◆ threads_

const int benchmark::State::threads_
private

Definition at line 731 of file benchmark/include/benchmark/benchmark.h.

◆ timer_ [1/2]

internal::ThreadTimer* benchmark::State::timer_
private

◆ timer_ [2/2]

internal::ThreadTimer * benchmark::State::timer_
private

Definition at line 733 of file benchmark/include/benchmark/benchmark.h.

◆ total_iterations_ [1/2]

size_t benchmark::State::total_iterations_
private

◆ total_iterations_ [2/2]

size_t benchmark::State::total_iterations_
private

Definition at line 694 of file benchmark/include/benchmark/benchmark.h.


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


grpc
Author(s):
autogenerated on Fri May 16 2025 03:02:57