MySQL 8.3.0
Source Code Documentation

Thread instrument information. More...

#include <psi_thread_bits.h>

Public Attributes

PSI_thread_keym_key
 Pointer to the key assigned to the registered thread. More...
 
const char * m_name
 The name of the thread instrument to register. More...
 
const char * m_os_name
 The thread name to advertise to the operating system. More...
 
unsigned int m_flags
 The flags of the thread to register. More...
 
int m_volatility
 Volatility index. More...
 
const char * m_documentation
 Documentation. More...
 

Detailed Description

Thread instrument information.

Since
PSI_THREAD_VERSION_5 This structure is used to register an instrumented thread.

Member Data Documentation

◆ m_documentation

const char* PSI_thread_info_v5::m_documentation

Documentation.

◆ m_flags

unsigned int PSI_thread_info_v5::m_flags

The flags of the thread to register.

See also
PSI_FLAG_SINGLETON
PSI_FLAG_USER
PSI_FLAG_THREAD_SYSTEM
PSI_FLAG_AUTO_SEQNUM
PSI_FLAG_NO_SEQNUM

◆ m_key

PSI_thread_key* PSI_thread_info_v5::m_key

Pointer to the key assigned to the registered thread.

◆ m_name

const char* PSI_thread_info_v5::m_name

The name of the thread instrument to register.

◆ m_os_name

const char* PSI_thread_info_v5::m_os_name

The thread name to advertise to the operating system.

The performance schema thread instrumentation exports instrumented names to the operating system, so they can be visible in:

  • the output of ps
  • the output of top
  • a debugger etc.

This feature is optional, and improves observability for platforms that support a flavor of pthread_setname_np(). On other platforms, there are no effects.

Performance schema thread names can be instrumented in different ways.

First, the thread can be unique (PSI_FLAG_SINGLETON). In this case, the m_os_name attribute is printed as is.

Second, for threads that exist in multiple instances (flag PSI_FLAG_SINGLETON not set), the caller code should pass a sequence number when creating a thread instance with new_thread_v5_t or spawn_thread_v5_t.

This sequence number is concatenated (with a dash) to the m_os_name so that a thread name "foo" with a sequence of "12" is displayed as "foo-12". When the actual value of the sequence number has a special meaning to the instrumented code (for example, a worker number is also exposed in different places), this is the preferred instrumentation.

Third, for threads that exist in multiple instances, but do not rely on a specific numbering, setting the flag PSI_FLAG_AUTO_SEQNUM causes the performance schema to number threads automatically, so the calling code does not have to do it.

Fourth and last, for threads that exist in multiple instances, and are executed so often that the total number of threads grows to a very large number (for example, user sessions), numbering threads is not practical because of size limitations, and would introduce just noise in the ps output.

For this case, the flag PSI_FLAG_NO_SEQNUM can be used to avoid numbering.

See also
my_thread_self_setname().
new_thread_v5_t
spawn_thread_v5_t

◆ m_volatility

int PSI_thread_info_v5::m_volatility

Volatility index.


The documentation for this struct was generated from the following file: