ComPPare 1.0.0
Loading...
Searching...
No Matches
comppare.hpp File Reference

This file is the main include file for the ComPPare framework. More...

Include dependency graph for comppare.hpp:

Go to the source code of this file.

Classes

struct  comppare::outspec< Value, void >
 Partial specialization of outspec for automatic error policy selection. More...
 
struct  comppare::outspec< outspec< Value, Policy >, void >
 Partial specialization of outspec for user-defined error policy selection. More...
 
struct  comppare::outspec< Value, Policy >
 Partial specialization of outspec for user-defined error policy selection. More...
 
class  comppare::InputContext< Inputs >
 InputContext class template to hold input parameters for the comparison framework. More...
 
class  comppare::InputContext< Inputs >::OutputContext< OutputSpecs >
 OutputContext class template to hold output parameters and manage implementations. More...
 
struct  comppare::InputContext< Inputs >::OutputContext< OutputSpecs >::Impl
 Internal container representing one registered implementation. More...
 

Namespaces

namespace  comppare
 ComPPare framework main namespace.
 

Concepts

concept  comppare::OutSpec
 Concept for output specifications being pair of type and policy.
 

Macros

#define HOTLOOPSTART    auto &&hotloop_body = [&]() { /* start of lambda */
 Macro to mark the start of a hot loop for benchmarking. This macro defines a lambda function hotloop_body that encapsulates the code to be benchmarked.
 
#define COMPPARE_HOTLOOP_BENCH
 Internal macro to perform the warm-up and timed benchmarking loops. This macro is used within the HOTLOOPEND macro to execute the benchmarking process.
 
#define HOTLOOPEND
 
#define HOTLOOP(LOOP_BODY)    HOTLOOPSTART LOOP_BODY HOTLOOPEND
 Macro to wrap a code block for benchmarking.
 
#define MANUAL_TIMER_START    auto t_manual_start = comppare::config::clock_t::now();
 Macro to mark the start of a manual timer for benchmarking.
 
#define MANUAL_TIMER_END
 Macro to mark the end of a manual timer for benchmarking.
 
#define SET_ITERATION_TIME(TIME)    comppare::config::increment_roi_us(TIME);
 

Typedefs

template<typename Value , typename Policy >
using comppare::set_policy = outspec< Value, Policy >
 Alias for setting the error policy for a type.
 

Functions

template<typename T >
void comppare::DoNotOptimize (T const &value)
 Prevents the compiler from optimizing away the given value.
 
template<typename T >
void comppare::DoNotOptimize (T &value)
 Prevents the compiler from optimizing away the given value.
 
template<typename T >
void comppare::DoNotOptimize (T &&value)
 Prevents the compiler from optimizing away the given value.
 
void comppare::ClobberMemory ()
 
template<typename... Outputs, typename... Inputs>
auto comppare::make_comppare (Inputs &&...ins)
 Helper function to create a comppare object.
 

Detailed Description

This file is the main include file for the ComPPare framework.

Author
Leong Fan FUNG (funglf) stanl.nosp@m.eyfu.nosp@m.nglf@.nosp@m.gmai.nosp@m.l.com
Date
2025
See also
LICENSE For full license text.

Macro Definition Documentation

◆ COMPPARE_HOTLOOP_BENCH

#define COMPPARE_HOTLOOP_BENCH
Value:
/* Warm-up */ \
auto warmup_t0 = comppare::config::clock_t::now(); \
for (std::size_t i = 0; i < comppare::config::warmup_iters(); ++i) \
hotloop_body(); \
auto warmup_t1 = comppare::config::clock_t::now(); \
comppare::config::set_warmup_us(warmup_t0, warmup_t1); \
\
/* Timed */ \
comppare::config::reset_roi_us(); \
auto t0 = comppare::config::clock_t::now(); \
for (std::size_t i = 0; i < comppare::config::bench_iters(); ++i) \
hotloop_body(); \
auto t1 = comppare::config::clock_t::now(); \
\
if (comppare::config::get_roi_us() == double(0.0)) \
comppare::config::set_roi_us(t0, t1);
static double get_roi_us()
Get the current roi us value.
Definition config.hpp:163
static uint64_t bench_iters()
Get the number of benchmark iterations.
Definition config.hpp:71
static uint64_t warmup_iters()
Get the number of warmup iterations.
Definition config.hpp:66

Internal macro to perform the warm-up and timed benchmarking loops. This macro is used within the HOTLOOPEND macro to execute the benchmarking process.

◆ HOTLOOP

#define HOTLOOP (   LOOP_BODY)     HOTLOOPSTART LOOP_BODY HOTLOOPEND

Macro to wrap a code block for benchmarking.

◆ HOTLOOPEND

#define HOTLOOPEND
Value:
} \
; /* end lambda */ \
\
#define COMPPARE_HOTLOOP_BENCH
Internal macro to perform the warm-up and timed benchmarking loops. This macro is used within the HOT...
Definition comppare.hpp:971

◆ HOTLOOPSTART

#define HOTLOOPSTART    auto &&hotloop_body = [&]() { /* start of lambda */

Macro to mark the start of a hot loop for benchmarking. This macro defines a lambda function hotloop_body that encapsulates the code to be benchmarked.

◆ MANUAL_TIMER_END

#define MANUAL_TIMER_END
Value:
auto t_manual_stop = comppare::config::clock_t::now(); \
SET_ITERATION_TIME(t_manual_stop - t_manual_start);

Macro to mark the end of a manual timer for benchmarking.

◆ MANUAL_TIMER_START

#define MANUAL_TIMER_START    auto t_manual_start = comppare::config::clock_t::now();

Macro to mark the start of a manual timer for benchmarking.

◆ SET_ITERATION_TIME

#define SET_ITERATION_TIME (   TIME)     comppare::config::increment_roi_us(TIME);