CORSIKA  @c8_version@
The framework to simulate particle cascades for astroparticle physics
corsika::FunctionTimer< TFunc, TTimer > Class Template Reference

Wraps and measures the runtime of a single function type object. More...

#include <FunctionTimer.hpp>

Inheritance diagram for corsika::FunctionTimer< TFunc, TTimer >:

Public Member Functions

 FunctionTimer (TFunc f)
 Constructs the wrapper with the given functionpointer. More...
 
template<typename... TArgs>
auto operator() (TArgs &&... args) -> std::invoke_result_t< TFunc, TArgs... >
 Functor for calling the wrapped function This functor calls the wrapped function and measures the elapsed time between call and return. More...
 

Detailed Description

template<typename TFunc, class TTimer = Timer<std::chrono::high_resolution_clock, std::chrono::microseconds>>
class corsika::FunctionTimer< TFunc, TTimer >

Wraps and measures the runtime of a single function type object.

Template Parameters
TFuncfuntion pointer that should be wrapped
TClocktype of the clock that should be used for measurements, default is high_resolution_clock
TDurationtype of std::duration to measure the elapsed time, default is microseconds

Definition at line 29 of file FunctionTimer.hpp.

Constructor & Destructor Documentation

◆ FunctionTimer()

template<typename TFunc , class TTimer = Timer<std::chrono::high_resolution_clock, std::chrono::microseconds>>
corsika::FunctionTimer< TFunc, TTimer >::FunctionTimer ( TFunc  f)

Constructs the wrapper with the given functionpointer.

Parameters
fFunction or functor whose runtime should be measured

Member Function Documentation

◆ operator()()

template<typename TFunc , class TTimer = Timer<std::chrono::high_resolution_clock, std::chrono::microseconds>>
template<typename... TArgs>
auto corsika::FunctionTimer< TFunc, TTimer >::operator() ( TArgs &&...  args) -> std::invoke_result_t< TFunc, TArgs... >

Functor for calling the wrapped function This functor calls the wrapped function and measures the elapsed time between call and return.

The return value needs to be copy constructible.

Template Parameters
TArgsParameter types that are forwarded to the function. The use of correct types is the responsibility of the user, no checks are done.
Parameters
argsArguments are forwarded to the wrapped function. This method does not support overloaded function resolution.
Returns
The return value of the wrapped function is temporarily copied and then returned by value

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