24#ifndef PFS_INSTR_CLASS_H
25#define PFS_INSTR_CLASS_H
40#include "mysqld_error.h"
60#define PFS_MAX_INFO_NAME_LENGTH 128
68#define PFS_MAX_OS_NAME_LENGTH 16
77#define PFS_MAX_FULL_PREFIX_NAME_LENGTH 32
81class PFS_opaque_container_page;
228 const char *
str()
const;
315 const uint valid_flags =
m_flags & allowed_flags;
321 assert(valid_flags ==
m_flags);
360#define PFS_MUTEX_PARTITIONS 2
398 bool m_history{
false};
410 const char *m_metric{
nullptr};
411 uint m_metric_length{0};
413 const char *m_group{
nullptr};
414 uint m_group_length{0};
416 const char *m_unit{
nullptr};
417 uint m_unit_length{0};
419 const char *m_description{
nullptr};
420 uint m_description_length{0};
425 void *m_measurement_context{
nullptr};
433 const char *m_meter{
nullptr};
434 uint m_meter_length{0};
438 const char *m_description{
nullptr};
439 uint m_description_length{0};
444 uint m_metrics_size{0};
452 char m_logger_name[64];
453 uint m_logger_name_length{0};
456 char m_description[1024];
457 uint m_description_length{0};
520 void aggregate_lock();
539 void refresh_setup_object_flags(
PFS_thread *thread);
564 void destroy_lock_stat();
569 void destroy_index_stats();
577 std::atomic<PFS_table_share_index *> m_race_index_stat[
MAX_INDEXES + 1];
600#define GLOBAL_TABLE_IO_EVENT_INDEX 0
601#define GLOBAL_TABLE_LOCK_EVENT_INDEX 1
602#define GLOBAL_IDLE_EVENT_INDEX 2
603#define GLOBAL_METADATA_EVENT_INDEX 3
605#define COUNT_GLOBAL_EVENT_INDEX 4
608#define GLOBAL_TRANSACTION_INDEX 0
610#define GLOBAL_ERROR_INDEX 0
688 uint cond_class_sizing);
806 const char *schema_name, uint schema_name_length,
807 const char *
table_name, uint table_name_length);
Encapsulates the name of an instrumented entity.
Definition: pfs_instr_class.h:200
const char * m_private_old_name
Old instrument name, if any.
Definition: pfs_instr_class.h:220
terminology_use_previous::enum_compatibility_version m_private_version
The oldest version that uses the new name.
Definition: pfs_instr_class.h:224
uint m_private_old_name_length
Length in bytes of old instrument name len, if any.
Definition: pfs_instr_class.h:222
static constexpr uint max_length
Definition: pfs_instr_class.h:202
uint m_private_name_length
Length in bytes of m_name.
Definition: pfs_instr_class.h:218
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:1053
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
static PSI_meter_info_v1 meter[]
Definition: plugin.cc:96
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:227
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:68
#define PFS_MAX_INFO_NAME_LENGTH
Maximum length of an instrument name.
Definition: pfs_instr_class.h:60
Performance schema internal locks (declarations).
Object names (declarations).
Statistics (declarations).
MetricOTELType
Definition: psi_metric_bits.h:32
@ ASYNC_COUNTER
Definition: psi_metric_bits.h:33
unsigned int PSI_meter_key
Definition: psi_metric_bits.h:101
MetricNumType
Definition: psi_metric_bits.h:38
@ METRIC_INTEGER
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
OTELLogLevel
Log levels as supported by opentelemetry-cpp (+ "none"), see: api/include/opentelemetry/logs/severity...
Definition: server_telemetry_logs_client_bits.h:43
unsigned int PSI_logger_key
Definition: server_telemetry_logs_client_bits.h:45
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:383
PFS_cond_stat m_cond_stat
Condition usage statistics.
Definition: pfs_instr_class.h:388
PFS_cond * m_singleton
Singleton instance.
Definition: pfs_instr_class.h:390
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:635
Statistics for all server errors.
Definition: pfs_stat.h:557
Instrumentation metadata for a file.
Definition: pfs_instr_class.h:644
PFS_file * m_singleton
Singleton instance.
Definition: pfs_instr_class.h:648
PFS_file_stat m_file_stat
File usage statistics.
Definition: pfs_instr_class.h:646
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:124
Information for all instrumentation.
Definition: pfs_instr_class.h:248
bool is_deferred() const
Definition: pfs_instr_class.h:328
bool m_enabled
True if this instrument is enabled.
Definition: pfs_instr_class.h:252
static void set_enabled(PFS_instr_class *pfs, bool enabled)
uint m_flags
Instrument flags.
Definition: pfs_instr_class.h:256
bool is_untimed() const
Definition: pfs_instr_class.h:307
bool is_singleton() const
Definition: pfs_instr_class.h:275
PFS_class_type m_type
Class type.
Definition: pfs_instr_class.h:250
bool is_priority() const
Definition: pfs_instr_class.h:283
static void set_timed(PFS_instr_class *pfs, bool timed)
void set_enforced_flags(uint flags)
Definition: pfs_instr_class.h:309
bool is_progress() const
Definition: pfs_instr_class.h:279
bool can_be_timed() const
Definition: pfs_instr_class.h:337
bool is_transferable() const
Definition: pfs_instr_class.h:285
bool has_enforced_memory_cnt() const
Definition: pfs_instr_class.h:301
PFS_instr_name m_name
Instrument name.
Definition: pfs_instr_class.h:271
bool has_default_memory_cnt() const
Definition: pfs_instr_class.h:299
uint m_event_name_index
Instrument name index.
Definition: pfs_instr_class.h:269
bool has_auto_seqnum() const
Definition: pfs_instr_class.h:297
bool is_disabled() const
Definition: pfs_instr_class.h:305
bool m_timed
True if this instrument is timed.
Definition: pfs_instr_class.h:254
bool can_be_enforced() const
Definition: pfs_instr_class.h:348
bool is_global() const
Definition: pfs_instr_class.h:291
char * m_documentation
Documentation.
Definition: pfs_instr_class.h:273
bool is_user() const
Definition: pfs_instr_class.h:287
uint m_enforced_flags
Instrument enforced flags.
Definition: pfs_instr_class.h:258
bool is_mutable() const
Definition: pfs_instr_class.h:277
bool is_shared_exclusive() const
Definition: pfs_instr_class.h:281
int m_volatility
Volatility index.
Definition: pfs_instr_class.h:260
void enforce_valid_flags(uint allowed_flags)
Definition: pfs_instr_class.h:311
bool is_system_thread() const
Definition: pfs_instr_class.h:289
bool has_seqnum() const
Definition: pfs_instr_class.h:293
User-defined instrument configuration.
Definition: pfs_instr_class.h:142
uint m_name_length
Definition: pfs_instr_class.h:146
bool m_enabled
Enabled flag.
Definition: pfs_instr_class.h:148
bool m_timed
Timed flag.
Definition: pfs_instr_class.h:150
char * m_name
Definition: pfs_instr_class.h:144
Instrumentation metadata for a telemetry logger.
Definition: pfs_instr_class.h:448
OTELLogLevel m_level
Logging level for this logger.
Definition: pfs_instr_class.h:460
pfs_lock m_lock
Definition: pfs_instr_class.h:449
std::atomic< OTELLogLevel > m_effective_level
Logging level for this logger with backend availability accounted for.
Definition: pfs_instr_class.h:463
User-defined logger configuration.
Definition: pfs_instr_class.h:176
OTELLogLevel m_level
Log level.
Definition: pfs_instr_class.h:182
char * m_name
Definition: pfs_instr_class.h:178
uint m_name_length
Definition: pfs_instr_class.h:180
Instrumentation metadata for a memory.
Definition: pfs_instr_class.h:681
Instrumentation metadata for a meter.
Definition: pfs_instr_class.h:429
pfs_lock m_lock
Definition: pfs_instr_class.h:430
User-defined meter configuration.
Definition: pfs_instr_class.h:157
bool m_enabled_set
Was enabled flag modified.
Definition: pfs_instr_class.h:165
bool m_enabled
Enabled flag.
Definition: pfs_instr_class.h:163
uint m_frequency
Frequency value.
Definition: pfs_instr_class.h:167
char * m_name
Definition: pfs_instr_class.h:159
bool m_frequency_set
Was frequency property modified.
Definition: pfs_instr_class.h:169
uint m_name_length
Definition: pfs_instr_class.h:161
Instrumentation metadata for a metric.
Definition: pfs_instr_class.h:406
measurement_callback_t m_measurement_callback
Definition: pfs_instr_class.h:424
pfs_lock m_lock
Definition: pfs_instr_class.h:407
Instrumentation metadata for a mutex.
Definition: pfs_instr_class.h:363
PFS_mutex_stat m_mutex_stat
Mutex usage statistics.
Definition: pfs_instr_class.h:365
PFS_mutex * m_singleton
Singleton instance.
Definition: pfs_instr_class.h:367
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:373
PFS_rwlock * m_singleton
Singleton instance.
Definition: pfs_instr_class.h:377
PFS_rwlock_stat m_rwlock_stat
Rwlock usage statistics.
Definition: pfs_instr_class.h:375
Statistics for rwlock usage.
Definition: pfs_stat.h:204
Instrumented rwlock implementation.
Definition: pfs_instr.h:129
Definition: pfs_name.h:194
Single statistic.
Definition: pfs_stat.h:52
Instrumentation metadata for a socket.
Definition: pfs_instr_class.h:673
PFS_socket_stat m_socket_stat
Socket usage statistics.
Definition: pfs_instr_class.h:675
PFS_socket * m_singleton
Singleton instance.
Definition: pfs_instr_class.h:677
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:652
uint m_prefix_length
Length of the "stage/<component>/" prefix.
Definition: pfs_instr_class.h:657
PFS_stage_stat m_stage_stat
Stage usage statistics.
Definition: pfs_instr_class.h:659
Statistics for stage usage.
Definition: pfs_stat.h:323
Instrumentation metadata for a statement.
Definition: pfs_instr_class.h:663
Single table I/O statistic.
Definition: pfs_stat.h:648
Table index or 'key'.
Definition: pfs_instr_class.h:481
uint m_name_length
Length in bytes of m_name.
Definition: pfs_instr_class.h:485
char m_name[NAME_LEN]
Index name.
Definition: pfs_instr_class.h:483
Statistics for table locks.
Definition: pfs_stat.h:710
Definition: pfs_name.h:242
Index statistics of a table.
Definition: pfs_instr_class.h:489
PFS_table_key m_key
The index name.
Definition: pfs_instr_class.h:492
PFS_table_io_stat m_stat
The index stat.
Definition: pfs_instr_class.h:494
pfs_lock m_lock
Definition: pfs_instr_class.h:490
PFS_table_share * m_owner
Owner table share.
Definition: pfs_instr_class.h:496
PFS_opaque_container_page * m_page
Container page.
Definition: pfs_instr_class.h:498
Key identifying a table share.
Definition: pfs_instr_class.h:469
PFS_schema_name m_schema_name
Table schema.
Definition: pfs_instr_class.h:474
PFS_table_name m_table_name
Table name.
Definition: pfs_instr_class.h:477
enum_object_type m_type
Object type.
Definition: pfs_instr_class.h:471
Lock statistics of a table.
Definition: pfs_instr_class.h:502
PFS_opaque_container_page * m_page
Container page.
Definition: pfs_instr_class.h:509
pfs_lock m_lock
Definition: pfs_instr_class.h:503
PFS_table_share * m_owner
Owner table share.
Definition: pfs_instr_class.h:507
PFS_table_lock_stat m_stat
Lock stats.
Definition: pfs_instr_class.h:505
Instrumentation metadata for a table share.
Definition: pfs_instr_class.h:513
PFS_table_share_key m_key
Search key.
Definition: pfs_instr_class.h:555
std::atomic< PFS_table_share_lock * > m_race_lock_stat
Table locks statistics.
Definition: pfs_instr_class.h:575
uint32 get_version()
Definition: pfs_instr_class.h:515
enum_object_type get_object_type() const
Definition: pfs_instr_class.h:517
bool m_timed
True if table instrumentation is timed.
Definition: pfs_instr_class.h:552
bool m_enabled
True if table instrumentation is enabled.
Definition: pfs_instr_class.h:547
void inc_refcount()
Definition: pfs_instr_class.h:535
PFS_opaque_container_page * m_page
Container page.
Definition: pfs_instr_class.h:560
void aggregate()
Definition: pfs_instr_class.h:526
int get_refcount()
Definition: pfs_instr_class.h:533
void init_refcount()
Definition: pfs_instr_class.h:531
std::atomic< int > m_refcount
Number of opened table handles.
Definition: pfs_instr_class.h:573
uint m_key_count
Number of indexes.
Definition: pfs_instr_class.h:558
void dec_refcount()
Definition: pfs_instr_class.h:537
pfs_lock m_lock
Internal lock.
Definition: pfs_instr_class.h:542
Instrumentation metadata of a thread.
Definition: pfs_instr_class.h:394
PFS_thread * m_singleton
Singleton instance.
Definition: pfs_instr_class.h:396
std::atomic< unsigned int > m_seqnum
Thread instance sequence number counter.
Definition: pfs_instr_class.h:402
Instrumented thread implementation.
Definition: pfs_instr.h:375
Instrumentation metadata for a transaction.
Definition: pfs_instr_class.h:666
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
Defines a logger from the side of instrumented code (log API client).
Definition: server_telemetry_logs_client_bits.h:57
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:704
A 'lock' protecting performance schema internal buffers.
Definition: pfs_lock.h:154