OmniSciDB  c1a53651b2
 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
 

Macro Definition Documentation

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

Definition at line 100 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 96 of file measure.h.

References run_benchmark_import::args.

96  {
97  InjectTimer t("test", 1, "test");
98  return fn(std::forward<Args>(args)...);
99 }
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 56 of file measure.h.

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

Variable Documentation