1 /*********************************************************************** 2 3 Copyright (c) 2010, 2020, Oracle and/or its affiliates. All Rights Reserved. 4 Copyright (c) 2012, Facebook Inc. 5 6 This program is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License, version 2.0, 8 as published by the Free Software Foundation. 9 10 This program is also distributed with certain software (including 11 but not limited to OpenSSL) that is licensed under separate terms, 12 as designated in a particular file or component or in included license 13 documentation. The authors of MySQL hereby grant you an additional 14 permission to link the program and your derivative works with the 15 separately licensed software that they have included with MySQL. 16 17 This program is distributed in the hope that it will be useful, 18 but WITHOUT ANY WARRANTY; without even the implied warranty of 19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 GNU General Public License, version 2.0, for more details. 21 22 You should have received a copy of the GNU General Public License 23 along with this program; if not, write to the Free Software 24 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 25 26 ***********************************************************************/ 27 28 /** @file include/srv0mon.h 29 Server monitor counter related defines 30 31 Created 12/15/2009 Jimmy Yang 32 *******************************************************/ 33 34 #ifndef srv0mon_h 35 #define srv0mon_h 36 37 #include "univ.i" 38 39 #ifndef __STDC_LIMIT_MACROS 40 /* Required for FreeBSD so that INT64_MAX is defined. */ 41 #define __STDC_LIMIT_MACROS 42 #endif /* __STDC_LIMIT_MACROS */ 43 44 #include <stdint.h> 45 46 /** Possible status values for "mon_status" in "struct monitor_value" */ 47 enum monitor_running_status { 48 MONITOR_STARTED = 1, /*!< Monitor has been turned on */ 49 MONITOR_STOPPED = 2 /*!< Monitor has been turned off */ 50 }; 51 52 typedef enum monitor_running_status monitor_running_t; 53 54 /** Monitor counter value type */ 55 typedef int64_t mon_type_t; 56 57 /** Two monitor structures are defined in this file. One is 58 "monitor_value_t" which contains dynamic counter values for each 59 counter. The other is "monitor_info_t", which contains 60 static information (counter name, desc etc.) for each counter. 61 In addition, an enum datatype "monitor_id_t" is also defined, 62 it identifies each monitor with an internally used symbol, whose 63 integer value indexes into above two structure for its dynamic 64 and static information. 65 Developer who intend to add new counters would require to 66 fill in counter information as described in "monitor_info_t" and 67 create the internal counter ID in "monitor_id_t". */ 68 69 /** Structure containing the actual values of a monitor counter. */ 70 struct monitor_value_t { 71 ib_time_t mon_start_time; /*!< Start time of monitoring */ 72 ib_time_t mon_stop_time; /*!< Stop time of monitoring */ 73 ib_time_t mon_reset_time; /*!< Time counter resetted */ 74 mon_type_t mon_value; /*!< Current counter Value */ 75 mon_type_t mon_max_value; /*!< Current Max value */ 76 mon_type_t mon_min_value; /*!< Current Min value */ 77 mon_type_t mon_value_reset; /*!< value at last reset */ 78 mon_type_t mon_max_value_start; /*!< Max value since start */ 79 mon_type_t mon_min_value_start; /*!< Min value since start */ 80 mon_type_t mon_start_value; /*!< Value at the start time */ 81 mon_type_t mon_last_value; /*!< Last set of values */ 82 monitor_running_t mon_status; /* whether monitor still running */ 83 }; 84 85 /** Follwoing defines are possible values for "monitor_type" field in 86 "struct monitor_info" */ 87 enum monitor_type_t { 88 MONITOR_NONE = 0, /*!< No monitoring */ 89 MONITOR_MODULE = 1, /*!< This is a monitor module type, 90 not a counter */ 91 MONITOR_EXISTING = 2, /*!< The monitor carries information from 92 an existing system status variable */ 93 MONITOR_NO_AVERAGE = 4, /*!< Set this status if we don't want to 94 calculate the average value for the counter */ 95 MONITOR_DISPLAY_CURRENT = 8, /*!< Display current value of the 96 counter, rather than incremental value 97 over the period. Mostly for counters 98 displaying current resource usage */ 99 MONITOR_GROUP_MODULE = 16, /*!< Monitor can be turned on/off 100 only as a module, but not individually */ 101 MONITOR_DEFAULT_ON = 32, /*!< Monitor will be turned on by default at 102 server start up */ 103 MONITOR_SET_OWNER = 64, /*!< Owner of "monitor set", a set of 104 monitor counters */ 105 MONITOR_SET_MEMBER = 128, /*!< Being part of a "monitor set" */ 106 MONITOR_HIDDEN = 256 /*!< Do not display this monitor in the 107 metrics table */ 108 }; 109 110 /** Counter minimum value is initialized to be max value of 111 mon_type_t (int64_t) */ 112 #define MIN_RESERVED INT64_MAX 113 #define MAX_RESERVED (~MIN_RESERVED) 114 115 /** This enumeration defines internal monitor identifier used internally 116 to identify each particular counter. Its value indexes into two arrays, 117 one is the "innodb_counter_value" array which records actual monitor 118 counter values, the other is "innodb_counter_info" array which describes 119 each counter's basic information (name, desc etc.). A couple of 120 naming rules here: 121 1) If the monitor defines a module, it starts with MONITOR_MODULE 122 2) If the monitor uses exisitng counters from "status variable", its ID 123 name shall start with MONITOR_OVLD 124 125 Please refer to "innodb_counter_info" in srv/srv0mon.cc for detail 126 information for each monitor counter */ 127 128 enum monitor_id_t { 129 /* This is to identify the default value set by the metrics 130 control global variables */ 131 MONITOR_DEFAULT_START = 0, 132 133 /* Start of Metadata counter */ 134 MONITOR_MODULE_METADATA, 135 MONITOR_TABLE_OPEN, 136 MONITOR_TABLE_CLOSE, 137 MONITOR_TABLE_REFERENCE, 138 139 /* Lock manager related counters */ 140 MONITOR_MODULE_LOCK, 141 MONITOR_DEADLOCK, 142 MONITOR_DEADLOCK_FALSE_POSITIVES, 143 MONITOR_DEADLOCK_ROUNDS, 144 MONITOR_LOCK_THREADS_WAITING, 145 MONITOR_TIMEOUT, 146 MONITOR_LOCKREC_WAIT, 147 MONITOR_TABLELOCK_WAIT, 148 MONITOR_NUM_RECLOCK_REQ, 149 MONITOR_RECLOCK_RELEASE_ATTEMPTS, 150 MONITOR_RECLOCK_GRANT_ATTEMPTS, 151 MONITOR_RECLOCK_CREATED, 152 MONITOR_RECLOCK_REMOVED, 153 MONITOR_NUM_RECLOCK, 154 MONITOR_TABLELOCK_CREATED, 155 MONITOR_TABLELOCK_REMOVED, 156 MONITOR_NUM_TABLELOCK, 157 MONITOR_OVLD_ROW_LOCK_CURRENT_WAIT, 158 MONITOR_OVLD_LOCK_WAIT_TIME, 159 MONITOR_OVLD_LOCK_MAX_WAIT_TIME, 160 MONITOR_OVLD_ROW_LOCK_WAIT, 161 MONITOR_OVLD_LOCK_AVG_WAIT_TIME, 162 MONITOR_SCHEDULE_REFRESHES, 163 164 /* Buffer and I/O realted counters. */ 165 MONITOR_MODULE_BUFFER, 166 MONITOR_OVLD_BUFFER_POOL_SIZE, 167 MONITOR_OVLD_BUF_POOL_READS, 168 MONITOR_OVLD_BUF_POOL_READ_REQUESTS, 169 MONITOR_OVLD_BUF_POOL_WRITE_REQUEST, 170 MONITOR_OVLD_BUF_POOL_WAIT_FREE, 171 MONITOR_OVLD_BUF_POOL_READ_AHEAD, 172 MONITOR_OVLD_BUF_POOL_READ_AHEAD_EVICTED, 173 MONITOR_OVLD_BUF_POOL_PAGE_TOTAL, 174 MONITOR_OVLD_BUF_POOL_PAGE_MISC, 175 MONITOR_OVLD_BUF_POOL_PAGES_DATA, 176 MONITOR_OVLD_BUF_POOL_BYTES_DATA, 177 MONITOR_OVLD_BUF_POOL_PAGES_DIRTY, 178 MONITOR_OVLD_BUF_POOL_BYTES_DIRTY, 179 MONITOR_OVLD_BUF_POOL_PAGES_FREE, 180 MONITOR_OVLD_PAGE_CREATED, 181 MONITOR_OVLD_PAGES_WRITTEN, 182 MONITOR_OVLD_PAGES_READ, 183 MONITOR_OVLD_BYTE_READ, 184 MONITOR_OVLD_BYTE_WRITTEN, 185 MONITOR_FLUSH_BATCH_SCANNED, 186 MONITOR_FLUSH_BATCH_SCANNED_NUM_CALL, 187 MONITOR_FLUSH_BATCH_SCANNED_PER_CALL, 188 MONITOR_FLUSH_BATCH_TOTAL_PAGE, 189 MONITOR_FLUSH_BATCH_COUNT, 190 MONITOR_FLUSH_BATCH_PAGES, 191 MONITOR_FLUSH_NEIGHBOR_TOTAL_PAGE, 192 MONITOR_FLUSH_NEIGHBOR_COUNT, 193 MONITOR_FLUSH_NEIGHBOR_PAGES, 194 MONITOR_FLUSH_N_TO_FLUSH_REQUESTED, 195 MONITOR_FLUSH_N_TO_FLUSH_BY_DIRTY_PAGE, 196 197 MONITOR_FLUSH_N_TO_FLUSH_BY_AGE, 198 MONITOR_FLUSH_ADAPTIVE_AVG_TIME_SLOT, 199 MONITOR_LRU_BATCH_FLUSH_AVG_TIME_SLOT, 200 201 MONITOR_FLUSH_ADAPTIVE_AVG_TIME_THREAD, 202 MONITOR_LRU_BATCH_FLUSH_AVG_TIME_THREAD, 203 MONITOR_FLUSH_ADAPTIVE_AVG_TIME_EST, 204 MONITOR_LRU_BATCH_FLUSH_AVG_TIME_EST, 205 MONITOR_FLUSH_AVG_TIME, 206 207 MONITOR_FLUSH_ADAPTIVE_AVG_PASS, 208 MONITOR_LRU_BATCH_FLUSH_AVG_PASS, 209 MONITOR_FLUSH_AVG_PASS, 210 211 MONITOR_LRU_GET_FREE_LOOPS, 212 MONITOR_LRU_GET_FREE_WAITS, 213 214 MONITOR_FLUSH_AVG_PAGE_RATE, 215 MONITOR_FLUSH_LSN_AVG_RATE, 216 MONITOR_FLUSH_PCT_FOR_DIRTY, 217 MONITOR_FLUSH_PCT_FOR_LSN, 218 MONITOR_FLUSH_SYNC_WAITS, 219 MONITOR_FLUSH_ADAPTIVE_TOTAL_PAGE, 220 MONITOR_FLUSH_ADAPTIVE_COUNT, 221 MONITOR_FLUSH_ADAPTIVE_PAGES, 222 MONITOR_FLUSH_SYNC_TOTAL_PAGE, 223 MONITOR_FLUSH_SYNC_COUNT, 224 MONITOR_FLUSH_SYNC_PAGES, 225 MONITOR_FLUSH_BACKGROUND_TOTAL_PAGE, 226 MONITOR_FLUSH_BACKGROUND_COUNT, 227 MONITOR_FLUSH_BACKGROUND_PAGES, 228 MONITOR_LRU_BATCH_SCANNED, 229 MONITOR_LRU_BATCH_SCANNED_NUM_CALL, 230 MONITOR_LRU_BATCH_SCANNED_PER_CALL, 231 MONITOR_LRU_BATCH_FLUSH_TOTAL_PAGE, 232 MONITOR_LRU_BATCH_FLUSH_COUNT, 233 MONITOR_LRU_BATCH_FLUSH_PAGES, 234 MONITOR_LRU_BATCH_EVICT_TOTAL_PAGE, 235 MONITOR_LRU_BATCH_EVICT_COUNT, 236 MONITOR_LRU_BATCH_EVICT_PAGES, 237 MONITOR_LRU_SINGLE_FLUSH_SCANNED, 238 MONITOR_LRU_SINGLE_FLUSH_SCANNED_NUM_CALL, 239 MONITOR_LRU_SINGLE_FLUSH_SCANNED_PER_CALL, 240 MONITOR_LRU_SINGLE_FLUSH_FAILURE_COUNT, 241 MONITOR_LRU_GET_FREE_SEARCH, 242 MONITOR_LRU_SEARCH_SCANNED, 243 MONITOR_LRU_SEARCH_SCANNED_NUM_CALL, 244 MONITOR_LRU_SEARCH_SCANNED_PER_CALL, 245 MONITOR_LRU_UNZIP_SEARCH_SCANNED, 246 MONITOR_LRU_UNZIP_SEARCH_SCANNED_NUM_CALL, 247 MONITOR_LRU_UNZIP_SEARCH_SCANNED_PER_CALL, 248 249 /* Buffer Page I/O specific counters. */ 250 MONITOR_MODULE_BUF_PAGE, 251 MONITOR_INDEX_LEAF_PAGE_READ, 252 MONITOR_INDEX_NON_LEAF_PAGE_READ, 253 MONITOR_INDEX_IBUF_LEAF_PAGE_READ, 254 MONITOR_INDEX_IBUF_NON_LEAF_PAGE_READ, 255 MONITOR_UNDO_LOG_PAGE_READ, 256 MONITOR_INODE_PAGE_READ, 257 MONITOR_IBUF_FREELIST_PAGE_READ, 258 MONITOR_IBUF_BITMAP_PAGE_READ, 259 MONITOR_SYSTEM_PAGE_READ, 260 MONITOR_TRX_SYSTEM_PAGE_READ, 261 MONITOR_FSP_HDR_PAGE_READ, 262 MONITOR_XDES_PAGE_READ, 263 MONITOR_BLOB_PAGE_READ, 264 MONITOR_ZBLOB_PAGE_READ, 265 MONITOR_ZBLOB2_PAGE_READ, 266 MONITOR_RSEG_ARRAY_PAGE_READ, 267 MONITOR_OTHER_PAGE_READ, 268 MONITOR_INDEX_LEAF_PAGE_WRITTEN, 269 MONITOR_INDEX_NON_LEAF_PAGE_WRITTEN, 270 MONITOR_INDEX_IBUF_LEAF_PAGE_WRITTEN, 271 MONITOR_INDEX_IBUF_NON_LEAF_PAGE_WRITTEN, 272 MONITOR_UNDO_LOG_PAGE_WRITTEN, 273 MONITOR_INODE_PAGE_WRITTEN, 274 MONITOR_IBUF_FREELIST_PAGE_WRITTEN, 275 MONITOR_IBUF_BITMAP_PAGE_WRITTEN, 276 MONITOR_SYSTEM_PAGE_WRITTEN, 277 MONITOR_TRX_SYSTEM_PAGE_WRITTEN, 278 MONITOR_FSP_HDR_PAGE_WRITTEN, 279 MONITOR_XDES_PAGE_WRITTEN, 280 MONITOR_BLOB_PAGE_WRITTEN, 281 MONITOR_ZBLOB_PAGE_WRITTEN, 282 MONITOR_ZBLOB2_PAGE_WRITTEN, 283 MONITOR_RSEG_ARRAY_PAGE_WRITTEN, 284 MONITOR_OTHER_PAGE_WRITTEN, 285 MONITOR_ON_LOG_NO_WAITS_PAGE_WRITTEN, 286 MONITOR_ON_LOG_WAITS_PAGE_WRITTEN, 287 MONITOR_ON_LOG_WAIT_LOOPS_PAGE_WRITTEN, 288 289 /* OS level counters (I/O) */ 290 MONITOR_MODULE_OS, 291 MONITOR_OVLD_OS_FILE_READ, 292 MONITOR_OVLD_OS_FILE_WRITE, 293 MONITOR_OVLD_OS_FSYNC, 294 MONITOR_OS_PENDING_READS, 295 MONITOR_OS_PENDING_WRITES, 296 MONITOR_OVLD_OS_LOG_WRITTEN, 297 MONITOR_OVLD_OS_LOG_FSYNC, 298 MONITOR_OVLD_OS_LOG_PENDING_FSYNC, 299 MONITOR_OVLD_OS_LOG_PENDING_WRITES, 300 301 /* Transaction related counters */ 302 MONITOR_MODULE_TRX, 303 MONITOR_TRX_RW_COMMIT, 304 MONITOR_TRX_RO_COMMIT, 305 MONITOR_TRX_NL_RO_COMMIT, 306 MONITOR_TRX_COMMIT_UNDO, 307 MONITOR_TRX_ROLLBACK, 308 MONITOR_TRX_ROLLBACK_SAVEPOINT, 309 MONITOR_TRX_ROLLBACK_ACTIVE, 310 MONITOR_TRX_ACTIVE, 311 MONITOR_TRX_ON_LOG_NO_WAITS, 312 MONITOR_TRX_ON_LOG_WAITS, 313 MONITOR_TRX_ON_LOG_WAIT_LOOPS, 314 MONITOR_RSEG_HISTORY_LEN, 315 MONITOR_NUM_UNDO_SLOT_USED, 316 MONITOR_NUM_UNDO_SLOT_CACHED, 317 MONITOR_RSEG_CUR_SIZE, 318 319 /* Purge related counters */ 320 MONITOR_MODULE_PURGE, 321 MONITOR_N_DEL_ROW_PURGE, 322 MONITOR_N_UPD_EXIST_EXTERN, 323 MONITOR_PURGE_INVOKED, 324 MONITOR_PURGE_N_PAGE_HANDLED, 325 MONITOR_DML_PURGE_DELAY, 326 MONITOR_PURGE_STOP_COUNT, 327 MONITOR_PURGE_RESUME_COUNT, 328 MONITOR_PURGE_TRUNCATE_HISTORY_COUNT, 329 MONITOR_PURGE_TRUNCATE_HISTORY_MICROSECOND, 330 331 /* Undo tablespace truncation */ 332 MONITOR_UNDO_TRUNCATE, 333 MONITOR_UNDO_TRUNCATE_COUNT, 334 MONITOR_UNDO_TRUNCATE_START_LOGGING_COUNT, 335 MONITOR_UNDO_TRUNCATE_DONE_LOGGING_COUNT, 336 MONITOR_UNDO_TRUNCATE_MICROSECOND, 337 338 /* Recovery related counters */ 339 MONITOR_MODULE_REDO_LOG, 340 MONITOR_OVLD_LSN_FLUSHDISK, 341 MONITOR_OVLD_LSN_CHECKPOINT, 342 MONITOR_OVLD_LSN_CURRENT, 343 MONITOR_OVLD_LSN_ARCHIVED, 344 MONITOR_OVLD_LSN_CHECKPOINT_AGE, 345 MONITOR_OVLD_LSN_BUF_DIRTY_PAGES_ADDED, 346 MONITOR_OVLD_BUF_OLDEST_LSN_APPROX, 347 MONITOR_OVLD_BUF_OLDEST_LSN_LWM, 348 MONITOR_OVLD_MAX_AGE_ASYNC, 349 MONITOR_OVLD_MAX_AGE_SYNC, 350 MONITOR_OVLD_LOG_WAITS, 351 MONITOR_OVLD_LOG_WRITE_REQUEST, 352 MONITOR_OVLD_LOG_WRITES, 353 354 MONITOR_LOG_FLUSH_TOTAL_TIME, 355 MONITOR_LOG_FLUSH_MAX_TIME, 356 MONITOR_LOG_FLUSH_AVG_TIME, 357 MONITOR_LOG_FLUSH_LSN_AVG_RATE, 358 359 MONITOR_LOG_FULL_BLOCK_WRITES, 360 MONITOR_LOG_PARTIAL_BLOCK_WRITES, 361 MONITOR_LOG_PADDED, 362 MONITOR_LOG_NEXT_FILE, 363 MONITOR_LOG_CHECKPOINTS, 364 MONITOR_LOG_FREE_SPACE, 365 MONITOR_LOG_CONCURRENCY_MARGIN, 366 367 MONITOR_LOG_WRITER_NO_WAITS, 368 MONITOR_LOG_WRITER_WAITS, 369 MONITOR_LOG_WRITER_WAIT_LOOPS, 370 MONITOR_LOG_WRITER_ON_FREE_SPACE_WAITS, 371 MONITOR_LOG_WRITER_ON_ARCHIVER_WAITS, 372 373 MONITOR_LOG_FLUSHER_NO_WAITS, 374 MONITOR_LOG_FLUSHER_WAITS, 375 MONITOR_LOG_FLUSHER_WAIT_LOOPS, 376 377 MONITOR_LOG_WRITE_NOTIFIER_NO_WAITS, 378 MONITOR_LOG_WRITE_NOTIFIER_WAITS, 379 MONITOR_LOG_WRITE_NOTIFIER_WAIT_LOOPS, 380 381 MONITOR_LOG_FLUSH_NOTIFIER_NO_WAITS, 382 MONITOR_LOG_FLUSH_NOTIFIER_WAITS, 383 MONITOR_LOG_FLUSH_NOTIFIER_WAIT_LOOPS, 384 385 MONITOR_LOG_WRITE_TO_FILE_REQUESTS_INTERVAL, 386 387 MONITOR_LOG_ON_WRITE_NO_WAITS, 388 MONITOR_LOG_ON_WRITE_WAITS, 389 MONITOR_LOG_ON_WRITE_WAIT_LOOPS, 390 MONITOR_LOG_ON_FLUSH_NO_WAITS, 391 MONITOR_LOG_ON_FLUSH_WAITS, 392 MONITOR_LOG_ON_FLUSH_WAIT_LOOPS, 393 MONITOR_LOG_ON_RECENT_WRITTEN_WAIT_LOOPS, 394 MONITOR_LOG_ON_RECENT_CLOSED_WAIT_LOOPS, 395 MONITOR_LOG_ON_BUFFER_SPACE_NO_WAITS, 396 MONITOR_LOG_ON_BUFFER_SPACE_WAITS, 397 MONITOR_LOG_ON_BUFFER_SPACE_WAIT_LOOPS, 398 MONITOR_LOG_ON_FILE_SPACE_NO_WAITS, 399 MONITOR_LOG_ON_FILE_SPACE_WAITS, 400 MONITOR_LOG_ON_FILE_SPACE_WAIT_LOOPS, 401 402 /* Page Manager related counters */ 403 MONITOR_MODULE_PAGE, 404 MONITOR_PAGE_COMPRESS, 405 MONITOR_PAGE_DECOMPRESS, 406 MONITOR_PAD_INCREMENTS, 407 MONITOR_PAD_DECREMENTS, 408 409 /* Index related counters */ 410 MONITOR_MODULE_INDEX, 411 MONITOR_INDEX_SPLIT, 412 MONITOR_INDEX_MERGE_ATTEMPTS, 413 MONITOR_INDEX_MERGE_SUCCESSFUL, 414 MONITOR_INDEX_REORG_ATTEMPTS, 415 MONITOR_INDEX_REORG_SUCCESSFUL, 416 MONITOR_INDEX_DISCARD, 417 418 /* Adaptive Hash Index related counters */ 419 MONITOR_MODULE_ADAPTIVE_HASH, 420 MONITOR_OVLD_ADAPTIVE_HASH_SEARCH, 421 MONITOR_OVLD_ADAPTIVE_HASH_SEARCH_BTREE, 422 MONITOR_ADAPTIVE_HASH_PAGE_ADDED, 423 MONITOR_ADAPTIVE_HASH_PAGE_REMOVED, 424 MONITOR_ADAPTIVE_HASH_ROW_ADDED, 425 MONITOR_ADAPTIVE_HASH_ROW_REMOVED, 426 MONITOR_ADAPTIVE_HASH_ROW_REMOVE_NOT_FOUND, 427 MONITOR_ADAPTIVE_HASH_ROW_UPDATED, 428 429 /* Tablespace related counters */ 430 MONITOR_MODULE_FIL_SYSTEM, 431 MONITOR_OVLD_N_FILE_OPENED, 432 433 /* InnoDB Change Buffer related counters */ 434 MONITOR_MODULE_IBUF_SYSTEM, 435 MONITOR_OVLD_IBUF_MERGE_INSERT, 436 MONITOR_OVLD_IBUF_MERGE_DELETE, 437 MONITOR_OVLD_IBUF_MERGE_PURGE, 438 MONITOR_OVLD_IBUF_MERGE_DISCARD_INSERT, 439 MONITOR_OVLD_IBUF_MERGE_DISCARD_DELETE, 440 MONITOR_OVLD_IBUF_MERGE_DISCARD_PURGE, 441 MONITOR_OVLD_IBUF_MERGES, 442 MONITOR_OVLD_IBUF_SIZE, 443 444 /* Counters for server operations */ 445 MONITOR_MODULE_SERVER, 446 MONITOR_MASTER_THREAD_SLEEP, 447 MONITOR_OVLD_SERVER_ACTIVITY, 448 MONITOR_MASTER_ACTIVE_LOOPS, 449 MONITOR_MASTER_IDLE_LOOPS, 450 MONITOR_SRV_BACKGROUND_DROP_TABLE_MICROSECOND, 451 MONITOR_SRV_IBUF_MERGE_MICROSECOND, 452 MONITOR_SRV_MEM_VALIDATE_MICROSECOND, 453 MONITOR_SRV_PURGE_MICROSECOND, 454 MONITOR_SRV_DICT_LRU_MICROSECOND, 455 MONITOR_SRV_DICT_LRU_EVICT_COUNT, 456 MONITOR_OVLD_SRV_DBLWR_WRITES, 457 MONITOR_OVLD_SRV_DBLWR_PAGES_WRITTEN, 458 MONITOR_OVLD_SRV_PAGE_SIZE, 459 MONITOR_OVLD_RWLOCK_S_SPIN_WAITS, 460 MONITOR_OVLD_RWLOCK_X_SPIN_WAITS, 461 MONITOR_OVLD_RWLOCK_SX_SPIN_WAITS, 462 MONITOR_OVLD_RWLOCK_S_SPIN_ROUNDS, 463 MONITOR_OVLD_RWLOCK_X_SPIN_ROUNDS, 464 MONITOR_OVLD_RWLOCK_SX_SPIN_ROUNDS, 465 MONITOR_OVLD_RWLOCK_S_OS_WAITS, 466 MONITOR_OVLD_RWLOCK_X_OS_WAITS, 467 MONITOR_OVLD_RWLOCK_SX_OS_WAITS, 468 469 /* Data DML related counters */ 470 MONITOR_MODULE_DML_STATS, 471 MONITOR_OLVD_ROW_READ, 472 MONITOR_OLVD_ROW_INSERTED, 473 MONITOR_OLVD_ROW_DELETED, 474 MONITOR_OLVD_ROW_UPDTATED, 475 MONITOR_OLVD_SYSTEM_ROW_READ, 476 MONITOR_OLVD_SYSTEM_ROW_INSERTED, 477 MONITOR_OLVD_SYSTEM_ROW_DELETED, 478 MONITOR_OLVD_SYSTEM_ROW_UPDATED, 479 480 /* Sampling related counters */ 481 MONITOR_MODULE_SAMPLING_STATS, 482 MONITOR_SAMPLED_PAGES_READ, 483 MONITOR_SAMPLED_PAGES_SKIPPED, 484 485 /* Data DDL related counters */ 486 MONITOR_MODULE_DDL_STATS, 487 MONITOR_BACKGROUND_DROP_TABLE, 488 MONITOR_ONLINE_CREATE_INDEX, 489 MONITOR_PENDING_ALTER_TABLE, 490 MONITOR_ALTER_TABLE_SORT_FILES, 491 MONITOR_ALTER_TABLE_LOG_FILES, 492 493 MONITOR_MODULE_ICP, 494 MONITOR_ICP_ATTEMPTS, 495 MONITOR_ICP_NO_MATCH, 496 MONITOR_ICP_OUT_OF_RANGE, 497 MONITOR_ICP_MATCH, 498 499 /* Mutex/RW-Lock related counters */ 500 MONITOR_MODULE_LATCHES, 501 MONITOR_LATCHES, 502 503 /* CPU usage information */ 504 MONITOR_MODULE_CPU, 505 MONITOR_CPU_UTIME_ABS, 506 MONITOR_CPU_STIME_ABS, 507 MONITOR_CPU_UTIME_PCT, 508 MONITOR_CPU_STIME_PCT, 509 MONITOR_CPU_N, 510 511 MONITOR_MODULE_PAGE_TRACK, 512 MONITOR_PAGE_TRACK_RESETS, 513 MONITOR_PAGE_TRACK_PARTIAL_BLOCK_WRITES, 514 MONITOR_PAGE_TRACK_FULL_BLOCK_WRITES, 515 MONITOR_PAGE_TRACK_CHECKPOINT_PARTIAL_FLUSH_REQUEST, 516 517 MONITOR_MODULE_DBLWR, 518 MONITOR_DBLWR_ASYNC_REQUESTS, 519 MONITOR_DBLWR_SYNC_REQUESTS, 520 MONITOR_DBLWR_FLUSH_REQUESTS, 521 MONITOR_DBLWR_FLUSH_WAIT_EVENTS, 522 523 /* This is used only for control system to turn 524 on/off and reset all monitor counters */ 525 MONITOR_ALL_COUNTER, 526 527 /* This must be the last member */ 528 NUM_MONITOR 529 }; 530 531 /** This informs the monitor control system to turn 532 on/off and reset monitor counters through wild card match */ 533 #define MONITOR_WILDCARD_MATCH (NUM_MONITOR + 1) 534 535 /** Cannot find monitor counter with a specified name */ 536 #define MONITOR_NO_MATCH (NUM_MONITOR + 2) 537 538 /** struct monitor_info describes the basic/static information 539 about each monitor counter. */ 540 struct monitor_info_t { 541 const char *monitor_name; /*!< Monitor name */ 542 const char *monitor_module; /*!< Sub Module the monitor 543 belongs to */ 544 const char *monitor_desc; /*!< Brief desc of monitor counter */ 545 monitor_type_t monitor_type; /*!< Type of Monitor Info */ 546 monitor_id_t monitor_related_id; /*!< Monitor ID of counter that 547 related to this monitor. This is 548 set when the monitor belongs to 549 a "monitor set" */ 550 monitor_id_t monitor_id; /*!< Monitor ID as defined in enum 551 monitor_id_t */ 552 }; 553 554 /** Following are the "set_option" values allowed for 555 srv_mon_process_existing_counter() and srv_mon_process_existing_counter() 556 functions. To turn on/off/reset the monitor counters. */ 557 enum mon_option_t { 558 MONITOR_TURN_ON = 1, /*!< Turn on the counter */ 559 MONITOR_TURN_OFF, /*!< Turn off the counter */ 560 MONITOR_RESET_VALUE, /*!< Reset current values */ 561 MONITOR_RESET_ALL_VALUE, /*!< Reset all values */ 562 MONITOR_GET_VALUE /*!< Option for 563 srv_mon_process_existing_counter() 564 function */ 565 }; 566 567 #ifndef UNIV_HOTBACKUP 568 /** Number of bit in a ulint datatype */ 569 #define NUM_BITS_ULINT (sizeof(ulint) * CHAR_BIT) 570 571 /** This "monitor_set_tbl" is a bitmap records whether a particular monitor 572 counter has been turned on or off */ 573 extern ulint 574 monitor_set_tbl[(NUM_MONITOR + NUM_BITS_ULINT - 1) / NUM_BITS_ULINT]; 575 576 /** Macros to turn on/off the control bit in monitor_set_tbl for a monitor 577 counter option. */ 578 #define MONITOR_ON(monitor) \ 579 (monitor_set_tbl[monitor / NUM_BITS_ULINT] |= \ 580 ((ulint)1 << (monitor % NUM_BITS_ULINT))) 581 582 #define MONITOR_OFF(monitor) \ 583 (monitor_set_tbl[monitor / NUM_BITS_ULINT] &= \ 584 ~((ulint)1 << (monitor % NUM_BITS_ULINT))) 585 586 /** Check whether the requested monitor is turned on/off */ 587 #define MONITOR_IS_ON(monitor) \ 588 (monitor_set_tbl[monitor / NUM_BITS_ULINT] & \ 589 ((ulint)1 << (monitor % NUM_BITS_ULINT))) 590 591 /** The actual monitor counter array that records each monintor counter 592 value */ 593 extern monitor_value_t innodb_counter_value[NUM_MONITOR]; 594 595 /** Following are macro defines for basic montior counter manipulations. 596 Please note we do not provide any synchronization for these monitor 597 operations due to performance consideration. Most counters can 598 be placed under existing mutex protections in respective code 599 module. */ 600 601 /** Macros to access various fields of a monitor counters */ 602 #define MONITOR_FIELD(monitor, field) (innodb_counter_value[monitor].field) 603 604 #define MONITOR_VALUE(monitor) MONITOR_FIELD(monitor, mon_value) 605 606 #define MONITOR_MAX_VALUE(monitor) MONITOR_FIELD(monitor, mon_max_value) 607 608 #define MONITOR_MIN_VALUE(monitor) MONITOR_FIELD(monitor, mon_min_value) 609 610 #define MONITOR_VALUE_RESET(monitor) MONITOR_FIELD(monitor, mon_value_reset) 611 612 #define MONITOR_MAX_VALUE_START(monitor) \ 613 MONITOR_FIELD(monitor, mon_max_value_start) 614 615 #define MONITOR_MIN_VALUE_START(monitor) \ 616 MONITOR_FIELD(monitor, mon_min_value_start) 617 618 #define MONITOR_LAST_VALUE(monitor) MONITOR_FIELD(monitor, mon_last_value) 619 620 #define MONITOR_START_VALUE(monitor) MONITOR_FIELD(monitor, mon_start_value) 621 622 #define MONITOR_VALUE_SINCE_START(monitor) \ 623 (MONITOR_VALUE(monitor) + MONITOR_VALUE_RESET(monitor)) 624 625 #define MONITOR_STATUS(monitor) MONITOR_FIELD(monitor, mon_status) 626 627 #define MONITOR_SET_START(monitor) \ 628 do { \ 629 MONITOR_STATUS(monitor) = MONITOR_STARTED; \ 630 MONITOR_FIELD((monitor), mon_start_time) = time(NULL); \ 631 } while (0) 632 633 #define MONITOR_SET_OFF(monitor) \ 634 do { \ 635 MONITOR_STATUS(monitor) = MONITOR_STOPPED; \ 636 MONITOR_FIELD((monitor), mon_stop_time) = time(NULL); \ 637 } while (0) 638 639 #define MONITOR_INIT_ZERO_VALUE 0 640 641 /** Max and min values are initialized when we first turn on the monitor 642 counter, and set the MONITOR_STATUS. */ 643 #define MONITOR_MAX_MIN_NOT_INIT(monitor) \ 644 (MONITOR_STATUS(monitor) == MONITOR_INIT_ZERO_VALUE && \ 645 MONITOR_MIN_VALUE(monitor) == MONITOR_INIT_ZERO_VALUE && \ 646 MONITOR_MAX_VALUE(monitor) == MONITOR_INIT_ZERO_VALUE) 647 648 #define MONITOR_INIT(monitor) \ 649 if (MONITOR_MAX_MIN_NOT_INIT(monitor)) { \ 650 MONITOR_MIN_VALUE(monitor) = MIN_RESERVED; \ 651 MONITOR_MIN_VALUE_START(monitor) = MIN_RESERVED; \ 652 MONITOR_MAX_VALUE(monitor) = MAX_RESERVED; \ 653 MONITOR_MAX_VALUE_START(monitor) = MAX_RESERVED; \ 654 } 655 656 /** Macros to increment/decrement the counters. The normal 657 monitor counter operation expects appropriate synchronization 658 already exists. No additional mutex is necessary when operating 659 on the counters */ 660 #define MONITOR_INC(monitor) \ 661 if (MONITOR_IS_ON(monitor)) { \ 662 MONITOR_VALUE(monitor)++; \ 663 if (MONITOR_VALUE(monitor) > MONITOR_MAX_VALUE(monitor)) { \ 664 MONITOR_MAX_VALUE(monitor) = MONITOR_VALUE(monitor); \ 665 } \ 666 } 667 668 /** Atomically increment a monitor counter. 669 Use MONITOR_INC if appropriate mutex protection exists. 670 @param monitor monitor to be incremented by 1 */ 671 #define MONITOR_ATOMIC_INC(monitor) \ 672 if (MONITOR_IS_ON(monitor)) { \ 673 ib_uint64_t value; \ 674 value = \ 675 os_atomic_increment_uint64((ib_uint64_t *)&MONITOR_VALUE(monitor), 1); \ 676 /* Note: This is not 100% accurate because of the \ 677 inherent race, we ignore it due to performance. */ \ 678 if (value > (ib_uint64_t)MONITOR_MAX_VALUE(monitor)) { \ 679 MONITOR_MAX_VALUE(monitor) = value; \ 680 } \ 681 } 682 683 /** Atomically decrement a monitor counter. 684 Use MONITOR_DEC if appropriate mutex protection exists. 685 @param monitor monitor to be decremented by 1 */ 686 #define MONITOR_ATOMIC_DEC(monitor) \ 687 if (MONITOR_IS_ON(monitor)) { \ 688 ib_uint64_t value; \ 689 value = \ 690 os_atomic_decrement_uint64((ib_uint64_t *)&MONITOR_VALUE(monitor), 1); \ 691 /* Note: This is not 100% accurate because of the \ 692 inherent race, we ignore it due to performance. */ \ 693 if (value < (ib_uint64_t)MONITOR_MIN_VALUE(monitor)) { \ 694 MONITOR_MIN_VALUE(monitor) = value; \ 695 } \ 696 } 697 698 #define MONITOR_DEC(monitor) \ 699 if (MONITOR_IS_ON(monitor)) { \ 700 MONITOR_VALUE(monitor)--; \ 701 if (MONITOR_VALUE(monitor) < MONITOR_MIN_VALUE(monitor)) { \ 702 MONITOR_MIN_VALUE(monitor) = MONITOR_VALUE(monitor); \ 703 } \ 704 } 705 706 #ifdef UNIV_DEBUG_VALGRIND 707 #define MONITOR_CHECK_DEFINED(value) \ 708 do { \ 709 mon_type_t m = value; \ 710 UNIV_MEM_ASSERT_RW(&m, sizeof m); \ 711 } while (0) 712 #else /* UNIV_DEBUG_VALGRIND */ 713 #define MONITOR_CHECK_DEFINED(value) (void)0 714 #endif /* UNIV_DEBUG_VALGRIND */ 715 716 #define MONITOR_INC_VALUE(monitor, value) \ 717 MONITOR_CHECK_DEFINED(value); \ 718 if (MONITOR_IS_ON(monitor)) { \ 719 MONITOR_VALUE(monitor) += (mon_type_t)(value); \ 720 if (MONITOR_VALUE(monitor) > MONITOR_MAX_VALUE(monitor)) { \ 721 MONITOR_MAX_VALUE(monitor) = MONITOR_VALUE(monitor); \ 722 } \ 723 } 724 725 #define MONITOR_DEC_VALUE(monitor, value) \ 726 MONITOR_CHECK_DEFINED(value); \ 727 if (MONITOR_IS_ON(monitor)) { \ 728 ut_ad(MONITOR_VALUE(monitor) >= (mon_type_t) (value); \ 729 MONITOR_VALUE(monitor) -= (mon_type_t) (value); \ 730 if (MONITOR_VALUE(monitor) < MONITOR_MIN_VALUE(monitor)) { \ 731 MONITOR_MIN_VALUE(monitor) = MONITOR_VALUE(monitor);\ 732 } \ 733 } 734 735 /* Increment/decrement counter without check the monitor on/off bit, which 736 could already be checked as a module group */ 737 #define MONITOR_INC_NOCHECK(monitor) \ 738 do { \ 739 MONITOR_VALUE(monitor)++; \ 740 if (MONITOR_VALUE(monitor) > MONITOR_MAX_VALUE(monitor)) { \ 741 MONITOR_MAX_VALUE(monitor) = MONITOR_VALUE(monitor); \ 742 } \ 743 } while (0) 744 745 #define MONITOR_DEC_NOCHECK(monitor) \ 746 do { \ 747 MONITOR_VALUE(monitor)--; \ 748 if (MONITOR_VALUE(monitor) < MONITOR_MIN_VALUE(monitor)) { \ 749 MONITOR_MIN_VALUE(monitor) = MONITOR_VALUE(monitor); \ 750 } \ 751 } while (0) 752 753 /** Directly set a monitor counter's value */ 754 #define MONITOR_SET(monitor, value) \ 755 MONITOR_CHECK_DEFINED(value); \ 756 if (MONITOR_IS_ON(monitor)) { \ 757 MONITOR_VALUE(monitor) = (mon_type_t)(value); \ 758 if (MONITOR_VALUE(monitor) > MONITOR_MAX_VALUE(monitor)) { \ 759 MONITOR_MAX_VALUE(monitor) = MONITOR_VALUE(monitor); \ 760 } \ 761 if (MONITOR_VALUE(monitor) < MONITOR_MIN_VALUE(monitor)) { \ 762 MONITOR_MIN_VALUE(monitor) = MONITOR_VALUE(monitor); \ 763 } \ 764 } 765 766 /** Add time difference between now and input "value" (in seconds) to the 767 monitor counter 768 @param monitor monitor to update for the time difference 769 @param value the start time value */ 770 #define MONITOR_INC_TIME_IN_MICRO_SECS(monitor, value) \ 771 MONITOR_CHECK_DEFINED(value); \ 772 if (MONITOR_IS_ON(monitor)) { \ 773 uintmax_t old_time = (value); \ 774 value = ut_time_monotonic_us(); \ 775 MONITOR_VALUE(monitor) += (mon_type_t)(value - old_time); \ 776 } 777 778 /** This macro updates 3 counters in one call. However, it only checks the 779 main/first monitor counter 'monitor', to see it is on or off to decide 780 whether to do the update. 781 @param monitor the main monitor counter to update. It accounts for 782 the accumulative value for the counter. 783 @param monitor_n_calls counter that counts number of times this macro is 784 called 785 @param monitor_per_call counter that records the current and max value of 786 each incremental value 787 @param value incremental value to record this time */ 788 #define MONITOR_INC_VALUE_CUMULATIVE(monitor, monitor_n_calls, \ 789 monitor_per_call, value) \ 790 MONITOR_CHECK_DEFINED(value); \ 791 if (MONITOR_IS_ON(monitor)) { \ 792 MONITOR_VALUE(monitor_n_calls)++; \ 793 MONITOR_VALUE(monitor_per_call) = (mon_type_t)(value); \ 794 if (MONITOR_VALUE(monitor_per_call) > \ 795 MONITOR_MAX_VALUE(monitor_per_call)) { \ 796 MONITOR_MAX_VALUE(monitor_per_call) = (mon_type_t)(value); \ 797 } \ 798 MONITOR_VALUE(monitor) += (mon_type_t)(value); \ 799 if (MONITOR_VALUE(monitor) > MONITOR_MAX_VALUE(monitor)) { \ 800 MONITOR_MAX_VALUE(monitor) = MONITOR_VALUE(monitor); \ 801 } \ 802 } 803 804 /** Directly set a monitor counter's value, and if the value 805 is monotonically increasing, only max value needs to be updated */ 806 #define MONITOR_SET_UPD_MAX_ONLY(monitor, value) \ 807 MONITOR_CHECK_DEFINED(value); \ 808 if (MONITOR_IS_ON(monitor)) { \ 809 MONITOR_VALUE(monitor) = (mon_type_t)(value); \ 810 if (MONITOR_VALUE(monitor) > MONITOR_MAX_VALUE(monitor)) { \ 811 MONITOR_MAX_VALUE(monitor) = MONITOR_VALUE(monitor); \ 812 } \ 813 } 814 815 /** Some values such as log sequence number are montomically increasing 816 number, do not need to record max/min values */ 817 #define MONITOR_SET_SIMPLE(monitor, value) \ 818 MONITOR_CHECK_DEFINED(value); \ 819 if (MONITOR_IS_ON(monitor)) { \ 820 MONITOR_VALUE(monitor) = (mon_type_t)(value); \ 821 } 822 823 /** Reset the monitor value and max/min value to zero. The reset 824 operation would only be conducted when the counter is turned off */ 825 #define MONITOR_RESET_ALL(monitor) \ 826 do { \ 827 MONITOR_VALUE(monitor) = MONITOR_INIT_ZERO_VALUE; \ 828 MONITOR_MAX_VALUE(monitor) = MAX_RESERVED; \ 829 MONITOR_MIN_VALUE(monitor) = MIN_RESERVED; \ 830 MONITOR_VALUE_RESET(monitor) = MONITOR_INIT_ZERO_VALUE; \ 831 MONITOR_MAX_VALUE_START(monitor) = MAX_RESERVED; \ 832 MONITOR_MIN_VALUE_START(monitor) = MIN_RESERVED; \ 833 MONITOR_LAST_VALUE(monitor) = MONITOR_INIT_ZERO_VALUE; \ 834 MONITOR_FIELD(monitor, mon_start_time) = MONITOR_INIT_ZERO_VALUE; \ 835 MONITOR_FIELD(monitor, mon_stop_time) = MONITOR_INIT_ZERO_VALUE; \ 836 MONITOR_FIELD(monitor, mon_reset_time) = MONITOR_INIT_ZERO_VALUE; \ 837 } while (0) 838 839 /** Following four macros defines necessary operations to fetch and 840 consolidate information from existing system status variables. */ 841 842 /** Save the passed-in value to mon_start_value field of monitor 843 counters */ 844 #define MONITOR_SAVE_START(monitor, value) \ 845 do { \ 846 MONITOR_CHECK_DEFINED(value); \ 847 (MONITOR_START_VALUE(monitor) = \ 848 (mon_type_t)(value)-MONITOR_VALUE_RESET(monitor)); \ 849 } while (0) 850 851 /** Save the passed-in value to mon_last_value field of monitor 852 counters */ 853 #define MONITOR_SAVE_LAST(monitor) \ 854 do { \ 855 MONITOR_LAST_VALUE(monitor) = MONITOR_VALUE(monitor); \ 856 MONITOR_START_VALUE(monitor) += MONITOR_VALUE(monitor); \ 857 } while (0) 858 859 /** Set monitor value to the difference of value and mon_start_value 860 compensated by mon_last_value if accumulated value is required. */ 861 #define MONITOR_SET_DIFF(monitor, value) \ 862 MONITOR_SET_UPD_MAX_ONLY(monitor, ((value)-MONITOR_VALUE_RESET(monitor) - \ 863 MONITOR_FIELD(monitor, mon_start_value) + \ 864 MONITOR_FIELD(monitor, mon_last_value))) 865 866 /** Get monitor's monitor_info_t by its monitor id (index into the 867 innodb_counter_info array 868 @return Point to corresponding monitor_info_t, or NULL if no such 869 monitor */ 870 monitor_info_t *srv_mon_get_info( 871 monitor_id_t monitor_id); /*!< id index into the 872 innodb_counter_info array */ 873 /** Get monitor's name by its monitor id (index into the 874 innodb_counter_info array 875 @return corresponding monitor name, or NULL if no such 876 monitor */ 877 const char *srv_mon_get_name( 878 monitor_id_t monitor_id); /*!< id index into the 879 innodb_counter_info array */ 880 881 /** Turn on/off/reset monitor counters in a module. If module_value 882 is NUM_MONITOR then turn on all monitor counters. */ 883 void srv_mon_set_module_control( 884 monitor_id_t module_id, /*!< in: Module ID as in 885 monitor_counter_id. If it is 886 set to NUM_MONITOR, this means 887 we shall turn on all the counters */ 888 mon_option_t set_option); /*!< in: Turn on/off reset the 889 counter */ 890 /** This function consolidates some existing server counters used 891 by "system status variables". These existing system variables do not have 892 mechanism to start/stop and reset the counters, so we simulate these 893 controls by remembering the corresponding counter values when the 894 corresponding monitors are turned on/off/reset, and do appropriate 895 mathematics to deduct the actual value. */ 896 void srv_mon_process_existing_counter( 897 monitor_id_t monitor_id, /*!< in: the monitor's ID as in 898 monitor_counter_id */ 899 mon_option_t set_option); /*!< in: Turn on/off reset the 900 counter */ 901 /** This function is used to calculate the maximum counter value 902 since the start of monitor counter 903 @return max counter value since start. */ 904 UNIV_INLINE 905 mon_type_t srv_mon_calc_max_since_start( 906 monitor_id_t monitor); /*!< in: monitor id */ 907 /** This function is used to calculate the minimum counter value 908 since the start of monitor counter 909 @return min counter value since start. */ 910 UNIV_INLINE 911 mon_type_t srv_mon_calc_min_since_start( 912 monitor_id_t monitor); /*!< in: monitor id*/ 913 /** Reset a monitor, create a new base line with the current monitor 914 value. This baseline is recorded by MONITOR_VALUE_RESET(monitor) */ 915 void srv_mon_reset(monitor_id_t monitor); /*!< in: monitor id*/ 916 /** This function resets all values of a monitor counter */ 917 UNIV_INLINE 918 void srv_mon_reset_all(monitor_id_t monitor); /*!< in: monitor id*/ 919 /** Turn on monitor counters that are marked as default ON. */ 920 void srv_mon_default_on(void); 921 922 #include "srv0mon.ic" 923 #else /* !UNIV_HOTBACKUP */ 924 #define MONITOR_INC(x) ((void)0) 925 #define MONITOR_DEC(x) ((void)0) 926 #endif /* !UNIV_HOTBACKUP */ 927 928 #define MONITOR_INC_WAIT_STATS_EX(monitor_prefix, monitor_sufix, wait_stats) \ 929 if ((wait_stats).wait_loops == 0) { \ 930 MONITOR_INC(monitor_prefix##NO_WAITS##monitor_sufix); \ 931 } else { \ 932 MONITOR_INC(monitor_prefix##WAITS##monitor_sufix); \ 933 MONITOR_INC_VALUE(monitor_prefix##WAIT_LOOPS##monitor_sufix, \ 934 (wait_stats).wait_loops); \ 935 } 936 937 #define MONITOR_INC_WAIT_STATS(monitor_prefix, wait_stats) \ 938 MONITOR_INC_WAIT_STATS_EX(monitor_prefix, , wait_stats); 939 940 #endif 941