MySQL 8.4.3
Source Code Documentation
PROFILING Class Reference

Profiling state for a single THD; contains multiple QUERY_PROFILE objects. More...

#include <sql_profile.h>

Public Member Functions

 PROFILING ()
 
 ~PROFILING ()
 
void set_query_source (const char *query_source_arg, size_t query_length_arg)
 At a point in execution where we know the query source, save the text of it in the query profile. More...
 
void start_new_query (const char *initial_state="starting")
 Prepare to start processing a new query. More...
 
void discard_current_query ()
 Throw away the current profile, because it's useless or unwanted or corrupted. More...
 
void finish_current_query ()
 Try to save the current profile entry, clean up the data if it shouldn't be saved, and maintain the profile history size. More...
 
void status_change (const char *status_arg, const char *function_arg, const char *file_arg, unsigned int line_arg)
 A new state is given, and that signals the profiler to start a new timed step for the current query's profile. More...
 
void set_thd (THD *thd_arg)
 
bool show_profiles ()
 
int fill_statistics_info (THD *thd, Table_ref *tables)
 Fill the information schema table, "query_profile", as defined in show.cc . More...
 
void cleanup ()
 Clear all the profiling information. More...
 

Private Member Functions

query_id_t next_profile_id ()
 

Private Attributes

query_id_t profile_id_counter
 
THDthd
 
bool keeping
 
bool enabled
 
QUERY_PROFILEcurrent
 
QUERY_PROFILElast
 
Queue< QUERY_PROFILEhistory
 

Friends

class PROF_MEASUREMENT
 
class QUERY_PROFILE
 

Detailed Description

Profiling state for a single THD; contains multiple QUERY_PROFILE objects.

Constructor & Destructor Documentation

◆ PROFILING()

PROFILING::PROFILING ( )

◆ ~PROFILING()

PROFILING::~PROFILING ( )

Member Function Documentation

◆ cleanup()

void PROFILING::cleanup ( void  )

Clear all the profiling information.

◆ discard_current_query()

void PROFILING::discard_current_query ( )

Throw away the current profile, because it's useless or unwanted or corrupted.

◆ fill_statistics_info()

int PROFILING::fill_statistics_info ( THD thd_arg,
Table_ref tables 
)

Fill the information schema table, "query_profile", as defined in show.cc .

There are two ways to get to this function: Selecting from the information schema, and a SHOW command.

◆ finish_current_query()

void PROFILING::finish_current_query ( )

Try to save the current profile entry, clean up the data if it shouldn't be saved, and maintain the profile history size.

Naturally, this may not succeed if the profile was previously discarded, and that's expected.

◆ next_profile_id()

query_id_t PROFILING::next_profile_id ( )
inlineprivate

◆ set_query_source()

void PROFILING::set_query_source ( const char *  query_source_arg,
size_t  query_length_arg 
)

At a point in execution where we know the query source, save the text of it in the query profile.

This must be called exactly once per descrete statement.

◆ set_thd()

void PROFILING::set_thd ( THD thd_arg)
inline

◆ show_profiles()

bool PROFILING::show_profiles ( )

◆ start_new_query()

void PROFILING::start_new_query ( const char *  initial_state = "starting")

Prepare to start processing a new query.

It is an error to do this if there's a query already in process; nesting is not supported.

Parameters
initial_state(optional) name of period before first state change

◆ status_change()

void PROFILING::status_change ( const char *  status_arg,
const char *  function_arg,
const char *  file_arg,
unsigned int  line_arg 
)

A new state is given, and that signals the profiler to start a new timed step for the current query's profile.

Parameters
status_argname of this step
function_argcalling function (usually supplied from compiler)
file_argcalling file (usually supplied from compiler)
line_argcalling line number (usually supplied from compiler)

Friends And Related Function Documentation

◆ PROF_MEASUREMENT

friend class PROF_MEASUREMENT
friend

◆ QUERY_PROFILE

friend class QUERY_PROFILE
friend

Member Data Documentation

◆ current

QUERY_PROFILE* PROFILING::current
private

◆ enabled

bool PROFILING::enabled
private

◆ history

Queue<QUERY_PROFILE> PROFILING::history
private

◆ keeping

bool PROFILING::keeping
private

◆ last

QUERY_PROFILE* PROFILING::last
private

◆ profile_id_counter

query_id_t PROFILING::profile_id_counter
private

◆ thd

THD* PROFILING::thd
private

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