| 1 | /***************************************************************************** |
| 2 | |
| 3 | Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. |
| 4 | Copyright (c) 2008, Google Inc. |
| 5 | Copyright (c) 2012, Facebook Inc. |
| 6 | |
| 7 | Portions of this file contain modifications contributed and copyrighted by |
| 8 | Google, Inc. Those modifications are gratefully acknowledged and are described |
| 9 | briefly in the InnoDB documentation. The contributions by Google are |
| 10 | incorporated with their permission, and subject to the conditions contained in |
| 11 | the file COPYING.Google. |
| 12 | |
| 13 | This program is free software; you can redistribute it and/or modify it under |
| 14 | the terms of the GNU General Public License as published by the Free Software |
| 15 | Foundation; version 2 of the License. |
| 16 | |
| 17 | This program is distributed in the hope that it will be useful, but WITHOUT |
| 18 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 19 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
| 20 | |
| 21 | You should have received a copy of the GNU General Public License along with |
| 22 | this program; if not, write to the Free Software Foundation, Inc., |
| 23 | 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA |
| 24 | |
| 25 | *****************************************************************************/ |
| 26 | |
| 27 | /**************************************************//** |
| 28 | @file include/sync0sync.h |
| 29 | Mutex, the basic synchronization primitive |
| 30 | |
| 31 | Created 9/5/1995 Heikki Tuuri |
| 32 | *******************************************************/ |
| 33 | |
| 34 | #ifndef sync0sync_h |
| 35 | #define sync0sync_h |
| 36 | |
| 37 | #include "univ.i" |
| 38 | #include "ut0counter.h" |
| 39 | |
| 40 | #if defined UNIV_PFS_MUTEX || defined UNIV_PFS_RWLOCK |
| 41 | |
| 42 | /* By default, buffer mutexes and rwlocks will be excluded from |
| 43 | instrumentation due to their large number of instances. */ |
| 44 | # define PFS_SKIP_BUFFER_MUTEX_RWLOCK |
| 45 | |
| 46 | /* By default, event->mutex will also be excluded from instrumentation */ |
| 47 | # define PFS_SKIP_EVENT_MUTEX |
| 48 | |
| 49 | #endif /* UNIV_PFS_MUTEX || UNIV_PFS_RWLOCK */ |
| 50 | |
| 51 | #ifdef UNIV_PFS_MUTEX |
| 52 | /* Key defines to register InnoDB mutexes with performance schema */ |
| 53 | extern mysql_pfs_key_t autoinc_mutex_key; |
| 54 | extern mysql_pfs_key_t buffer_block_mutex_key; |
| 55 | extern mysql_pfs_key_t buf_pool_mutex_key; |
| 56 | extern mysql_pfs_key_t buf_pool_zip_mutex_key; |
| 57 | extern mysql_pfs_key_t cache_last_read_mutex_key; |
| 58 | extern mysql_pfs_key_t dict_foreign_err_mutex_key; |
| 59 | extern mysql_pfs_key_t dict_sys_mutex_key; |
| 60 | extern mysql_pfs_key_t fil_system_mutex_key; |
| 61 | extern mysql_pfs_key_t flush_list_mutex_key; |
| 62 | extern mysql_pfs_key_t fts_bg_threads_mutex_key; |
| 63 | extern mysql_pfs_key_t fts_delete_mutex_key; |
| 64 | extern mysql_pfs_key_t fts_optimize_mutex_key; |
| 65 | extern mysql_pfs_key_t fts_doc_id_mutex_key; |
| 66 | extern mysql_pfs_key_t fts_pll_tokenize_mutex_key; |
| 67 | extern mysql_pfs_key_t hash_table_mutex_key; |
| 68 | extern mysql_pfs_key_t ibuf_bitmap_mutex_key; |
| 69 | extern mysql_pfs_key_t ibuf_mutex_key; |
| 70 | extern mysql_pfs_key_t ibuf_pessimistic_insert_mutex_key; |
| 71 | extern mysql_pfs_key_t log_sys_mutex_key; |
| 72 | extern mysql_pfs_key_t log_sys_write_mutex_key; |
| 73 | extern mysql_pfs_key_t log_cmdq_mutex_key; |
| 74 | extern mysql_pfs_key_t log_flush_order_mutex_key; |
| 75 | extern mysql_pfs_key_t mutex_list_mutex_key; |
| 76 | extern mysql_pfs_key_t recalc_pool_mutex_key; |
| 77 | extern mysql_pfs_key_t page_cleaner_mutex_key; |
| 78 | extern mysql_pfs_key_t purge_sys_pq_mutex_key; |
| 79 | extern mysql_pfs_key_t recv_sys_mutex_key; |
| 80 | extern mysql_pfs_key_t recv_writer_mutex_key; |
| 81 | extern mysql_pfs_key_t rtr_active_mutex_key; |
| 82 | extern mysql_pfs_key_t rtr_match_mutex_key; |
| 83 | extern mysql_pfs_key_t rtr_path_mutex_key; |
| 84 | extern mysql_pfs_key_t rtr_ssn_mutex_key; |
| 85 | extern mysql_pfs_key_t redo_rseg_mutex_key; |
| 86 | extern mysql_pfs_key_t noredo_rseg_mutex_key; |
| 87 | extern mysql_pfs_key_t page_zip_stat_per_index_mutex_key; |
| 88 | # ifdef UNIV_DEBUG |
| 89 | extern mysql_pfs_key_t rw_lock_debug_mutex_key; |
| 90 | # endif /* UNIV_DEBUG */ |
| 91 | extern mysql_pfs_key_t rw_lock_list_mutex_key; |
| 92 | extern mysql_pfs_key_t rw_lock_mutex_key; |
| 93 | extern mysql_pfs_key_t srv_innodb_monitor_mutex_key; |
| 94 | extern mysql_pfs_key_t srv_misc_tmpfile_mutex_key; |
| 95 | extern mysql_pfs_key_t srv_monitor_file_mutex_key; |
| 96 | extern mysql_pfs_key_t buf_dblwr_mutex_key; |
| 97 | extern mysql_pfs_key_t trx_mutex_key; |
| 98 | extern mysql_pfs_key_t trx_pool_mutex_key; |
| 99 | extern mysql_pfs_key_t trx_pool_manager_mutex_key; |
| 100 | extern mysql_pfs_key_t lock_mutex_key; |
| 101 | extern mysql_pfs_key_t lock_wait_mutex_key; |
| 102 | extern mysql_pfs_key_t trx_sys_mutex_key; |
| 103 | extern mysql_pfs_key_t srv_sys_mutex_key; |
| 104 | extern mysql_pfs_key_t srv_threads_mutex_key; |
| 105 | extern mysql_pfs_key_t event_mutex_key; |
| 106 | extern mysql_pfs_key_t event_manager_mutex_key; |
| 107 | extern mysql_pfs_key_t sync_array_mutex_key; |
| 108 | extern mysql_pfs_key_t thread_mutex_key; |
| 109 | extern mysql_pfs_key_t zip_pad_mutex_key; |
| 110 | extern mysql_pfs_key_t row_drop_list_mutex_key; |
| 111 | extern mysql_pfs_key_t rw_trx_hash_element_mutex_key; |
| 112 | #endif /* UNIV_PFS_MUTEX */ |
| 113 | |
| 114 | #ifdef UNIV_PFS_RWLOCK |
| 115 | /* Following are rwlock keys used to register with MySQL |
| 116 | performance schema */ |
| 117 | extern mysql_pfs_key_t btr_search_latch_key; |
| 118 | extern mysql_pfs_key_t buf_block_lock_key; |
| 119 | # ifdef UNIV_DEBUG |
| 120 | extern mysql_pfs_key_t buf_block_debug_latch_key; |
| 121 | # endif /* UNIV_DEBUG */ |
| 122 | extern mysql_pfs_key_t dict_operation_lock_key; |
| 123 | extern mysql_pfs_key_t checkpoint_lock_key; |
| 124 | extern mysql_pfs_key_t fil_space_latch_key; |
| 125 | extern mysql_pfs_key_t fts_cache_rw_lock_key; |
| 126 | extern mysql_pfs_key_t fts_cache_init_rw_lock_key; |
| 127 | extern mysql_pfs_key_t trx_i_s_cache_lock_key; |
| 128 | extern mysql_pfs_key_t trx_purge_latch_key; |
| 129 | extern mysql_pfs_key_t index_tree_rw_lock_key; |
| 130 | extern mysql_pfs_key_t index_online_log_key; |
| 131 | extern mysql_pfs_key_t dict_table_stats_key; |
| 132 | extern mysql_pfs_key_t trx_sys_rw_lock_key; |
| 133 | extern mysql_pfs_key_t hash_table_locks_key; |
| 134 | #endif /* UNIV_PFS_RWLOCK */ |
| 135 | |
| 136 | /** Prints info of the sync system. |
| 137 | @param[in] file where to print */ |
| 138 | void |
| 139 | sync_print(FILE* file); |
| 140 | |
| 141 | #endif /* !sync0sync_h */ |
| 142 | |