24#ifndef PFS_INSTR_CLASS_H
25#define PFS_INSTR_CLASS_H
39#include "mysqld_error.h"
59#define PFS_MAX_INFO_NAME_LENGTH 128
67#define PFS_MAX_OS_NAME_LENGTH 16
76#define PFS_MAX_FULL_PREFIX_NAME_LENGTH 32
80class PFS_opaque_container_page;
192 const char *
str()
const;
279 const uint valid_flags =
m_flags & allowed_flags;
285 assert(valid_flags ==
m_flags);
326#define PFS_MUTEX_PARTITIONS 2
364 bool m_history{
false};
465 void aggregate_lock();
484 void refresh_setup_object_flags(
PFS_thread *thread);
509 void destroy_lock_stat();
514 void destroy_index_stats();
522 std::atomic<PFS_table_share_index *> m_race_index_stat[
MAX_INDEXES + 1];
545#define GLOBAL_TABLE_IO_EVENT_INDEX 0
546#define GLOBAL_TABLE_LOCK_EVENT_INDEX 1
547#define GLOBAL_IDLE_EVENT_INDEX 2
548#define GLOBAL_METADATA_EVENT_INDEX 3
550#define COUNT_GLOBAL_EVENT_INDEX 4
553#define GLOBAL_TRANSACTION_INDEX 0
555#define GLOBAL_ERROR_INDEX 0
633 uint cond_class_sizing);
744 const char *schema_name, uint schema_name_length,
745 const char *
table_name, uint table_name_length);
Encapsulates the name of an instrumented entity.
Definition: pfs_instr_class.h:164
const char * m_private_old_name
Old instrument name, if any.
Definition: pfs_instr_class.h:184
terminology_use_previous::enum_compatibility_version m_private_version
The oldest version that uses the new name.
Definition: pfs_instr_class.h:188
uint m_private_old_name_length
Length in bytes of old instrument name len, if any.
Definition: pfs_instr_class.h:186
static constexpr uint max_length
Definition: pfs_instr_class.h:166
uint m_private_name_length
Length in bytes of m_name.
Definition: pfs_instr_class.h:182
A typesafe replacement for DYNAMIC_ARRAY.
Definition: prealloced_array.h:71
#define PSI_FLAG_SINGLETON
Singleton flag.
Definition: component_common.h:35
void release_table_share(TABLE_SHARE *share)
Mark that we are not using table share anymore.
Definition: sql_base.cc:1055
unsigned int PSI_cond_key
Instrumented cond key.
Definition: psi_cond_bits.h:44
unsigned int PSI_file_key
Instrumented file key.
Definition: psi_file_bits.h:48
unsigned int PSI_memory_key
Instrumented memory key.
Definition: psi_memory_bits.h:49
unsigned int PSI_mutex_key
Instrumented mutex key.
Definition: psi_mutex_bits.h:52
unsigned int PSI_rwlock_key
Instrumented rwlock key.
Definition: psi_rwlock_bits.h:44
unsigned int PSI_socket_key
Instrumented socket key.
Definition: psi_socket_bits.h:49
unsigned int PSI_stage_key
Instrumented stage key.
Definition: psi_stage_bits.h:43
unsigned int PSI_statement_key
Instrumented statement key.
Definition: psi_statement_bits.h:49
unsigned int PSI_thread_key
Instrumented thread key.
Definition: psi_thread_bits.h:50
#define PSI_FLAG_USER
User flag.
Definition: psi_bits.h:103
#define PSI_FLAG_TRANSFER
Transferable flag.
Definition: psi_bits.h:95
#define PSI_FLAG_DISABLED
Instrument is disabled by default.
Definition: psi_bits.h:146
#define PSI_FLAG_MUTABLE
Mutable flag.
Definition: psi_bits.h:68
#define PSI_FLAG_STAGE_PROGRESS
Stage progress flag.
Definition: psi_bits.h:82
#define PSI_FLAG_RWLOCK_SX
Shared Exclusive flag.
Definition: psi_bits.h:88
#define PSI_FLAG_UNTIMED
Instrument is not timed by default.
Definition: psi_bits.h:151
#define PSI_FLAG_NO_SEQNUM
No sequence number flag.
Definition: psi_bits.h:136
#define PSI_FLAG_THREAD
Per Thread flag.
Definition: psi_bits.h:75
#define PSI_FLAG_AUTO_SEQNUM
Automatic sequence number flag.
Definition: psi_bits.h:130
#define PSI_FLAG_MEM_COLLECT
Enable collecting the memory consumed by threads.
Definition: psi_bits.h:141
#define PSI_FLAG_THREAD_SYSTEM
System thread flag.
Definition: psi_bits.h:124
#define PSI_FLAG_RWLOCK_PR
Priority lock flag.
Definition: psi_bits.h:118
#define PSI_FLAG_ONLY_GLOBAL_STAT
Global stat only flag.
Definition: psi_bits.h:112
static int flags[50]
Definition: hp_test1.cc:40
Header for compiler-dependent features.
constexpr bool likely(bool expr)
Definition: my_compiler.h:57
#define MAX_INDEXES
Definition: my_config.h:210
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:56
uint32_t uint32
Definition: my_inttypes.h:67
static int count
Definition: myisam_ftdump.cc:45
Common definition between mysql server & client.
#define NAME_LEN
Definition: mysql_com.h:67
const char * table_name
Definition: rules_table_service.cc:56
enum_compatibility_version
Enumeration holding the possible values for @terminology_use_previous.
Definition: terminology_use_previous_enum.h:48
Data types for columns used in the performance schema tables (declarations)
enum_object_type
Enum values for the various OBJECT_TYPE columns.
Definition: pfs_column_types.h:222
Miscellaneous global dependencies (declarations).
#define PFS_ALIGNED
Definition: pfs_global.h:57
#define PFS_MAX_OS_NAME_LENGTH
Maximum length of the thread os name.
Definition: pfs_instr_class.h:67
#define PFS_MAX_INFO_NAME_LENGTH
Maximum length of an instrument name.
Definition: pfs_instr_class.h:59
Performance schema internal locks (declarations).
Object names (declarations).
Statistics (declarations).
MetricOTELType
Definition: psi_metric_bits.h:32
unsigned int PSI_meter_key
Definition: psi_metric_bits.h:101
MetricNumType
Definition: psi_metric_bits.h:38
unsigned int PSI_metric_key
Definition: psi_metric_bits.h:102
void(* measurement_callback_t)(void *measurement_context, measurement_delivery_callback_t delivery, void *delivery_context)
Single metric measurement callback can return multiple measurement values.
Definition: psi_metric_bits.h:97
required string key
Definition: replication_asynchronous_connection_failover.proto:60
required bool enabled
Definition: replication_group_member_actions.proto:33
static const LEX_CSTRING pfs
Definition: sql_show_processlist.cc:66
case opt name
Definition: sslopt-case.h:29
Instrumentation metadata for a condition.
Definition: pfs_instr_class.h:349
PFS_cond_stat m_cond_stat
Condition usage statistics.
Definition: pfs_instr_class.h:354
PFS_cond * m_singleton
Singleton instance.
Definition: pfs_instr_class.h:356
Statistics for conditions usage.
Definition: pfs_stat.h:238
Instrumented condition implementation.
Definition: pfs_instr.h:162
Instrumentation metadata for an error.
Definition: pfs_instr_class.h:580
Statistics for all server errors.
Definition: pfs_stat.h:557
Instrumentation metadata for a file.
Definition: pfs_instr_class.h:589
PFS_file * m_singleton
Singleton instance.
Definition: pfs_instr_class.h:593
PFS_file_stat m_file_stat
File usage statistics.
Definition: pfs_instr_class.h:591
Statistics for FILE usage.
Definition: pfs_stat.h:308
Instrumented File and FILE implementation.
Definition: pfs_instr.h:179
Performance schema global sizing parameters.
Definition: pfs_server.h:119
Information for all instrumentation.
Definition: pfs_instr_class.h:212
bool is_deferred() const
Definition: pfs_instr_class.h:292
bool m_enabled
True if this instrument is enabled.
Definition: pfs_instr_class.h:216
static void set_enabled(PFS_instr_class *pfs, bool enabled)
uint m_flags
Instrument flags.
Definition: pfs_instr_class.h:220
bool is_untimed() const
Definition: pfs_instr_class.h:271
bool is_singleton() const
Definition: pfs_instr_class.h:239
PFS_class_type m_type
Class type.
Definition: pfs_instr_class.h:214
bool is_priority() const
Definition: pfs_instr_class.h:247
static void set_timed(PFS_instr_class *pfs, bool timed)
void set_enforced_flags(uint flags)
Definition: pfs_instr_class.h:273
bool is_progress() const
Definition: pfs_instr_class.h:243
bool can_be_timed() const
Definition: pfs_instr_class.h:303
bool is_transferable() const
Definition: pfs_instr_class.h:249
bool has_enforced_memory_cnt() const
Definition: pfs_instr_class.h:265
PFS_instr_name m_name
Instrument name.
Definition: pfs_instr_class.h:235
bool has_default_memory_cnt() const
Definition: pfs_instr_class.h:263
uint m_event_name_index
Instrument name index.
Definition: pfs_instr_class.h:233
bool has_auto_seqnum() const
Definition: pfs_instr_class.h:261
bool is_disabled() const
Definition: pfs_instr_class.h:269
bool m_timed
True if this instrument is timed.
Definition: pfs_instr_class.h:218
bool can_be_enforced() const
Definition: pfs_instr_class.h:314
bool is_global() const
Definition: pfs_instr_class.h:255
char * m_documentation
Documentation.
Definition: pfs_instr_class.h:237
bool is_user() const
Definition: pfs_instr_class.h:251
uint m_enforced_flags
Instrument enforced flags.
Definition: pfs_instr_class.h:222
bool is_mutable() const
Definition: pfs_instr_class.h:241
bool is_shared_exclusive() const
Definition: pfs_instr_class.h:245
int m_volatility
Volatility index.
Definition: pfs_instr_class.h:224
void enforce_valid_flags(uint allowed_flags)
Definition: pfs_instr_class.h:275
bool is_system_thread() const
Definition: pfs_instr_class.h:253
bool has_seqnum() const
Definition: pfs_instr_class.h:257
User-defined instrument configuration.
Definition: pfs_instr_class.h:138
uint m_name_length
Definition: pfs_instr_class.h:142
bool m_enabled
Enabled flag.
Definition: pfs_instr_class.h:144
bool m_timed
Timed flag.
Definition: pfs_instr_class.h:146
char * m_name
Definition: pfs_instr_class.h:140
Instrumentation metadata for a memory.
Definition: pfs_instr_class.h:626
Instrumentation metadata for a meter.
Definition: pfs_instr_class.h:395
uint m_description_length
Definition: pfs_instr_class.h:405
uint m_metrics_size
Definition: pfs_instr_class.h:410
uint m_meter_length
Definition: pfs_instr_class.h:400
const char * m_description
Meter description with length.
Definition: pfs_instr_class.h:404
PSI_metric_key * m_metrics
Metrics belonging to this meter.
Definition: pfs_instr_class.h:409
PSI_meter_key m_key
Definition: pfs_instr_class.h:406
pfs_lock m_lock
Definition: pfs_instr_class.h:396
const char * m_meter
Meter name with length.
Definition: pfs_instr_class.h:399
uint m_frequency
Meter export frequency in seconds.
Definition: pfs_instr_class.h:402
Instrumentation metadata for a metric.
Definition: pfs_instr_class.h:372
const char * m_group
Metric group with length.
Definition: pfs_instr_class.h:379
uint m_description_length
Definition: pfs_instr_class.h:386
uint m_group_length
Definition: pfs_instr_class.h:380
MetricNumType m_num_type
Definition: pfs_instr_class.h:387
PSI_metric_key m_key
Definition: pfs_instr_class.h:389
const char * m_description
Metric description with length.
Definition: pfs_instr_class.h:385
uint m_metric_length
Definition: pfs_instr_class.h:377
measurement_callback_t m_measurement_callback
Definition: pfs_instr_class.h:390
MetricOTELType m_metric_type
Definition: pfs_instr_class.h:388
uint m_unit_length
Definition: pfs_instr_class.h:383
pfs_lock m_lock
Definition: pfs_instr_class.h:373
const char * m_unit
Metric unit with length.
Definition: pfs_instr_class.h:382
void * m_measurement_context
Definition: pfs_instr_class.h:391
const char * m_metric
Metric name with length.
Definition: pfs_instr_class.h:376
Instrumentation metadata for a mutex.
Definition: pfs_instr_class.h:329
PFS_mutex_stat m_mutex_stat
Mutex usage statistics.
Definition: pfs_instr_class.h:331
PFS_mutex * m_singleton
Singleton instance.
Definition: pfs_instr_class.h:333
Statistics for mutex usage.
Definition: pfs_stat.h:177
Instrumented mutex implementation.
Definition: pfs_instr.h:103
Instrumentation metadata for a read write lock.
Definition: pfs_instr_class.h:339
PFS_rwlock * m_singleton
Singleton instance.
Definition: pfs_instr_class.h:343
PFS_rwlock_stat m_rwlock_stat
Rwlock usage statistics.
Definition: pfs_instr_class.h:341
Statistics for rwlock usage.
Definition: pfs_stat.h:204
Instrumented rwlock implementation.
Definition: pfs_instr.h:129
Definition: pfs_name.h:188
Single statistic.
Definition: pfs_stat.h:52
Instrumentation metadata for a socket.
Definition: pfs_instr_class.h:618
PFS_socket_stat m_socket_stat
Socket usage statistics.
Definition: pfs_instr_class.h:620
PFS_socket * m_singleton
Singleton instance.
Definition: pfs_instr_class.h:622
Statistics for SOCKET usage.
Definition: pfs_stat.h:875
Instrumented socket implementation.
Definition: pfs_instr.h:289
Instrumentation metadata for a stage.
Definition: pfs_instr_class.h:597
uint m_prefix_length
Length of the "stage/<component>/" prefix.
Definition: pfs_instr_class.h:602
PFS_stage_stat m_stage_stat
Stage usage statistics.
Definition: pfs_instr_class.h:604
Statistics for stage usage.
Definition: pfs_stat.h:323
Instrumentation metadata for a statement.
Definition: pfs_instr_class.h:608
Single table I/O statistic.
Definition: pfs_stat.h:648
Table index or 'key'.
Definition: pfs_instr_class.h:426
uint m_name_length
Length in bytes of m_name.
Definition: pfs_instr_class.h:430
char m_name[NAME_LEN]
Index name.
Definition: pfs_instr_class.h:428
Statistics for table locks.
Definition: pfs_stat.h:710
Definition: pfs_name.h:236
Index statistics of a table.
Definition: pfs_instr_class.h:434
PFS_table_key m_key
The index name.
Definition: pfs_instr_class.h:437
PFS_table_io_stat m_stat
The index stat.
Definition: pfs_instr_class.h:439
pfs_lock m_lock
Definition: pfs_instr_class.h:435
PFS_table_share * m_owner
Owner table share.
Definition: pfs_instr_class.h:441
PFS_opaque_container_page * m_page
Container page.
Definition: pfs_instr_class.h:443
Key identifying a table share.
Definition: pfs_instr_class.h:414
PFS_schema_name m_schema_name
Table schema.
Definition: pfs_instr_class.h:419
PFS_table_name m_table_name
Table name.
Definition: pfs_instr_class.h:422
enum_object_type m_type
Object type.
Definition: pfs_instr_class.h:416
Lock statistics of a table.
Definition: pfs_instr_class.h:447
PFS_opaque_container_page * m_page
Container page.
Definition: pfs_instr_class.h:454
pfs_lock m_lock
Definition: pfs_instr_class.h:448
PFS_table_share * m_owner
Owner table share.
Definition: pfs_instr_class.h:452
PFS_table_lock_stat m_stat
Lock stats.
Definition: pfs_instr_class.h:450
Instrumentation metadata for a table share.
Definition: pfs_instr_class.h:458
PFS_table_share_key m_key
Search key.
Definition: pfs_instr_class.h:500
std::atomic< PFS_table_share_lock * > m_race_lock_stat
Table locks statistics.
Definition: pfs_instr_class.h:520
uint32 get_version()
Definition: pfs_instr_class.h:460
enum_object_type get_object_type() const
Definition: pfs_instr_class.h:462
bool m_timed
True if table instrumentation is timed.
Definition: pfs_instr_class.h:497
bool m_enabled
True if table instrumentation is enabled.
Definition: pfs_instr_class.h:492
void inc_refcount()
Definition: pfs_instr_class.h:480
PFS_opaque_container_page * m_page
Container page.
Definition: pfs_instr_class.h:505
void aggregate()
Definition: pfs_instr_class.h:471
int get_refcount()
Definition: pfs_instr_class.h:478
void init_refcount()
Definition: pfs_instr_class.h:476
std::atomic< int > m_refcount
Number of opened table handles.
Definition: pfs_instr_class.h:518
uint m_key_count
Number of indexes.
Definition: pfs_instr_class.h:503
void dec_refcount()
Definition: pfs_instr_class.h:482
pfs_lock m_lock
Internal lock.
Definition: pfs_instr_class.h:487
Instrumentation metadata of a thread.
Definition: pfs_instr_class.h:360
PFS_thread * m_singleton
Singleton instance.
Definition: pfs_instr_class.h:362
std::atomic< unsigned int > m_seqnum
Thread instance sequence number counter.
Definition: pfs_instr_class.h:368
Instrumented thread implementation.
Definition: pfs_instr.h:375
Instrumentation metadata for a transaction.
Definition: pfs_instr_class.h:611
Statistics for transaction usage.
Definition: pfs_stat.h:459
Condition information.
Definition: psi_cond_bits.h:88
File instrument information.
Definition: psi_file_bits.h:114
Memory instrument information.
Definition: psi_memory_bits.h:58
Define a meter source, storing char pointers requires the original strings to be valid for entire lif...
Definition: psi_metric_bits.h:143
Define a metric source, storing char pointers requires the original strings to be valid for entire li...
Definition: psi_metric_bits.h:124
Mutex information.
Definition: psi_mutex_bits.h:73
Rwlock information.
Definition: psi_rwlock_bits.h:162
Socket instrument information.
Definition: psi_socket_bits.h:128
Stage instrument information.
Definition: psi_stage_bits.h:74
Statement instrument information.
Definition: psi_statement_bits.h:133
Thread instrument information.
Definition: psi_thread_bits.h:117
This structure is shared between different table objects.
Definition: table.h:701
A 'lock' protecting performance schema internal buffers.
Definition: pfs_lock.h:154