OmniSciDB  1dac507f6e
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
measure.h File Reference
#include <chrono>
#include <iomanip>
#include <sstream>
#include "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 98 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 94 of file measure.h.

References run_benchmark_import::args.

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

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

Definition at line 40 of file measure.h.

Referenced by Executor::execute(), RelAlgExecutor::executeRelAlgQueryNoRetry(), Importer_NS::import_thread_shapefile(), File_Namespace::FileMgr::init(), InjectTimer::InjectTimer(), RelAlgExecutor::prepareLeafExecution(), and Importer_NS::RenderGroupAnalyzer::seedFromExistingTableContents().

40  {
41  return std::chrono::steady_clock::now();
42 }

+ Here is the caller graph for this function:

template<typename Type = std::chrono::steady_clock::time_point, typename TypeR = std::chrono::milliseconds>
TypeR::rep timer_stop ( Type  clock_begin)

Definition at line 46 of file measure.h.

Referenced by Executor::execute(), RelAlgExecutor::executeRelAlgQueryNoRetry(), Importer_NS::import_thread_shapefile(), File_Namespace::FileMgr::init(), RelAlgExecutor::prepareLeafExecution(), Importer_NS::RenderGroupAnalyzer::seedFromExistingTableContents(), and InjectTimer::~InjectTimer().

46  {
47  auto duration =
48  std::chrono::duration_cast<TypeR>(std::chrono::steady_clock::now() - clock_begin);
49  return duration.count();
50 }

+ Here is the caller graph for this function:

Variable Documentation