SPH
Classes | Macros | Enumerations | Functions
Session.h File Reference

Benchmark. More...

#include "bench/Common.h"
#include "bench/Stats.h"
#include "io/Logger.h"
#include "io/Path.h"
#include "objects/containers/Array.h"
#include "objects/utility/StringUtils.h"
#include "objects/wrappers/Expected.h"
#include "objects/wrappers/Outcome.h"
#include "objects/wrappers/SharedPtr.h"
#include "system/Timer.h"
#include <fstream>
#include <map>

Go to the source code of this file.

Classes

struct  Target
 
struct  Result
 
class  Context
 Accessible from benchmarks. More...
 
class  Unit
 Single benchmark unit. More...
 
class  Group
 
class  Baseline
 
class  Session
 
class  Register
 

Macros

#define BENCHMARK_UNIQUE_NAME_IMPL(prefix, line)   prefix##line
 
#define BENCHMARK_UNIQUE_NAME(prefix, line)   BENCHMARK_UNIQUE_NAME_IMPL(prefix, line)
 
#define BENCHMARK_FUNCTION_NAME   BENCHMARK_UNIQUE_NAME(BENCHMARK, __LINE__)
 
#define BENCHMARK_REGISTER_NAME   BENCHMARK_UNIQUE_NAME(REGISTER, __LINE__)
 
#define BENCHMARK(name, group, ...)
 

Enumerations

enum class  Mode { SIMPLE , MAKE_BASELINE , RUN_AGAINST_BASELINE }
 Benchmark mode. More...
 

Functions

template<class T >
INLINE T && doNotOptimize (T &&value)
 
INLINE void clobberMemory ()
 

Detailed Description

Benchmark.

Author
Pavel Sevecek (sevecek at sirrah.troja.mff.cuni.cz)
Date
2016-2021

Definition in file Session.h.

Macro Definition Documentation

◆ BENCHMARK

#define BENCHMARK (   name,
  group,
  ... 
)
Value:
static void BENCHMARK_FUNCTION_NAME(__VA_ARGS__); \
namespace { \
::Sph::Benchmark::Register BENCHMARK_REGISTER_NAME( \
makeShared<::Sph::Benchmark::Unit>(name, &BENCHMARK_FUNCTION_NAME), \
group); \
} \
static void BENCHMARK_FUNCTION_NAME(__VA_ARGS__)
#define BENCHMARK_REGISTER_NAME
Definition: Session.h:332
#define BENCHMARK_FUNCTION_NAME
Definition: Session.h:330

Definition at line 334 of file Session.h.

◆ BENCHMARK_FUNCTION_NAME

#define BENCHMARK_FUNCTION_NAME   BENCHMARK_UNIQUE_NAME(BENCHMARK, __LINE__)

Definition at line 330 of file Session.h.

◆ BENCHMARK_REGISTER_NAME

#define BENCHMARK_REGISTER_NAME   BENCHMARK_UNIQUE_NAME(REGISTER, __LINE__)

Definition at line 332 of file Session.h.

◆ BENCHMARK_UNIQUE_NAME

#define BENCHMARK_UNIQUE_NAME (   prefix,
  line 
)    BENCHMARK_UNIQUE_NAME_IMPL(prefix, line)

Definition at line 328 of file Session.h.

◆ BENCHMARK_UNIQUE_NAME_IMPL

#define BENCHMARK_UNIQUE_NAME_IMPL (   prefix,
  line 
)    prefix##line

Definition at line 326 of file Session.h.

Enumeration Type Documentation

◆ Mode

enum Mode
strong

Benchmark mode.

Enumerator
SIMPLE 

Just run benchmarks and report statistics.

MAKE_BASELINE 

Store iteration numbers to baseline file.

RUN_AGAINST_BASELINE 

Compare iteration numbers with recorded baseline.

Definition at line 24 of file Session.h.

Function Documentation

◆ clobberMemory()

INLINE void clobberMemory ( )

Definition at line 190 of file Session.h.

◆ doNotOptimize()

template<class T >
INLINE T&& doNotOptimize ( T &&  value)

Definition at line 180 of file Session.h.