Template Struct measure

Struct Documentation

template <typename TimeT = std::chrono::milliseconds>
struct measure

Utility for time measurements.

Public Static Functions

template <typename F, typename... Args>
static auto duration(F &&function, Args... args)

Compute the time spend to execute a function.

Typical Usage:

int aParameter = 1;
auto time = shad::measure<std::chrono::seconds>::duration(
  [](int aParameter) {
    // ... do what needs to be measured ...
  }, aParameter);

std::cout << "Time spent : " << time.count() << std::endl;

Return
the time spent to compute the input function.
Template Parameters
  • F: The type of the function to be computed
  • Args: The types of the arguments to be forwarded to the function.
Parameters
  • function: A collable object that will be measured
  • args: The list of args forwarded to the function.