26#ifndef MYSQLSHDK_LIBS_UTILS_PROFILING_H_
27#define MYSQLSHDK_LIBS_UTILS_PROFILING_H_
57 void start() {
m_start = std::chrono::high_resolution_clock::now(); }
61 std::chrono::high_resolution_clock::duration
elapsed()
const {
66 return std::chrono::duration_cast<std::chrono::nanoseconds>(
elapsed())
79 std::chrono::high_resolution_clock::time_point
m_start;
80 std::chrono::high_resolution_clock::time_point
m_finish;
106 auto dur = std::chrono::high_resolution_clock::duration::zero();
108 if (tp.depth == 0) dur += tp.elapsed();
110 return std::chrono::duration_cast<std::chrono::nanoseconds>(dur).count();
224void activate(
bool trace_total =
true);
Definition: profiling.h:45
void start()
Definition: profiling.h:57
uint64_t nanoseconds_elapsed() const
Definition: profiling.h:65
Duration & operator=(const Duration &)=default
double seconds_elapsed() const
Definition: profiling.h:74
virtual ~Duration()=default
std::chrono::high_resolution_clock::time_point m_start
Definition: profiling.h:79
double milliseconds_elapsed() const
Definition: profiling.h:70
void finish()
Definition: profiling.h:59
Duration(Duration &&)=default
std::chrono::high_resolution_clock::duration elapsed() const
Definition: profiling.h:61
Duration & operator=(Duration &&)=default
std::chrono::high_resolution_clock::time_point m_finish
Definition: profiling.h:80
Duration(const Duration &)=default
This class keeps track execution time on specifics blocks of code during a complete session.
Definition: profiling.h:158
std::map< std::string, Profile_timer > Time_profilers
Definition: profiling.h:175
std::map< std::thread::id, Time_profilers > m_time_profilers
Definition: profiling.h:179
std::mutex m_mutex
Definition: profiling.h:178
~Global_profiler()
Definition: profiling.h:160
void print_stats()
Definition: profiling.cc:36
void stage_end(const std::string &id)
Definition: profiling.h:166
void stage_begin(const std::string &id)
Definition: profiling.h:161
void reset()
Definition: profiling.cc:79
Definition: profiling.h:83
const std::vector< Trace_point > & trace_points() const
Definition: profiling.h:131
void reserve(size_t space)
Definition: profiling.h:90
void stage_end()
Definition: profiling.h:98
uint64_t total_nanoseconds_elapsed() const
Definition: profiling.h:105
double total_milliseconds_elapsed() const
Definition: profiling.h:113
double total_seconds_elapsed() const
Definition: profiling.h:117
std::vector< Trace_point > _trace_points
Definition: profiling.h:134
void stage_begin(const char *note)
Definition: profiling.h:92
Profile_timer()
Definition: profiling.h:85
int _depth
Definition: profiling.h:136
std::vector< size_t > _nesting_levels
Definition: profiling.h:135
void stage_begin(const std::string &id)
Definition: profiling.h:235
shcore::utils::Global_profiler * g_active_profiler
Definition: profiling.cc:87
void stage_end(const std::string &id)
Definition: profiling.h:239
void print_stats()
Definition: profiling.h:227
void reset()
Definition: profiling.h:231
void deactivate(bool trace_total)
Definition: profiling.cc:99
void activate(bool trace_total)
Definition: profiling.cc:89
Definition: file_system_exceptions.h:34
pid_type get_id()
Definition: process.h:48
static std::mutex lock
Definition: net_ns.cc:56
Definition: profiling.h:122
Trace_point(const char *n, int d)
Definition: profiling.h:126
int depth
Definition: profiling.h:124
char note[33]
Definition: profiling.h:123
unsigned long id[MAX_DEAD]
Definition: xcom_base.cc:510
int n
Definition: xcom_base.cc:509