OmniSciDB  72c90bc290
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
measure.h File Reference
#include <chrono>
#include <iomanip>
#include <sstream>
#include <type_traits>
#include "Logger/Logger.h"
+ Include dependency graph for measure.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  measure< TimeT >
 
struct  InjectTimer
 

Macros

#define INJECT_TIMER(DESC)   InjectTimer DESC(#DESC, __LINE__, __FUNCTION__)
 
#define TIME_WRAP(FUNC)   time_wrap<decltype(&FUNC), &FUNC>
 

Functions

template<typename Type = std::chrono::steady_clock::time_point>
Type timer_start ()
 
template<typename Type = std::chrono::steady_clock::time_point, typename TypeR = std::chrono::milliseconds>
TypeR::rep timer_stop (Type clock_begin)
 
template<typename Type = std::chrono::steady_clock::time_point, typename TypeR = std::chrono::milliseconds>
std::string timer_lap (Type clock_begin, Type &clock_last)
 
template<typename Fn , Fn fn, typename... Args>
std::result_of< Fn(Args...)>::type time_wrap (Args...args)
 

Variables

bool g_enable_debug_timer
 
const auto timer_stop_microseconds
 

Macro Definition Documentation

#define TIME_WRAP (   FUNC)    time_wrap<decltype(&FUNC), &FUNC>

Definition at line 103 of file measure.h.

Function Documentation

template<typename Fn , Fn fn, typename... Args>
std::result_of<Fn(Args...)>::type time_wrap ( Args...  args)

Definition at line 99 of file measure.h.

References run_benchmark_import::args.

99  {
100  InjectTimer t("test", 1, "test");
101  return fn(std::forward<Args>(args)...);
102 }
template<typename Type = std::chrono::steady_clock::time_point, typename TypeR = std::chrono::milliseconds>
std::string timer_lap ( Type  clock_begin,
Type clock_last 
)

Definition at line 59 of file measure.h.

59  {
60  auto now = std::chrono::steady_clock::now();
61  auto overall_duration = (now - clock_begin);
62  auto since_last_duration = (now - clock_last);
63  auto overall = std::chrono::duration_cast<TypeR>(overall_duration);
64  auto since_last = std::chrono::duration_cast<TypeR>(since_last_duration);
65  clock_last = now;
66  // std::string ret(overall.count() + " elapsed " + since_last.count());
67  std::ostringstream oss;
68  oss << overall.count() << " - " << since_last.count();
69  return oss.str();
70 }
template<typename Type = std::chrono::steady_clock::time_point, typename TypeR = std::chrono::milliseconds>
TypeR::rep timer_stop ( Type  clock_begin)

Variable Documentation

const auto timer_stop_microseconds
Initial value:
=
timer_stop<std::chrono::steady_clock::time_point, std::chrono::microseconds>

Definition at line 54 of file measure.h.