Evo C++ Library v0.5.1
Classes | Namespaces | Macros
benchmark.h File Reference

Evo simple micro benchmarking. More...

#include "fmt.h"
#include "io.h"
#include "thread.h"
#include "timer.h"

Go to the source code of this file.

Classes

class  Benchmark
 Micro benchmarking class. More...
 

Namespaces

 evo
 Evo C++ Library namespace.
 

Macros

#define EVO_BENCH_RUN(F)   bench.run(#F, F)
 Shortcut for running a benchmark on given function or functor. More...
 
#define EVO_BENCH_RUN2(F)   { String evo_bench_name_(#F); F.get_name(evo_bench_name_); bench.run(evo_bench_name_, F); }
 Shortcut for running a benchmark on given parameterized functor. More...
 
#define EVO_BENCH_SETUP(F, WARMUP)   Benchmark bench(0, WARMUP); bench.scale(F)
 Shortcut setting up a Benchmark instance. More...
 
#define INCL_evo_benchmark_h
 

Detailed Description

Evo simple micro benchmarking.

Macro Definition Documentation

◆ EVO_BENCH_RUN

#define EVO_BENCH_RUN (   F)    bench.run(#F, F)

Shortcut for running a benchmark on given function or functor.

Parameters
FFunction or functor to benchmark – passed to Benchmark::run(), also used for the benchmark name

◆ EVO_BENCH_RUN2

#define EVO_BENCH_RUN2 (   F)    { String evo_bench_name_(#F); F.get_name(evo_bench_name_); bench.run(evo_bench_name_, F); }

Shortcut for running a benchmark on given parameterized functor.

  • This builds a string with the benchmark name and calls F.get_name() to add a suffix to the benchmark name
    • This allows the functor to append parameters to the benchmark name
    • Expected method signature void get_name(String&) const
  • Use EVO_BENCH_SETUP() to setup first
  • See Benchmark
Parameters
FFunction or functor to benchmark – passed to Benchmark::run(), also used for the benchmark name

◆ EVO_BENCH_SETUP

#define EVO_BENCH_SETUP (   F,
  WARMUP 
)    Benchmark bench(0, WARMUP); bench.scale(F)

Shortcut setting up a Benchmark instance.

Parameters
FFunction or functor to use to setup scale (for repeat count) – passed to Benchmark::scale()
WARMUPWarmup count to use (passed to Benchmark constructor), use 0 for default

◆ INCL_evo_benchmark_h

#define INCL_evo_benchmark_h