ZeroErr
benchmark.h File Reference
#include "zeroerr/internal/config.h"
#include <chrono>
#include <cstdint>
#include <string>
#include <vector>
Include dependency graph for benchmark.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  zeroerr::PerfCountSet< T >
 PerfCountSet is a set of performance counters. More...
 
struct  zeroerr::PerformanceCounter
 PerformanceCounter is a class to measure the performance of a function. More...
 
struct  zeroerr::BenchResult
 BenchResult is a result of running the benchmark. More...
 
struct  zeroerr::Benchmark
 Benchmark create a core object for configuration of a benchmark. This class is a driver to run multiple times of a benchmark. Each time of a run will generate a row of data. Report will print the data in console. More...
 

Namespaces

 zeroerr
 
 zeroerr::detail
 

Macros

#define ZEROERR_CREATE_BENCHMARK_FUNC(function, name)
 
#define BENCHMARK(name)   ZEROERR_CREATE_BENCHMARK_FUNC(ZEROERR_NAMEGEN(_zeroerr_benchmark), name)
 

Typedefs

using zeroerr::Clock = std::conditional< std::chrono::high_resolution_clock::is_steady, std::chrono::high_resolution_clock, std::chrono::steady_clock >::type
 

Functions

BenchState * zeroerr::createBenchState (Benchmark &benchmark)
 
void zeroerr::destroyBenchState (BenchState *state)
 
size_t zeroerr::getNumIter (BenchState *state)
 
void zeroerr::runIteration (BenchState *state)
 
void zeroerr::moveResult (BenchState *state, std::string name)
 
template<typename T >
void zeroerr::detail::doNotOptimizeAway (T const &val)
 
template<typename T >
void zeroerr::detail::doNotOptimizeAway (T &val)
 
template<typename Arg >
void zeroerr::doNotOptimizeAway (Arg &&arg)
 Makes sure none of the given arguments are optimized away by the compiler. More...
 

Macro Definition Documentation

◆ BENCHMARK

#define BENCHMARK (   name)    ZEROERR_CREATE_BENCHMARK_FUNC(ZEROERR_NAMEGEN(_zeroerr_benchmark), name)

◆ ZEROERR_CREATE_BENCHMARK_FUNC

#define ZEROERR_CREATE_BENCHMARK_FUNC (   function,
  name 
)
Value:
static void function(zeroerr::TestContext*); \
static zeroerr::detail::regTest ZEROERR_NAMEGEN(_zeroerr_reg)( \
{name, __FILE__, __LINE__, function}, zeroerr::TestType::bench); \
TestContext is a class that holds the test results and reporter context. There are 8 different matric...
Definition: unittest.h:67
#define ZEROERR_NAMEGEN(x)
Definition: config.h:104
#define ZEROERR_UNUSED(x)
Definition: config.h:324
constexpr bool _ZEROERR_TEST_CONTEXT
Definition: assert.h:209
@ bench
Definition: unittest.h:254
regTest is a class that is used to register the test case. It will be used as global variables and th...
Definition: unittest.h:262