24#ifndef THREAD_STAGE_GUARD_H_INCLUDED
25#define THREAD_STAGE_GUARD_H_INCLUDED
51 const char *func,
const char *
file,
52 const unsigned int line)
114#define NAMED_THD_STAGE_GUARD(name, thd, new_stage) \
115 raii::Thread_stage_guard name { \
116 (thd), (new_stage), __func__, __FILE__, __LINE__ \
127#define THD_STAGE_GUARD(thd, new_stage) \
128 NAMED_THD_STAGE_GUARD(_thread_stage_guard_##new_stage, (thd), (new_stage))
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
void enter_stage(const PSI_stage_info *stage, PSI_stage_info *old_stage, const char *calling_func, const char *calling_file, const unsigned int calling_line) SUPPRESS_TSAN
Definition: sql_class.cc:542
RAII guard that sets a thread stage, and restores the previous stage when going out of scope.
Definition: thread_stage_guard.h:34
Thread_stage_guard & operator=(const Thread_stage_guard &)=delete
const char * m_func
The name of the calling function.
Definition: thread_stage_guard.h:92
THD * m_thd
The session.
Definition: thread_stage_guard.h:90
Thread_stage_guard(Thread_stage_guard &&)=delete
Thread_stage_guard(const Thread_stage_guard &)=delete
PSI_stage_info m_old_stage
The previous stage.
Definition: thread_stage_guard.h:86
Thread_stage_guard()=delete
const unsigned int m_line
The Line number of the caller.
Definition: thread_stage_guard.h:96
void set_old_stage() const
Revert back to the old stage before this object goes out of scope.
Definition: thread_stage_guard.h:67
~Thread_stage_guard()
Revert the old stage that was used before this object's constructor was invoked.
Definition: thread_stage_guard.h:82
PSI_stage_info m_new_stage
The new stage.
Definition: thread_stage_guard.h:88
void set_new_stage() const
Restore the new stage, in case set_old_stage was used earlier.
Definition: thread_stage_guard.h:72
const char * m_file
The filename of the caller.
Definition: thread_stage_guard.h:94
Thread_stage_guard & operator=(Thread_stage_guard &&)=delete
Thread_stage_guard(THD *thd, const PSI_stage_info &new_stage, const char *func, const char *file, const unsigned int line)
Set the given stage for the session, and remember the previous stage in a member variable.
Definition: thread_stage_guard.h:50
Performance schema instrumentation interface.
Stage instrument information.
Definition: psi_stage_bits.h:74