MySQL 9.3.0
Source Code Documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
shcore::utils::Global_profiler Class Reference

This class keeps track execution time on specifics blocks of code during a complete session. More...

#include <profiling.h>

Public Types

using Time_profilers = std::map< std::string, Profile_timer >
 

Public Member Functions

 ~Global_profiler ()
 
void stage_begin (const std::string &id)
 
void stage_end (const std::string &id)
 
void print_stats ()
 
void reset ()
 

Private Attributes

std::mutex m_mutex
 
std::map< std::thread::id, Time_profilersm_time_profilers
 

Detailed Description

This class keeps track execution time on specifics blocks of code during a complete session.

A session is defined by the time when the global profiler is enabled and the time is finished.

The execution time is recorded by thread/stage groups.

This class is NOT intended to be used (instantiated) within the shell functionality, but to be used as a global profiler which will record execution time associated to specific IDs and then print accumulated statistics.

Use it throught the following functions in the profiling namespace:

  • activate
  • deactivate
  • stage_begin
  • stage_end

Member Typedef Documentation

◆ Time_profilers

Constructor & Destructor Documentation

◆ ~Global_profiler()

shcore::utils::Global_profiler::~Global_profiler ( )
inline

Member Function Documentation

◆ print_stats()

void shcore::utils::Global_profiler::print_stats ( )

◆ reset()

void shcore::utils::Global_profiler::reset ( )

◆ stage_begin()

void shcore::utils::Global_profiler::stage_begin ( const std::string &  id)
inline

◆ stage_end()

void shcore::utils::Global_profiler::stage_end ( const std::string &  id)
inline

Member Data Documentation

◆ m_mutex

std::mutex shcore::utils::Global_profiler::m_mutex
private

◆ m_time_profilers

std::map<std::thread::id, Time_profilers> shcore::utils::Global_profiler::m_time_profilers
private

The documentation for this class was generated from the following files: