Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
shambase::FunctionTimer Class Reference

Class FunctionTimer measures the time it takes to execute a function. More...

#include <shambase/include/shambase/time.hpp>

Public Member Functions

template<class Func>
void time_func (Func &&f)
 Measures the time it takes to execute a function.
f64 func_time_sec ()
 Returns the average time it takes to execute the function.

Detailed Description

Class FunctionTimer measures the time it takes to execute a function.

The class FunctionTimer is used to measure the time it takes to execute a function. It does this by creating a Timer object and starting it before executing the function. After the function has been executed, the timer is stopped and the elapsed time is added to the total time. The total time is then divided by the number of times the function has been executed to give the average time it takes to execute the function.

Definition at line 99 of file time.hpp.

Member Function Documentation

◆ func_time_sec()

f64 shambase::FunctionTimer::func_time_sec ( )
inline

Returns the average time it takes to execute the function.

Returns
f64 The average time it takes to execute the function.

Definition at line 126 of file time.hpp.

◆ time_func()

template<class Func>
void shambase::FunctionTimer::time_func ( Func && f)
inline

Measures the time it takes to execute a function.

Parameters
fThe function to be executed.

Definition at line 112 of file time.hpp.

Here is the call graph for this function:

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