MySQL  8.0.27
Source Code Documentation
psi_stage_bits.h
Go to the documentation of this file.
1 /* Copyright (c) 2008, 2021, Oracle and/or its affiliates.
2 
3  This program is free software; you can redistribute it and/or modify
4  it under the terms of the GNU General Public License, version 2.0,
5  as published by the Free Software Foundation.
6 
7  This program is also distributed with certain software (including
8  but not limited to OpenSSL) that is licensed under separate terms,
9  as designated in a particular file or component or in included license
10  documentation. The authors of MySQL hereby grant you an additional
11  permission to link the program and your derivative works with the
12  separately licensed software that they have included with MySQL.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License, version 2.0, for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program; if not, write to the Free Software
21  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 
23 #ifndef COMPONENTS_SERVICES_PSI_STAGE_BITS_H
24 #define COMPONENTS_SERVICES_PSI_STAGE_BITS_H
25 
27 
28 /**
29  @file
30  Performance schema instrumentation interface.
31 
32  @defgroup psi_abi_stage Stage Instrumentation (ABI)
33  @ingroup psi_abi
34  @{
35 */
36 
37 /**
38  Instrumented stage key.
39  To instrument a stage, a stage key must be obtained using @c register_stage.
40  Using a zero key always disable the instrumentation.
41 */
42 typedef unsigned int PSI_stage_key;
43 
44 /**
45  @def PSI_STAGE_VERSION_1
46  Performance Schema Stage Interface number for version 1.
47  This version is supported.
48 */
49 #define PSI_STAGE_VERSION_1 1
50 
51 /**
52  @def PSI_CURRENT_STAGE_VERSION
53  Performance Schema Stage Interface number for the most recent version.
54  The most current version is @c PSI_STAGE_VERSION_1
55 */
56 #define PSI_CURRENT_STAGE_VERSION 1
57 
58 /**
59  Interface for an instrumented stage progress.
60  This is a public structure, for efficiency.
61 */
63  unsigned long long m_work_completed;
64  unsigned long long m_work_estimated;
65 };
67 
68 /**
69  Stage instrument information.
70  @since PSI_STAGE_VERSION_1
71  This structure is used to register an instrumented stage.
72 */
74  /** The registered stage key. */
76  /** The name of the stage instrument to register. */
77  const char *m_name{nullptr};
78  /**
79  The flags of the stage instrument to register.
80  @sa PSI_FLAG_PROGRESS
81  */
82  unsigned int m_flags{0};
83  /** Documentation. */
84  const char *m_documentation{nullptr};
85 };
87 
88 /**
89  Stage registration API.
90  @param category a category name
91  @param info an array of stage info to register
92  @param count the size of the info array
93 */
94 typedef void (*register_stage_v1_t)(const char *category,
95  struct PSI_stage_info_v1 **info, int count);
96 
97 /**
98  Start a new stage, and implicitly end the previous stage.
99  @param key the key of the new stage
100  @param src_file the source file name
101  @param src_line the source line number
102  @return the new stage progress
103 */
104 typedef PSI_stage_progress_v1 *(*start_stage_v1_t)(PSI_stage_key key,
105  const char *src_file,
106  int src_line);
107 
108 /**
109  Get the current stage progress.
110  @return the stage progress
111 */
112 typedef PSI_stage_progress_v1 *(*get_current_stage_progress_v1_t)(void);
113 
114 /** End the current stage. */
115 typedef void (*end_stage_v1_t)(void);
116 
117 typedef struct PSI_stage_info_v1 PSI_stage_info;
119 
120 /** @} (end of group psi_abi_stage) */
121 
122 #endif /* COMPONENTS_SERVICES_PSI_STAGE_BITS_H */
unsigned int PSI_stage_key
Instrumented stage key.
Definition: psi_stage_bits.h:42
void(* register_stage_v1_t)(const char *category, struct PSI_stage_info_v1 **info, int count)
Stage registration API.
Definition: psi_stage_bits.h:94
void(* end_stage_v1_t)(void)
End the current stage.
Definition: psi_stage_bits.h:115
static int count
Definition: myisam_ftdump.cc:42
Log info(cout, "NOTE")
static const char * category
Definition: sha2_password.cc:168
Performance schema instrumentation interface.
required string key
Definition: replication_asynchronous_connection_failover.proto:59
Stage instrument information.
Definition: psi_stage_bits.h:73
unsigned int m_flags
The flags of the stage instrument to register.
Definition: psi_stage_bits.h:82
PSI_stage_key m_key
The registered stage key.
Definition: psi_stage_bits.h:75
const char * m_name
The name of the stage instrument to register.
Definition: psi_stage_bits.h:77
const char * m_documentation
Documentation.
Definition: psi_stage_bits.h:84
Interface for an instrumented stage progress.
Definition: psi_stage_bits.h:62
unsigned long long m_work_estimated
Definition: psi_stage_bits.h:64
unsigned long long m_work_completed
Definition: psi_stage_bits.h:63