OmniSciDB  a5dc49c757
 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 >
 
class  Timer< 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 129 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 125 of file measure.h.

References run_benchmark_import::args.

125  {
126  InjectTimer t("test", 1, "test");
127  return fn(std::forward<Args>(args)...);
128 }
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 85 of file measure.h.

85  {
86  auto now = std::chrono::steady_clock::now();
87  auto overall_duration = (now - clock_begin);
88  auto since_last_duration = (now - clock_last);
89  auto overall = std::chrono::duration_cast<TypeR>(overall_duration);
90  auto since_last = std::chrono::duration_cast<TypeR>(since_last_duration);
91  clock_last = now;
92  // std::string ret(overall.count() + " elapsed " + since_last.count());
93  std::ostringstream oss;
94  oss << overall.count() << " - " << since_last.count();
95  return oss.str();
96 }

Variable Documentation

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

Definition at line 80 of file measure.h.