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

◆ INJECT_TIMER

◆ TIME_WRAP

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

Definition at line 100 of file measure.h.

Function Documentation

◆ time_wrap()

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 }

◆ timer_lap()

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 }

◆ timer_start()

template<typename Type = std::chrono::steady_clock::time_point>
Type timer_start ( )

◆ timer_stop()

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

Definition at line 48 of file measure.h.

Referenced by RelAlgExecutor::executeRelAlgQueryNoRetry(), Executor::executeUpdate(), Executor::executeWorkUnitImpl(), Executor::executeWorkUnitPerFragment(), anonymous_namespace{Execute.cpp}::get_reduction_code(), import_export::import_thread_shapefile(), File_Namespace::FileMgr::init(), Executor::launchKernels(), Parser::InsertIntoTableAsSelectStmt::populateData(), RelAlgExecutor::prepareLeafExecution(), import_export::RenderGroupAnalyzer::seedFromExistingTableContents(), and InjectTimer::~InjectTimer().

48  {
49  auto duration =
50  std::chrono::duration_cast<TypeR>(std::chrono::steady_clock::now() - clock_begin);
51  return duration.count();
52 }
+ Here is the caller graph for this function:

Variable Documentation

◆ g_enable_debug_timer