1 /* Copyright (c) 2008, 2020, Oracle and/or its affiliates. All rights reserved. 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_MDL_BITS_H 24 #define COMPONENTS_SERVICES_PSI_MDL_BITS_H 25 26 /** 27 @file 28 Performance schema instrumentation interface. 29 30 @defgroup psi_abi_mdl Metadata Lock Instrumentation (ABI) 31 @ingroup psi_abi 32 @{ 33 */ 34 35 struct MDL_key; 36 37 /** @sa enum_mdl_type. */ 38 typedef int opaque_mdl_type; 39 40 /** @sa enum_mdl_duration. */ 41 typedef int opaque_mdl_duration; 42 43 /** @sa MDL_wait::enum_wait_status. */ 44 typedef int opaque_mdl_status; 45 46 /** 47 Interface for an instrumented metadata lock. 48 This is an opaque structure. 49 */ 50 struct PSI_metadata_lock; 51 typedef struct PSI_metadata_lock PSI_metadata_lock; 52 53 /** 54 Interface for an instrumented MDL operation. 55 This is an opaque structure. 56 */ 57 struct PSI_metadata_locker; 58 typedef struct PSI_metadata_locker PSI_metadata_locker; 59 60 /** 61 State data storage for @c start_metadata_wait_v1_t. 62 This structure provide temporary storage to a metadata locker. 63 The content of this structure is considered opaque, 64 the fields are only hints of what an implementation 65 of the psi interface can use. 66 This memory is provided by the instrumented code for performance reasons. 67 @sa start_metadata_wait_v1_t 68 */ 69 struct PSI_metadata_locker_state_v1 { 70 /** Internal state. */ 71 unsigned int m_flags; 72 /** Current metadata lock. */ 73 struct PSI_metadata_lock *m_metadata_lock; 74 /** Current thread. */ 75 struct PSI_thread *m_thread; 76 /** Timer start. */ 77 unsigned long long m_timer_start; 78 /** Timer function. */ 79 unsigned long long (*m_timer)(void); 80 /** Internal data. */ 81 void *m_wait; 82 }; 83 typedef struct PSI_metadata_locker_state_v1 PSI_metadata_locker_state_v1; 84 85 typedef PSI_metadata_lock *(*create_metadata_lock_v1_t)( 86 void *identity, const struct MDL_key *key, opaque_mdl_type mdl_type, 87 opaque_mdl_duration mdl_duration, opaque_mdl_status mdl_status, 88 const char *src_file, unsigned int src_line); 89 90 typedef void (*set_metadata_lock_status_v1_t)(PSI_metadata_lock *lock, 91 opaque_mdl_status mdl_status); 92 93 typedef void (*destroy_metadata_lock_v1_t)(PSI_metadata_lock *lock); 94 95 typedef struct PSI_metadata_locker *(*start_metadata_wait_v1_t)( 96 struct PSI_metadata_locker_state_v1 *state, struct PSI_metadata_lock *mdl, 97 const char *src_file, unsigned int src_line); 98 99 typedef void (*end_metadata_wait_v1_t)(struct PSI_metadata_locker *locker, 100 int rc); 101 102 typedef struct PSI_metadata_locker_state_v1 PSI_metadata_locker_state; 103 104 /** @} (end of group psi_abi_mdl) */ 105 106 #endif /* COMPONENTS_SERVICES_PSI_MDL_BITS_H */ 107