1 /*****************************************************************************
2
3 Copyright (c) 2010, 2021, Oracle and/or its affiliates.
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 along with
23 this program; if not, write to the Free Software Foundation, Inc.,
24 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
25
26 *****************************************************************************/
27
28 /**************************************************//**
29 @file srv/srv0mon.cc
30 Database monitor counter interfaces
31
32 Created 12/9/2009 Jimmy Yang
33 *******************************************************/
34
35 #ifndef UNIV_HOTBACKUP
36 #include "buf0buf.h"
37 #include "dict0mem.h"
38 #include "ibuf0ibuf.h"
39 #include "lock0lock.h"
40 #include "mach0data.h"
41 #include "os0file.h"
42 #include "srv0mon.h"
43 #include "srv0srv.h"
44 #include "trx0rseg.h"
45 #include "trx0sys.h"
46 #ifdef UNIV_NONINL
47 #include "srv0mon.ic"
48 #endif
49
50 /* Macro to standardize the counter names for counters in the
51 "monitor_buf_page" module as they have very structured defines */
52 #define MONITOR_BUF_PAGE(name, description, code, op, op_code) \
53 {"buffer_page_" op "_" name, "buffer_page_io", \
54 "Number of " description " Pages " op, \
55 MONITOR_GROUP_MODULE, MONITOR_DEFAULT_START, \
56 MONITOR_##code##_##op_code}
57
58 #define MONITOR_BUF_PAGE_READ(name, description, code) \
59 MONITOR_BUF_PAGE(name, description, code, "read", PAGE_READ)
60
61 #define MONITOR_BUF_PAGE_WRITTEN(name, description, code) \
62 MONITOR_BUF_PAGE(name, description, code, "written", PAGE_WRITTEN)
63
64
65 /** This array defines basic static information of monitor counters,
66 including each monitor's name, module it belongs to, a short
67 description and its property/type and corresponding monitor_id.
68 Please note: If you add a monitor here, please add its corresponding
69 monitor_id to "enum monitor_id_value" structure in srv0mon.h file. */
70
71 static monitor_info_t innodb_counter_info[] =
72 {
73 /* A dummy item to mark the module start, this is
74 to accomodate the default value (0) set for the
75 global variables with the control system. */
76 {"module_start", "module_start", "module_start",
77 MONITOR_MODULE,
78 MONITOR_DEFAULT_START, MONITOR_DEFAULT_START},
79
80 /* ========== Counters for Server Metadata ========== */
81 {"module_metadata", "metadata", "Server Metadata",
82 MONITOR_MODULE,
83 MONITOR_DEFAULT_START, MONITOR_MODULE_METADATA},
84
85 {"metadata_table_handles_opened", "metadata",
86 "Number of table handles opened",
87 MONITOR_NONE,
88 MONITOR_DEFAULT_START, MONITOR_TABLE_OPEN},
89
90 {"metadata_table_handles_closed", "metadata",
91 "Number of table handles closed",
92 MONITOR_NONE,
93 MONITOR_DEFAULT_START, MONITOR_TABLE_CLOSE},
94
95 {"metadata_table_reference_count", "metadata",
96 "Table reference counter",
97 MONITOR_NONE,
98 MONITOR_DEFAULT_START, MONITOR_TABLE_REFERENCE},
99
100 /* ========== Counters for Lock Module ========== */
101 {"module_lock", "lock", "Lock Module",
102 MONITOR_MODULE,
103 MONITOR_DEFAULT_START, MONITOR_MODULE_LOCK},
104
105 {"lock_deadlocks", "lock", "Number of deadlocks",
106 MONITOR_DEFAULT_ON,
107 MONITOR_DEFAULT_START, MONITOR_DEADLOCK},
108
109 {"lock_timeouts", "lock", "Number of lock timeouts",
110 MONITOR_DEFAULT_ON,
111 MONITOR_DEFAULT_START, MONITOR_TIMEOUT},
112
113 {"lock_rec_lock_waits", "lock",
114 "Number of times enqueued into record lock wait queue",
115 MONITOR_NONE,
116 MONITOR_DEFAULT_START, MONITOR_LOCKREC_WAIT},
117
118 {"lock_table_lock_waits", "lock",
119 "Number of times enqueued into table lock wait queue",
120 MONITOR_NONE,
121 MONITOR_DEFAULT_START, MONITOR_TABLELOCK_WAIT},
122
123 {"lock_rec_lock_requests", "lock",
124 "Number of record locks requested",
125 MONITOR_NONE,
126 MONITOR_DEFAULT_START, MONITOR_NUM_RECLOCK_REQ},
127
128 {"lock_rec_lock_created", "lock", "Number of record locks created",
129 MONITOR_NONE,
130 MONITOR_DEFAULT_START, MONITOR_RECLOCK_CREATED},
131
132 {"lock_rec_lock_removed", "lock",
133 "Number of record locks removed from the lock queue",
134 MONITOR_NONE,
135 MONITOR_DEFAULT_START, MONITOR_RECLOCK_REMOVED},
136
137 {"lock_rec_locks", "lock",
138 "Current number of record locks on tables",
139 MONITOR_NONE,
140 MONITOR_DEFAULT_START, MONITOR_NUM_RECLOCK},
141
142 {"lock_table_lock_created", "lock", "Number of table locks created",
143 MONITOR_NONE,
144 MONITOR_DEFAULT_START, MONITOR_TABLELOCK_CREATED},
145
146 {"lock_table_lock_removed", "lock",
147 "Number of table locks removed from the lock queue",
148 MONITOR_NONE,
149 MONITOR_DEFAULT_START, MONITOR_TABLELOCK_REMOVED},
150
151 {"lock_table_locks", "lock",
152 "Current number of table locks on tables",
153 MONITOR_NONE,
154 MONITOR_DEFAULT_START, MONITOR_NUM_TABLELOCK},
155
156 {"lock_row_lock_current_waits", "lock",
157 "Number of row locks currently being waited for"
158 " (innodb_row_lock_current_waits)",
159 static_cast<monitor_type_t>(
160 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
161 MONITOR_DEFAULT_START, MONITOR_OVLD_ROW_LOCK_CURRENT_WAIT},
162
163 {"lock_row_lock_time", "lock",
164 "Time spent in acquiring row locks, in milliseconds"
165 " (innodb_row_lock_time)",
166 static_cast<monitor_type_t>(
167 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
168 MONITOR_DEFAULT_START, MONITOR_OVLD_LOCK_WAIT_TIME},
169
170 {"lock_row_lock_time_max", "lock",
171 "The maximum time to acquire a row lock, in milliseconds"
172 " (innodb_row_lock_time_max)",
173 static_cast<monitor_type_t>(
174 MONITOR_EXISTING | MONITOR_DISPLAY_CURRENT | MONITOR_DEFAULT_ON),
175 MONITOR_DEFAULT_START, MONITOR_OVLD_LOCK_MAX_WAIT_TIME},
176
177 {"lock_row_lock_waits", "lock",
178 "Number of times a row lock had to be waited for"
179 " (innodb_row_lock_waits)",
180 static_cast<monitor_type_t>(
181 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
182 MONITOR_DEFAULT_START, MONITOR_OVLD_ROW_LOCK_WAIT},
183
184 {"lock_row_lock_time_avg", "lock",
185 "The average time to acquire a row lock, in milliseconds"
186 " (innodb_row_lock_time_avg)",
187 static_cast<monitor_type_t>(
188 MONITOR_EXISTING | MONITOR_DISPLAY_CURRENT | MONITOR_DEFAULT_ON),
189 MONITOR_DEFAULT_START, MONITOR_OVLD_LOCK_AVG_WAIT_TIME},
190
191 /* ========== Counters for Buffer Manager and I/O ========== */
192 {"module_buffer", "buffer", "Buffer Manager Module",
193 MONITOR_MODULE,
194 MONITOR_DEFAULT_START, MONITOR_MODULE_BUFFER},
195
196 {"buffer_pool_size", "server",
197 "Server buffer pool size (all buffer pools) in bytes",
198 static_cast<monitor_type_t>(
199 MONITOR_EXISTING | MONITOR_DEFAULT_ON | MONITOR_DISPLAY_CURRENT),
200 MONITOR_DEFAULT_START, MONITOR_OVLD_BUFFER_POOL_SIZE},
201
202 {"buffer_pool_reads", "buffer",
203 "Number of reads directly from disk (innodb_buffer_pool_reads)",
204 static_cast<monitor_type_t>(
205 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
206 MONITOR_DEFAULT_START, MONITOR_OVLD_BUF_POOL_READS},
207
208 {"buffer_pool_read_requests", "buffer",
209 "Number of logical read requests (innodb_buffer_pool_read_requests)",
210 static_cast<monitor_type_t>(
211 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
212 MONITOR_DEFAULT_START, MONITOR_OVLD_BUF_POOL_READ_REQUESTS},
213
214 {"buffer_pool_write_requests", "buffer",
215 "Number of write requests (innodb_buffer_pool_write_requests)",
216 static_cast<monitor_type_t>(
217 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
218 MONITOR_DEFAULT_START, MONITOR_OVLD_BUF_POOL_WRITE_REQUEST},
219
220 {"buffer_pool_wait_free", "buffer",
221 "Number of times waited for free buffer"
222 " (innodb_buffer_pool_wait_free)",
223 static_cast<monitor_type_t>(
224 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
225 MONITOR_DEFAULT_START, MONITOR_OVLD_BUF_POOL_WAIT_FREE},
226
227 {"buffer_pool_read_ahead", "buffer",
228 "Number of pages read as read ahead (innodb_buffer_pool_read_ahead)",
229 static_cast<monitor_type_t>(
230 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
231 MONITOR_DEFAULT_START, MONITOR_OVLD_BUF_POOL_READ_AHEAD},
232
233 {"buffer_pool_read_ahead_evicted", "buffer",
234 "Read-ahead pages evicted without being accessed"
235 " (innodb_buffer_pool_read_ahead_evicted)",
236 static_cast<monitor_type_t>(
237 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
238 MONITOR_DEFAULT_START, MONITOR_OVLD_BUF_POOL_READ_AHEAD_EVICTED},
239
240 {"buffer_pool_pages_total", "buffer",
241 "Total buffer pool size in pages (innodb_buffer_pool_pages_total)",
242 static_cast<monitor_type_t>(
243 MONITOR_EXISTING | MONITOR_DISPLAY_CURRENT | MONITOR_DEFAULT_ON),
244 MONITOR_DEFAULT_START, MONITOR_OVLD_BUF_POOL_PAGE_TOTAL},
245
246 {"buffer_pool_pages_misc", "buffer",
247 "Buffer pages for misc use such as row locks or the adaptive"
248 " hash index (innodb_buffer_pool_pages_misc)",
249 static_cast<monitor_type_t>(
250 MONITOR_EXISTING | MONITOR_DISPLAY_CURRENT | MONITOR_DEFAULT_ON),
251 MONITOR_DEFAULT_START, MONITOR_OVLD_BUF_POOL_PAGE_MISC},
252
253 {"buffer_pool_pages_data", "buffer",
254 "Buffer pages containing data (innodb_buffer_pool_pages_data)",
255 static_cast<monitor_type_t>(
256 MONITOR_EXISTING | MONITOR_DISPLAY_CURRENT | MONITOR_DEFAULT_ON),
257 MONITOR_DEFAULT_START, MONITOR_OVLD_BUF_POOL_PAGES_DATA},
258
259 {"buffer_pool_bytes_data", "buffer",
260 "Buffer bytes containing data (innodb_buffer_pool_bytes_data)",
261 static_cast<monitor_type_t>(
262 MONITOR_EXISTING | MONITOR_DISPLAY_CURRENT | MONITOR_DEFAULT_ON),
263 MONITOR_DEFAULT_START, MONITOR_OVLD_BUF_POOL_BYTES_DATA},
264
265 {"buffer_pool_pages_dirty", "buffer",
266 "Buffer pages currently dirty (innodb_buffer_pool_pages_dirty)",
267 static_cast<monitor_type_t>(
268 MONITOR_EXISTING | MONITOR_DISPLAY_CURRENT | MONITOR_DEFAULT_ON),
269 MONITOR_DEFAULT_START, MONITOR_OVLD_BUF_POOL_PAGES_DIRTY},
270
271 {"buffer_pool_bytes_dirty", "buffer",
272 "Buffer bytes currently dirty (innodb_buffer_pool_bytes_dirty)",
273 static_cast<monitor_type_t>(
274 MONITOR_EXISTING | MONITOR_DISPLAY_CURRENT | MONITOR_DEFAULT_ON),
275 MONITOR_DEFAULT_START, MONITOR_OVLD_BUF_POOL_BYTES_DIRTY},
276
277 {"buffer_pool_pages_free", "buffer",
278 "Buffer pages currently free (innodb_buffer_pool_pages_free)",
279 static_cast<monitor_type_t>(
280 MONITOR_EXISTING | MONITOR_DISPLAY_CURRENT | MONITOR_DEFAULT_ON),
281 MONITOR_DEFAULT_START, MONITOR_OVLD_BUF_POOL_PAGES_FREE},
282
283 {"buffer_pages_created", "buffer",
284 "Number of pages created (innodb_pages_created)",
285 static_cast<monitor_type_t>(
286 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
287 MONITOR_DEFAULT_START, MONITOR_OVLD_PAGE_CREATED},
288
289 {"buffer_pages_written", "buffer",
290 "Number of pages written (innodb_pages_written)",
291 static_cast<monitor_type_t>(
292 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
293 MONITOR_DEFAULT_START, MONITOR_OVLD_PAGES_WRITTEN},
294
295 {"buffer_pages_read", "buffer",
296 "Number of pages read (innodb_pages_read)",
297 static_cast<monitor_type_t>(
298 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
299 MONITOR_DEFAULT_START, MONITOR_OVLD_PAGES_READ},
300
301 {"buffer_pages0_read", "buffer",
302 "Number of page 0 read (innodb_pages0_read)",
303 static_cast<monitor_type_t>(
304 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
305 MONITOR_DEFAULT_START, MONITOR_OVLD_PAGES0_READ},
306
307 {"buffer_data_reads", "buffer",
308 "Amount of data read in bytes (innodb_data_reads)",
309 static_cast<monitor_type_t>(
310 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
311 MONITOR_DEFAULT_START, MONITOR_OVLD_BYTE_READ},
312
313 {"buffer_data_written", "buffer",
314 "Amount of data written in bytes (innodb_data_written)",
315 static_cast<monitor_type_t>(
316 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
317 MONITOR_DEFAULT_START, MONITOR_OVLD_BYTE_WRITTEN},
318
319 /* Cumulative counter for scanning in flush batches */
320 {"buffer_flush_batch_scanned", "buffer",
321 "Total pages scanned as part of flush batch",
322 MONITOR_SET_OWNER,
323 MONITOR_FLUSH_BATCH_SCANNED_NUM_CALL,
324 MONITOR_FLUSH_BATCH_SCANNED},
325
326 {"buffer_flush_batch_num_scan", "buffer",
327 "Number of times buffer flush list flush is called",
328 MONITOR_SET_MEMBER, MONITOR_FLUSH_BATCH_SCANNED,
329 MONITOR_FLUSH_BATCH_SCANNED_NUM_CALL},
330
331 {"buffer_flush_batch_scanned_per_call", "buffer",
332 "Pages scanned per flush batch scan",
333 MONITOR_SET_MEMBER, MONITOR_FLUSH_BATCH_SCANNED,
334 MONITOR_FLUSH_BATCH_SCANNED_PER_CALL},
335
336 /* Cumulative counter for pages flushed in flush batches */
337 {"buffer_flush_batch_total_pages", "buffer",
338 "Total pages flushed as part of flush batch",
339 MONITOR_SET_OWNER, MONITOR_FLUSH_BATCH_COUNT,
340 MONITOR_FLUSH_BATCH_TOTAL_PAGE},
341
342 {"buffer_flush_batches", "buffer",
343 "Number of flush batches",
344 MONITOR_SET_MEMBER, MONITOR_FLUSH_BATCH_TOTAL_PAGE,
345 MONITOR_FLUSH_BATCH_COUNT},
346
347 {"buffer_flush_batch_pages", "buffer",
348 "Pages queued as a flush batch",
349 MONITOR_SET_MEMBER, MONITOR_FLUSH_BATCH_TOTAL_PAGE,
350 MONITOR_FLUSH_BATCH_PAGES},
351
352 /* Cumulative counter for flush batches because of neighbor */
353 {"buffer_flush_neighbor_total_pages", "buffer",
354 "Total neighbors flushed as part of neighbor flush",
355 MONITOR_SET_OWNER, MONITOR_FLUSH_NEIGHBOR_COUNT,
356 MONITOR_FLUSH_NEIGHBOR_TOTAL_PAGE},
357
358 {"buffer_flush_neighbor", "buffer",
359 "Number of times neighbors flushing is invoked",
360 MONITOR_SET_MEMBER, MONITOR_FLUSH_NEIGHBOR_TOTAL_PAGE,
361 MONITOR_FLUSH_NEIGHBOR_COUNT},
362
363 {"buffer_flush_neighbor_pages", "buffer",
364 "Pages queued as a neighbor batch",
365 MONITOR_SET_MEMBER, MONITOR_FLUSH_NEIGHBOR_TOTAL_PAGE,
366 MONITOR_FLUSH_NEIGHBOR_PAGES},
367
368 {"buffer_flush_n_to_flush_requested", "buffer",
369 "Number of pages requested for flushing.",
370 MONITOR_NONE,
371 MONITOR_DEFAULT_START, MONITOR_FLUSH_N_TO_FLUSH_REQUESTED},
372
373 {"buffer_flush_n_to_flush_by_age", "buffer",
374 "Number of pages target by LSN Age for flushing.",
375 MONITOR_NONE,
376 MONITOR_DEFAULT_START, MONITOR_FLUSH_N_TO_FLUSH_BY_AGE},
377
378 {"buffer_flush_adaptive_avg_time_slot", "buffer",
379 "Avg time (ms) spent for adaptive flushing recently per slot.",
380 MONITOR_NONE,
381 MONITOR_DEFAULT_START, MONITOR_FLUSH_ADAPTIVE_AVG_TIME_SLOT},
382
383 {"buffer_LRU_batch_flush_avg_time_slot", "buffer",
384 "Avg time (ms) spent for LRU batch flushing recently per slot. "
385 "Always 0 in XtraDB.",
386 MONITOR_NONE,
387 MONITOR_DEFAULT_START, MONITOR_LRU_BATCH_FLUSH_AVG_TIME_SLOT},
388
389 {"buffer_flush_adaptive_avg_time_thread", "buffer",
390 "Avg time (ms) spent for adaptive flushing recently per thread.",
391 MONITOR_NONE,
392 MONITOR_DEFAULT_START, MONITOR_FLUSH_ADAPTIVE_AVG_TIME_THREAD},
393
394 {"buffer_LRU_batch_flush_avg_time_thread", "buffer",
395 "Avg time (ms) spent for LRU batch flushing recently per thread."
396 "Always 0 in XtraDB.",
397 MONITOR_NONE,
398 MONITOR_DEFAULT_START, MONITOR_LRU_BATCH_FLUSH_AVG_TIME_THREAD},
399
400 {"buffer_flush_adaptive_avg_time_est", "buffer",
401 "Estimated time (ms) spent for adaptive flushing recently.",
402 MONITOR_NONE,
403 MONITOR_DEFAULT_START, MONITOR_FLUSH_ADAPTIVE_AVG_TIME_EST},
404
405 {"buffer_LRU_batch_flush_avg_time_est", "buffer",
406 "Estimated time (ms) spent for LRU batch flushing recently."
407 "Always 0 in XtraDB.",
408 MONITOR_NONE,
409 MONITOR_DEFAULT_START, MONITOR_LRU_BATCH_FLUSH_AVG_TIME_EST},
410
411 {"buffer_flush_avg_time", "buffer",
412 "Avg time (ms) spent for flushing recently.",
413 MONITOR_NONE,
414 MONITOR_DEFAULT_START, MONITOR_FLUSH_AVG_TIME},
415
416 {"buffer_flush_adaptive_avg_pass", "buffer",
417 "Numner of adaptive flushes passed during the recent Avg period.",
418 MONITOR_NONE,
419 MONITOR_DEFAULT_START, MONITOR_FLUSH_ADAPTIVE_AVG_PASS},
420
421 {"buffer_LRU_batch_flush_avg_pass", "buffer",
422 "Number of LRU batch flushes passed during the recent Avg period."
423 "Always 0 in XtraDB.",
424 MONITOR_NONE,
425 MONITOR_DEFAULT_START, MONITOR_LRU_BATCH_FLUSH_AVG_PASS},
426
427 {"buffer_flush_avg_pass", "buffer",
428 "Number of flushes passed during the recent Avg period.",
429 MONITOR_NONE,
430 MONITOR_DEFAULT_START, MONITOR_FLUSH_AVG_PASS},
431
432 {"buffer_LRU_get_free_loops", "buffer",
433 "Total loops in LRU get free.",
434 MONITOR_NONE,
435 MONITOR_DEFAULT_START, MONITOR_LRU_GET_FREE_LOOPS},
436
437 {"buffer_LRU_get_free_waits", "buffer",
438 "Total sleep waits in LRU get free.",
439 MONITOR_NONE,
440 MONITOR_DEFAULT_START, MONITOR_LRU_GET_FREE_WAITS},
441
442 {"buffer_flush_avg_page_rate", "buffer",
443 "Average number of pages at which flushing is happening",
444 MONITOR_NONE,
445 MONITOR_DEFAULT_START, MONITOR_FLUSH_AVG_PAGE_RATE},
446
447 {"buffer_flush_lsn_avg_rate", "buffer",
448 "Average redo generation rate",
449 MONITOR_NONE,
450 MONITOR_DEFAULT_START, MONITOR_FLUSH_LSN_AVG_RATE},
451
452 {"buffer_flush_pct_for_dirty", "buffer",
453 "Percent of IO capacity used to avoid max dirty page limit",
454 MONITOR_NONE,
455 MONITOR_DEFAULT_START, MONITOR_FLUSH_PCT_FOR_DIRTY},
456
457 {"buffer_flush_pct_for_lsn", "buffer",
458 "Percent of IO capacity used to avoid reusable redo space limit",
459 MONITOR_NONE,
460 MONITOR_DEFAULT_START, MONITOR_FLUSH_PCT_FOR_LSN},
461
462 {"buffer_flush_sync_waits", "buffer",
463 "Number of times a wait happens due to sync flushing",
464 MONITOR_NONE,
465 MONITOR_DEFAULT_START, MONITOR_FLUSH_SYNC_WAITS},
466
467 /* Cumulative counter for flush batches for adaptive flushing */
468 {"buffer_flush_adaptive_total_pages", "buffer",
469 "Total pages flushed as part of adaptive flushing",
470 MONITOR_SET_OWNER, MONITOR_FLUSH_ADAPTIVE_COUNT,
471 MONITOR_FLUSH_ADAPTIVE_TOTAL_PAGE},
472
473 {"buffer_flush_adaptive", "buffer",
474 "Number of adaptive batches",
475 MONITOR_SET_MEMBER, MONITOR_FLUSH_ADAPTIVE_TOTAL_PAGE,
476 MONITOR_FLUSH_ADAPTIVE_COUNT},
477
478 {"buffer_flush_adaptive_pages", "buffer",
479 "Pages queued as an adaptive batch",
480 MONITOR_SET_MEMBER, MONITOR_FLUSH_ADAPTIVE_TOTAL_PAGE,
481 MONITOR_FLUSH_ADAPTIVE_PAGES},
482
483 /* Cumulative counter for flush batches because of sync */
484 {"buffer_flush_sync_total_pages", "buffer",
485 "Total pages flushed as part of sync batches",
486 MONITOR_SET_OWNER, MONITOR_FLUSH_SYNC_COUNT,
487 MONITOR_FLUSH_SYNC_TOTAL_PAGE},
488
489 {"buffer_flush_sync", "buffer",
490 "Number of sync batches",
491 MONITOR_SET_MEMBER, MONITOR_FLUSH_SYNC_TOTAL_PAGE,
492 MONITOR_FLUSH_SYNC_COUNT},
493
494 {"buffer_flush_sync_pages", "buffer",
495 "Pages queued as a sync batch",
496 MONITOR_SET_MEMBER, MONITOR_FLUSH_SYNC_TOTAL_PAGE,
497 MONITOR_FLUSH_SYNC_PAGES},
498
499 /* Cumulative counter for flush batches because of background */
500 {"buffer_flush_background_total_pages", "buffer",
501 "Total pages flushed as part of background batches",
502 MONITOR_SET_OWNER, MONITOR_FLUSH_BACKGROUND_COUNT,
503 MONITOR_FLUSH_BACKGROUND_TOTAL_PAGE},
504
505 {"buffer_flush_background", "buffer",
506 "Number of background batches",
507 MONITOR_SET_MEMBER, MONITOR_FLUSH_BACKGROUND_TOTAL_PAGE,
508 MONITOR_FLUSH_BACKGROUND_COUNT},
509
510 {"buffer_flush_background_pages", "buffer",
511 "Pages queued as a background batch",
512 MONITOR_SET_MEMBER, MONITOR_FLUSH_BACKGROUND_TOTAL_PAGE,
513 MONITOR_FLUSH_BACKGROUND_PAGES},
514
515 /* Cumulative counter for LRU batch scan */
516 {"buffer_LRU_batch_scanned", "buffer",
517 "Total pages scanned as part of LRU batch",
518 MONITOR_SET_OWNER, MONITOR_LRU_BATCH_SCANNED_NUM_CALL,
519 MONITOR_LRU_BATCH_SCANNED},
520
521 {"buffer_LRU_batch_num_scan", "buffer",
522 "Number of times LRU batch is called",
523 MONITOR_SET_MEMBER, MONITOR_LRU_BATCH_SCANNED,
524 MONITOR_LRU_BATCH_SCANNED_NUM_CALL},
525
526 {"buffer_LRU_batch_scanned_per_call", "buffer",
527 "Pages scanned per LRU batch call",
528 MONITOR_SET_MEMBER, MONITOR_LRU_BATCH_SCANNED,
529 MONITOR_LRU_BATCH_SCANNED_PER_CALL},
530
531 /* Cumulative counter for LRU batch pages flushed */
532 {"buffer_LRU_batch_flush_total_pages", "buffer",
533 "Total pages flushed as part of LRU batches",
534 MONITOR_SET_OWNER, MONITOR_LRU_BATCH_FLUSH_COUNT,
535 MONITOR_LRU_BATCH_FLUSH_TOTAL_PAGE},
536
537 {"buffer_LRU_batches_flush", "buffer",
538 "Number of LRU batches",
539 MONITOR_SET_MEMBER, MONITOR_LRU_BATCH_FLUSH_TOTAL_PAGE,
540 MONITOR_LRU_BATCH_FLUSH_COUNT},
541
542 {"buffer_LRU_batch_flush_pages", "buffer",
543 "Pages queued as an LRU batch",
544 MONITOR_SET_MEMBER, MONITOR_LRU_BATCH_FLUSH_TOTAL_PAGE,
545 MONITOR_LRU_BATCH_FLUSH_PAGES},
546
547 /* Cumulative counter for LRU batch pages flushed */
548 {"buffer_LRU_batch_evict_total_pages", "buffer",
549 "Total pages evicted as part of LRU batches",
550 MONITOR_SET_OWNER, MONITOR_LRU_BATCH_EVICT_COUNT,
551 MONITOR_LRU_BATCH_EVICT_TOTAL_PAGE},
552
553 {"buffer_LRU_batches_evict", "buffer",
554 "Number of LRU batches",
555 MONITOR_SET_MEMBER, MONITOR_LRU_BATCH_EVICT_TOTAL_PAGE,
556 MONITOR_LRU_BATCH_EVICT_COUNT},
557
558 {"buffer_LRU_batch_evict_pages", "buffer",
559 "Pages queued as an LRU batch",
560 MONITOR_SET_MEMBER, MONITOR_LRU_BATCH_EVICT_TOTAL_PAGE,
561 MONITOR_LRU_BATCH_EVICT_PAGES},
562
563 /* Cumulative counter for single page LRU scans */
564 {"buffer_LRU_single_flush_scanned", "buffer",
565 "Total pages scanned as part of single page LRU flush",
566 MONITOR_SET_OWNER,
567 MONITOR_LRU_SINGLE_FLUSH_SCANNED_NUM_CALL,
568 MONITOR_LRU_SINGLE_FLUSH_SCANNED},
569
570 {"buffer_LRU_single_flush_num_scan", "buffer",
571 "Number of times single page LRU flush is called",
572 MONITOR_SET_MEMBER, MONITOR_LRU_SINGLE_FLUSH_SCANNED,
573 MONITOR_LRU_SINGLE_FLUSH_SCANNED_NUM_CALL},
574
575 {"buffer_LRU_single_flush_scanned_per_call", "buffer",
576 "Page scanned per single LRU flush",
577 MONITOR_SET_MEMBER, MONITOR_LRU_SINGLE_FLUSH_SCANNED,
578 MONITOR_LRU_SINGLE_FLUSH_SCANNED_PER_CALL},
579
580 {"buffer_LRU_single_flush_failure_count", "Buffer",
581 "Number of times attempt to flush a single page from LRU failed",
582 MONITOR_NONE,
583 MONITOR_DEFAULT_START, MONITOR_LRU_SINGLE_FLUSH_FAILURE_COUNT},
584
585 {"buffer_LRU_get_free_search", "Buffer",
586 "Number of searches performed for a clean page",
587 MONITOR_NONE,
588 MONITOR_DEFAULT_START, MONITOR_LRU_GET_FREE_SEARCH},
589
590 /* Cumulative counter for LRU search scans */
591 {"buffer_LRU_search_scanned", "buffer",
592 "Total pages scanned as part of LRU search",
593 MONITOR_SET_OWNER,
594 MONITOR_LRU_SEARCH_SCANNED_NUM_CALL,
595 MONITOR_LRU_SEARCH_SCANNED},
596
597 {"buffer_LRU_search_num_scan", "buffer",
598 "Number of times LRU search is performed",
599 MONITOR_SET_MEMBER, MONITOR_LRU_SEARCH_SCANNED,
600 MONITOR_LRU_SEARCH_SCANNED_NUM_CALL},
601
602 {"buffer_LRU_search_scanned_per_call", "buffer",
603 "Page scanned per single LRU search",
604 MONITOR_SET_MEMBER, MONITOR_LRU_SEARCH_SCANNED,
605 MONITOR_LRU_SEARCH_SCANNED_PER_CALL},
606
607 /* Cumulative counter for LRU unzip search scans */
608 {"buffer_LRU_unzip_search_scanned", "buffer",
609 "Total pages scanned as part of LRU unzip search",
610 MONITOR_SET_OWNER,
611 MONITOR_LRU_UNZIP_SEARCH_SCANNED_NUM_CALL,
612 MONITOR_LRU_UNZIP_SEARCH_SCANNED},
613
614 {"buffer_LRU_unzip_search_num_scan", "buffer",
615 "Number of times LRU unzip search is performed",
616 MONITOR_SET_MEMBER, MONITOR_LRU_UNZIP_SEARCH_SCANNED,
617 MONITOR_LRU_UNZIP_SEARCH_SCANNED_NUM_CALL},
618
619 {"buffer_LRU_unzip_search_scanned_per_call", "buffer",
620 "Page scanned per single LRU unzip search",
621 MONITOR_SET_MEMBER, MONITOR_LRU_UNZIP_SEARCH_SCANNED,
622 MONITOR_LRU_UNZIP_SEARCH_SCANNED_PER_CALL},
623
624 /* ========== Counters for Buffer Page I/O ========== */
625 {"module_buffer_page", "buffer_page_io", "Buffer Page I/O Module",
626 static_cast<monitor_type_t>(
627 MONITOR_MODULE | MONITOR_GROUP_MODULE),
628 MONITOR_DEFAULT_START, MONITOR_MODULE_BUF_PAGE},
629
630 MONITOR_BUF_PAGE_READ("index_leaf","Index Leaf", INDEX_LEAF),
631
632 MONITOR_BUF_PAGE_READ("index_non_leaf","Index Non-leaf",
633 INDEX_NON_LEAF),
634
635 MONITOR_BUF_PAGE_READ("index_ibuf_leaf", "Insert Buffer Index Leaf",
636 INDEX_IBUF_LEAF),
637
638 MONITOR_BUF_PAGE_READ("index_ibuf_non_leaf",
639 "Insert Buffer Index Non-Leaf",
640 INDEX_IBUF_NON_LEAF),
641
642 MONITOR_BUF_PAGE_READ("undo_log", "Undo Log", UNDO_LOG),
643
644 MONITOR_BUF_PAGE_READ("index_inode", "Index Inode", INODE),
645
646 MONITOR_BUF_PAGE_READ("ibuf_free_list", "Insert Buffer Free List",
647 IBUF_FREELIST),
648
649 MONITOR_BUF_PAGE_READ("ibuf_bitmap", "Insert Buffer Bitmap",
650 IBUF_BITMAP),
651
652 MONITOR_BUF_PAGE_READ("system_page", "System", SYSTEM),
653
654 MONITOR_BUF_PAGE_READ("trx_system", "Transaction System", TRX_SYSTEM),
655
656 MONITOR_BUF_PAGE_READ("fsp_hdr", "File Space Header", FSP_HDR),
657
658 MONITOR_BUF_PAGE_READ("xdes", "Extent Descriptor", XDES),
659
660 MONITOR_BUF_PAGE_READ("blob", "Uncompressed BLOB", BLOB),
661
662 MONITOR_BUF_PAGE_READ("zblob", "First Compressed BLOB", ZBLOB),
663
664 MONITOR_BUF_PAGE_READ("zblob2", "Subsequent Compressed BLOB", ZBLOB2),
665
666 MONITOR_BUF_PAGE_READ("other", "other/unknown (old version of InnoDB)",
667 OTHER),
668
669 MONITOR_BUF_PAGE_WRITTEN("index_leaf","Index Leaf", INDEX_LEAF),
670
671 MONITOR_BUF_PAGE_WRITTEN("index_non_leaf","Index Non-leaf",
672 INDEX_NON_LEAF),
673
674 MONITOR_BUF_PAGE_WRITTEN("index_ibuf_leaf", "Insert Buffer Index Leaf",
675 INDEX_IBUF_LEAF),
676
677 MONITOR_BUF_PAGE_WRITTEN("index_ibuf_non_leaf",
678 "Insert Buffer Index Non-Leaf",
679 INDEX_IBUF_NON_LEAF),
680
681 MONITOR_BUF_PAGE_WRITTEN("undo_log", "Undo Log", UNDO_LOG),
682
683 MONITOR_BUF_PAGE_WRITTEN("index_inode", "Index Inode", INODE),
684
685 MONITOR_BUF_PAGE_WRITTEN("ibuf_free_list", "Insert Buffer Free List",
686 IBUF_FREELIST),
687
688 MONITOR_BUF_PAGE_WRITTEN("ibuf_bitmap", "Insert Buffer Bitmap",
689 IBUF_BITMAP),
690
691 MONITOR_BUF_PAGE_WRITTEN("system_page", "System", SYSTEM),
692
693 MONITOR_BUF_PAGE_WRITTEN("trx_system", "Transaction System",
694 TRX_SYSTEM),
695
696 MONITOR_BUF_PAGE_WRITTEN("fsp_hdr", "File Space Header", FSP_HDR),
697
698 MONITOR_BUF_PAGE_WRITTEN("xdes", "Extent Descriptor", XDES),
699
700 MONITOR_BUF_PAGE_WRITTEN("blob", "Uncompressed BLOB", BLOB),
701
702 MONITOR_BUF_PAGE_WRITTEN("zblob", "First Compressed BLOB", ZBLOB),
703
704 MONITOR_BUF_PAGE_WRITTEN("zblob2", "Subsequent Compressed BLOB",
705 ZBLOB2),
706
707 MONITOR_BUF_PAGE_WRITTEN("other", "other/unknown (old version InnoDB)",
708 OTHER),
709
710 /* ========== Counters for OS level operations ========== */
711 {"module_os", "os", "OS Level Operation",
712 MONITOR_MODULE,
713 MONITOR_DEFAULT_START, MONITOR_MODULE_OS},
714
715 {"os_data_reads", "os",
716 "Number of reads initiated (innodb_data_reads)",
717 static_cast<monitor_type_t>(
718 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
719 MONITOR_DEFAULT_START, MONITOR_OVLD_OS_FILE_READ},
720
721 {"os_data_writes", "os",
722 "Number of writes initiated (innodb_data_writes)",
723 static_cast<monitor_type_t>(
724 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
725 MONITOR_DEFAULT_START, MONITOR_OVLD_OS_FILE_WRITE},
726
727 {"os_data_fsyncs", "os",
728 "Number of fsync() calls (innodb_data_fsyncs)",
729 static_cast<monitor_type_t>(
730 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
731 MONITOR_DEFAULT_START, MONITOR_OVLD_OS_FSYNC},
732
733 {"os_pending_reads", "os", "Number of reads pending",
734 MONITOR_NONE,
735 MONITOR_DEFAULT_START, MONITOR_OS_PENDING_READS},
736
737 {"os_pending_writes", "os", "Number of writes pending",
738 MONITOR_NONE,
739 MONITOR_DEFAULT_START, MONITOR_OS_PENDING_WRITES},
740
741 {"os_log_bytes_written", "os",
742 "Bytes of log written (innodb_os_log_written)",
743 static_cast<monitor_type_t>(
744 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
745 MONITOR_DEFAULT_START, MONITOR_OVLD_OS_LOG_WRITTEN},
746
747 {"os_log_fsyncs", "os",
748 "Number of fsync log writes (innodb_os_log_fsyncs)",
749 static_cast<monitor_type_t>(
750 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
751 MONITOR_DEFAULT_START, MONITOR_OVLD_OS_LOG_FSYNC},
752
753 {"os_log_pending_fsyncs", "os",
754 "Number of pending fsync write (innodb_os_log_pending_fsyncs)",
755 static_cast<monitor_type_t>(
756 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
757 MONITOR_DEFAULT_START, MONITOR_OVLD_OS_LOG_PENDING_FSYNC},
758
759 {"os_log_pending_writes", "os",
760 "Number of pending log file writes (innodb_os_log_pending_writes)",
761 static_cast<monitor_type_t>(
762 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
763 MONITOR_DEFAULT_START, MONITOR_OVLD_OS_LOG_PENDING_WRITES},
764
765 /* ========== Counters for Transaction Module ========== */
766 {"module_trx", "transaction", "Transaction Manager",
767 MONITOR_MODULE,
768 MONITOR_DEFAULT_START, MONITOR_MODULE_TRX},
769
770 {"trx_rw_commits", "transaction",
771 "Number of read-write transactions committed",
772 MONITOR_NONE, MONITOR_DEFAULT_START, MONITOR_TRX_RW_COMMIT},
773
774 {"trx_ro_commits", "transaction",
775 "Number of read-only transactions committed",
776 MONITOR_NONE, MONITOR_DEFAULT_START, MONITOR_TRX_RO_COMMIT},
777
778 {"trx_nl_ro_commits", "transaction",
779 "Number of non-locking auto-commit read-only transactions committed",
780 MONITOR_NONE, MONITOR_DEFAULT_START, MONITOR_TRX_NL_RO_COMMIT},
781
782 {"trx_commits_insert_update", "transaction",
783 "Number of transactions committed with inserts and updates",
784 MONITOR_NONE,
785 MONITOR_DEFAULT_START, MONITOR_TRX_COMMIT_UNDO},
786
787 {"trx_rollbacks", "transaction",
788 "Number of transactions rolled back",
789 MONITOR_NONE,
790 MONITOR_DEFAULT_START, MONITOR_TRX_ROLLBACK},
791
792 {"trx_rollbacks_savepoint", "transaction",
793 "Number of transactions rolled back to savepoint",
794 MONITOR_NONE,
795 MONITOR_DEFAULT_START, MONITOR_TRX_ROLLBACK_SAVEPOINT},
796
797 {"trx_rollback_active", "transaction",
798 "Number of resurrected active transactions rolled back",
799 MONITOR_NONE,
800 MONITOR_DEFAULT_START, MONITOR_TRX_ROLLBACK_ACTIVE},
801
802 {"trx_active_transactions", "transaction",
803 "Number of active transactions",
804 MONITOR_NONE,
805 MONITOR_DEFAULT_START, MONITOR_TRX_ACTIVE},
806
807 {"trx_rseg_history_len", "transaction",
808 "Length of the TRX_RSEG_HISTORY list",
809 static_cast<monitor_type_t>(
810 MONITOR_EXISTING | MONITOR_DISPLAY_CURRENT | MONITOR_DEFAULT_ON),
811 MONITOR_DEFAULT_START, MONITOR_RSEG_HISTORY_LEN},
812
813 {"trx_undo_slots_used", "transaction", "Number of undo slots used",
814 MONITOR_NONE,
815 MONITOR_DEFAULT_START, MONITOR_NUM_UNDO_SLOT_USED},
816
817 {"trx_undo_slots_cached", "transaction",
818 "Number of undo slots cached",
819 MONITOR_NONE,
820 MONITOR_DEFAULT_START, MONITOR_NUM_UNDO_SLOT_CACHED},
821
822 {"trx_rseg_current_size", "transaction",
823 "Current rollback segment size in pages",
824 static_cast<monitor_type_t>(
825 MONITOR_EXISTING | MONITOR_DISPLAY_CURRENT),
826 MONITOR_DEFAULT_START, MONITOR_RSEG_CUR_SIZE},
827
828 /* ========== Counters for Purge Module ========== */
829 {"module_purge", "purge", "Purge Module",
830 MONITOR_MODULE,
831 MONITOR_DEFAULT_START, MONITOR_MODULE_PURGE},
832
833 {"purge_del_mark_records", "purge",
834 "Number of delete-marked rows purged",
835 MONITOR_NONE,
836 MONITOR_DEFAULT_START, MONITOR_N_DEL_ROW_PURGE},
837
838 {"purge_upd_exist_or_extern_records", "purge",
839 "Number of purges on updates of existing records and"
840 " updates on delete marked record with externally stored field",
841 MONITOR_NONE,
842 MONITOR_DEFAULT_START, MONITOR_N_UPD_EXIST_EXTERN},
843
844 {"purge_invoked", "purge",
845 "Number of times purge was invoked",
846 MONITOR_NONE,
847 MONITOR_DEFAULT_START, MONITOR_PURGE_INVOKED},
848
849 {"purge_undo_log_pages", "purge",
850 "Number of undo log pages handled by the purge",
851 MONITOR_NONE,
852 MONITOR_DEFAULT_START, MONITOR_PURGE_N_PAGE_HANDLED},
853
854 {"purge_dml_delay_usec", "purge",
855 "Microseconds DML to be delayed due to purge lagging",
856 MONITOR_DISPLAY_CURRENT,
857 MONITOR_DEFAULT_START, MONITOR_DML_PURGE_DELAY},
858
859 {"purge_stop_count", "purge",
860 "Number of times purge was stopped",
861 MONITOR_DISPLAY_CURRENT,
862 MONITOR_DEFAULT_START, MONITOR_PURGE_STOP_COUNT},
863
864 {"purge_resume_count", "purge",
865 "Number of times purge was resumed",
866 MONITOR_DISPLAY_CURRENT,
867 MONITOR_DEFAULT_START, MONITOR_PURGE_RESUME_COUNT},
868
869 /* ========== Counters for Recovery Module ========== */
870 {"module_log", "recovery", "Recovery Module",
871 MONITOR_MODULE,
872 MONITOR_DEFAULT_START, MONITOR_MODULE_RECOVERY},
873
874 {"log_checkpoints", "recovery", "Number of checkpoints",
875 MONITOR_NONE,
876 MONITOR_DEFAULT_START, MONITOR_NUM_CHECKPOINT},
877
878 {"log_lsn_last_flush", "recovery", "LSN of Last flush",
879 static_cast<monitor_type_t>(
880 MONITOR_EXISTING | MONITOR_DISPLAY_CURRENT),
881 MONITOR_DEFAULT_START, MONITOR_OVLD_LSN_FLUSHDISK},
882
883 {"log_lsn_last_checkpoint", "recovery", "LSN at last checkpoint",
884 static_cast<monitor_type_t>(
885 MONITOR_EXISTING | MONITOR_DISPLAY_CURRENT),
886 MONITOR_DEFAULT_START, MONITOR_OVLD_LSN_CHECKPOINT},
887
888 {"log_lsn_current", "recovery", "Current LSN value",
889 static_cast<monitor_type_t>(
890 MONITOR_EXISTING | MONITOR_DISPLAY_CURRENT),
891 MONITOR_DEFAULT_START, MONITOR_OVLD_LSN_CURRENT},
892
893 {"log_lsn_checkpoint_age", "recovery",
894 "Current LSN value minus LSN at last checkpoint",
895 MONITOR_NONE,
896 MONITOR_DEFAULT_START, MONITOR_LSN_CHECKPOINT_AGE},
897
898 {"log_lsn_buf_pool_oldest", "recovery",
899 "The oldest modified block LSN in the buffer pool",
900 static_cast<monitor_type_t>(
901 MONITOR_EXISTING | MONITOR_DISPLAY_CURRENT),
902 MONITOR_DEFAULT_START, MONITOR_OVLD_BUF_OLDEST_LSN},
903
904 {"log_max_modified_age_async", "recovery",
905 "Maximum LSN difference; when exceeded, start asynchronous preflush",
906 static_cast<monitor_type_t>(
907 MONITOR_EXISTING | MONITOR_DISPLAY_CURRENT),
908 MONITOR_DEFAULT_START, MONITOR_OVLD_MAX_AGE_ASYNC},
909
910 {"log_max_modified_age_sync", "recovery",
911 "Maximum LSN difference; when exceeded, start synchronous preflush",
912 static_cast<monitor_type_t>(
913 MONITOR_EXISTING | MONITOR_DISPLAY_CURRENT),
914 MONITOR_DEFAULT_START, MONITOR_OVLD_MAX_AGE_SYNC},
915
916 {"log_pending_log_flushes", "recovery", "Pending log flushes",
917 MONITOR_NONE,
918 MONITOR_DEFAULT_START, MONITOR_PENDING_LOG_FLUSH},
919
920 {"log_pending_checkpoint_writes", "recovery", "Pending checkpoints",
921 MONITOR_NONE,
922 MONITOR_DEFAULT_START, MONITOR_PENDING_CHECKPOINT_WRITE},
923
924 {"log_num_log_io", "recovery", "Number of log I/Os",
925 MONITOR_NONE,
926 MONITOR_DEFAULT_START, MONITOR_LOG_IO},
927
928 {"log_waits", "recovery",
929 "Number of log waits due to small log buffer (innodb_log_waits)",
930 static_cast<monitor_type_t>(
931 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
932 MONITOR_DEFAULT_START, MONITOR_OVLD_LOG_WAITS},
933
934 {"log_write_requests", "recovery",
935 "Number of log write requests (innodb_log_write_requests)",
936 static_cast<monitor_type_t>(
937 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
938 MONITOR_DEFAULT_START, MONITOR_OVLD_LOG_WRITE_REQUEST},
939
940 {"log_writes", "recovery",
941 "Number of log writes (innodb_log_writes)",
942 static_cast<monitor_type_t>(
943 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
944 MONITOR_DEFAULT_START, MONITOR_OVLD_LOG_WRITES},
945
946 {"log_padded", "recovery",
947 "Bytes of log padded for log write ahead",
948 static_cast<monitor_type_t>(
949 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
950 MONITOR_DEFAULT_START, MONITOR_OVLD_LOG_PADDED},
951
952 /* ========== Counters for Page Compression ========== */
953 {"module_compress", "compression", "Page Compression Info",
954 MONITOR_MODULE,
955 MONITOR_DEFAULT_START, MONITOR_MODULE_PAGE},
956
957 {"compress_pages_compressed", "compression",
958 "Number of pages compressed", MONITOR_NONE,
959 MONITOR_DEFAULT_START, MONITOR_PAGE_COMPRESS},
960
961 {"compress_pages_decompressed", "compression",
962 "Number of pages decompressed",
963 MONITOR_NONE,
964 MONITOR_DEFAULT_START, MONITOR_PAGE_DECOMPRESS},
965
966 {"compression_pad_increments", "compression",
967 "Number of times padding is incremented to avoid compression failures",
968 MONITOR_NONE,
969 MONITOR_DEFAULT_START, MONITOR_PAD_INCREMENTS},
970
971 {"compression_pad_decrements", "compression",
972 "Number of times padding is decremented due to good compressibility",
973 MONITOR_NONE,
974 MONITOR_DEFAULT_START, MONITOR_PAD_DECREMENTS},
975
976 /* ========== Counters for Encryption ========== */
977 {"pages_encrypted", "encryption",
978 "Number of pages encrypted",
979 MONITOR_NONE,
980 MONITOR_DEFAULT_START, MONITOR_OVLD_PAGES_ENCRYPTED},
981
982 {"pages_decrypted", "encryption",
983 "Number of pages decrypted",
984 MONITOR_NONE,
985 MONITOR_DEFAULT_START, MONITOR_OVLD_PAGES_DECRYPTED},
986
987 /* ========== Counters for Index ========== */
988 {"module_index", "index", "Index Manager",
989 MONITOR_MODULE,
990 MONITOR_DEFAULT_START, MONITOR_MODULE_INDEX},
991
992 {"index_page_splits", "index", "Number of index page splits",
993 MONITOR_NONE,
994 MONITOR_DEFAULT_START, MONITOR_INDEX_SPLIT},
995
996 {"index_page_merge_attempts", "index",
997 "Number of index page merge attempts",
998 MONITOR_NONE,
999 MONITOR_DEFAULT_START, MONITOR_INDEX_MERGE_ATTEMPTS},
1000
1001 {"index_page_merge_successful", "index",
1002 "Number of successful index page merges",
1003 MONITOR_NONE,
1004 MONITOR_DEFAULT_START, MONITOR_INDEX_MERGE_SUCCESSFUL},
1005
1006 {"index_page_reorg_attempts", "index",
1007 "Number of index page reorganization attempts",
1008 MONITOR_NONE,
1009 MONITOR_DEFAULT_START, MONITOR_INDEX_REORG_ATTEMPTS},
1010
1011 {"index_page_reorg_successful", "index",
1012 "Number of successful index page reorganizations",
1013 MONITOR_NONE,
1014 MONITOR_DEFAULT_START, MONITOR_INDEX_REORG_SUCCESSFUL},
1015
1016 {"index_page_discards", "index", "Number of index pages discarded",
1017 MONITOR_NONE,
1018 MONITOR_DEFAULT_START, MONITOR_INDEX_DISCARD},
1019
1020 /* ========== Counters for Adaptive Hash Index ========== */
1021 {"module_adaptive_hash", "adaptive_hash_index", "Adpative Hash Index",
1022 MONITOR_MODULE,
1023 MONITOR_DEFAULT_START, MONITOR_MODULE_ADAPTIVE_HASH},
1024
1025 {"adaptive_hash_searches", "adaptive_hash_index",
1026 "Number of successful searches using Adaptive Hash Index",
1027 static_cast<monitor_type_t>(
1028 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
1029 MONITOR_DEFAULT_START, MONITOR_OVLD_ADAPTIVE_HASH_SEARCH},
1030
1031 {"adaptive_hash_searches_btree", "adaptive_hash_index",
1032 "Number of searches using B-tree on an index search",
1033 static_cast<monitor_type_t>(
1034 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
1035 MONITOR_DEFAULT_START, MONITOR_OVLD_ADAPTIVE_HASH_SEARCH_BTREE},
1036
1037 {"adaptive_hash_pages_added", "adaptive_hash_index",
1038 "Number of index pages on which the Adaptive Hash Index is built",
1039 MONITOR_NONE,
1040 MONITOR_DEFAULT_START, MONITOR_ADAPTIVE_HASH_PAGE_ADDED},
1041
1042 {"adaptive_hash_pages_removed", "adaptive_hash_index",
1043 "Number of index pages whose corresponding Adaptive Hash Index"
1044 " entries were removed",
1045 MONITOR_NONE,
1046 MONITOR_DEFAULT_START, MONITOR_ADAPTIVE_HASH_PAGE_REMOVED},
1047
1048 {"adaptive_hash_rows_added", "adaptive_hash_index",
1049 "Number of Adaptive Hash Index rows added",
1050 MONITOR_NONE,
1051 MONITOR_DEFAULT_START, MONITOR_ADAPTIVE_HASH_ROW_ADDED},
1052
1053 {"adaptive_hash_rows_removed", "adaptive_hash_index",
1054 "Number of Adaptive Hash Index rows removed",
1055 MONITOR_NONE,
1056 MONITOR_DEFAULT_START, MONITOR_ADAPTIVE_HASH_ROW_REMOVED},
1057
1058 {"adaptive_hash_rows_deleted_no_hash_entry", "adaptive_hash_index",
1059 "Number of rows deleted that did not have corresponding Adaptive Hash"
1060 " Index entries",
1061 MONITOR_NONE,
1062 MONITOR_DEFAULT_START, MONITOR_ADAPTIVE_HASH_ROW_REMOVE_NOT_FOUND},
1063
1064 {"adaptive_hash_rows_updated", "adaptive_hash_index",
1065 "Number of Adaptive Hash Index rows updated",
1066 MONITOR_NONE,
1067 MONITOR_DEFAULT_START, MONITOR_ADAPTIVE_HASH_ROW_UPDATED},
1068
1069 /* ========== Counters for tablespace ========== */
1070 {"module_file", "file_system", "Tablespace and File System Manager",
1071 MONITOR_MODULE,
1072 MONITOR_DEFAULT_START, MONITOR_MODULE_FIL_SYSTEM},
1073
1074 {"file_num_open_files", "file_system",
1075 "Number of files currently open (innodb_num_open_files)",
1076 static_cast<monitor_type_t>(
1077 MONITOR_EXISTING | MONITOR_DISPLAY_CURRENT | MONITOR_DEFAULT_ON),
1078 MONITOR_DEFAULT_START, MONITOR_OVLD_N_FILE_OPENED},
1079
1080 /* ========== Counters for Change Buffer ========== */
1081 {"module_ibuf_system", "change_buffer", "InnoDB Change Buffer",
1082 MONITOR_MODULE,
1083 MONITOR_DEFAULT_START, MONITOR_MODULE_IBUF_SYSTEM},
1084
1085 {"ibuf_merges_insert", "change_buffer",
1086 "Number of inserted records merged by change buffering",
1087 static_cast<monitor_type_t>(
1088 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
1089 MONITOR_DEFAULT_START, MONITOR_OVLD_IBUF_MERGE_INSERT},
1090
1091 {"ibuf_merges_delete_mark", "change_buffer",
1092 "Number of deleted records merged by change buffering",
1093 static_cast<monitor_type_t>(
1094 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
1095 MONITOR_DEFAULT_START, MONITOR_OVLD_IBUF_MERGE_DELETE},
1096
1097 {"ibuf_merges_delete", "change_buffer",
1098 "Number of purge records merged by change buffering",
1099 static_cast<monitor_type_t>(
1100 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
1101 MONITOR_DEFAULT_START, MONITOR_OVLD_IBUF_MERGE_PURGE},
1102
1103 {"ibuf_merges_discard_insert", "change_buffer",
1104 "Number of insert merged operations discarded",
1105 static_cast<monitor_type_t>(
1106 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
1107 MONITOR_DEFAULT_START, MONITOR_OVLD_IBUF_MERGE_DISCARD_INSERT},
1108
1109 {"ibuf_merges_discard_delete_mark", "change_buffer",
1110 "Number of deleted merged operations discarded",
1111 static_cast<monitor_type_t>(
1112 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
1113 MONITOR_DEFAULT_START, MONITOR_OVLD_IBUF_MERGE_DISCARD_DELETE},
1114
1115 {"ibuf_merges_discard_delete", "change_buffer",
1116 "Number of purge merged operations discarded",
1117 static_cast<monitor_type_t>(
1118 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
1119 MONITOR_DEFAULT_START, MONITOR_OVLD_IBUF_MERGE_DISCARD_PURGE},
1120
1121 {"ibuf_merges", "change_buffer", "Number of change buffer merges",
1122 static_cast<monitor_type_t>(
1123 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
1124 MONITOR_DEFAULT_START, MONITOR_OVLD_IBUF_MERGES},
1125
1126 {"ibuf_size", "change_buffer", "Change buffer size in pages",
1127 static_cast<monitor_type_t>(
1128 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
1129 MONITOR_DEFAULT_START, MONITOR_OVLD_IBUF_SIZE},
1130
1131 /* ========== Counters for server operations ========== */
1132 {"module_innodb", "innodb",
1133 "Counter for general InnoDB server wide operations and properties",
1134 MONITOR_MODULE,
1135 MONITOR_DEFAULT_START, MONITOR_MODULE_SERVER},
1136
1137 {"innodb_master_thread_sleeps", "server",
1138 "Number of times (seconds) master thread sleeps",
1139 MONITOR_NONE,
1140 MONITOR_DEFAULT_START, MONITOR_MASTER_THREAD_SLEEP},
1141
1142 {"innodb_activity_count", "server", "Current server activity count",
1143 static_cast<monitor_type_t>(
1144 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
1145 MONITOR_DEFAULT_START, MONITOR_OVLD_SERVER_ACTIVITY},
1146
1147 {"innodb_master_active_loops", "server",
1148 "Number of times master thread performs its tasks when"
1149 " server is active",
1150 MONITOR_NONE,
1151 MONITOR_DEFAULT_START, MONITOR_MASTER_ACTIVE_LOOPS},
1152
1153 {"innodb_master_idle_loops", "server",
1154 "Number of times master thread performs its tasks when server is idle",
1155 MONITOR_NONE,
1156 MONITOR_DEFAULT_START, MONITOR_MASTER_IDLE_LOOPS},
1157
1158 {"innodb_background_drop_table_usec", "server",
1159 "Time (in microseconds) spent to process drop table list",
1160 MONITOR_NONE,
1161 MONITOR_DEFAULT_START, MONITOR_SRV_BACKGROUND_DROP_TABLE_MICROSECOND},
1162
1163 {"innodb_ibuf_merge_usec", "server",
1164 "Time (in microseconds) spent to process change buffer merge",
1165 MONITOR_NONE,
1166 MONITOR_DEFAULT_START, MONITOR_SRV_IBUF_MERGE_MICROSECOND},
1167
1168 {"innodb_log_flush_usec", "server",
1169 "Time (in microseconds) spent to flush log records",
1170 MONITOR_NONE,
1171 MONITOR_DEFAULT_START, MONITOR_SRV_LOG_FLUSH_MICROSECOND},
1172
1173 {"innodb_mem_validate_usec", "server",
1174 "Time (in microseconds) spent to do memory validation",
1175 MONITOR_NONE,
1176 MONITOR_DEFAULT_START, MONITOR_SRV_MEM_VALIDATE_MICROSECOND},
1177
1178 {"innodb_master_purge_usec", "server",
1179 "Time (in microseconds) spent by master thread to purge records",
1180 MONITOR_NONE,
1181 MONITOR_DEFAULT_START, MONITOR_SRV_PURGE_MICROSECOND},
1182
1183 {"innodb_dict_lru_usec", "server",
1184 "Time (in microseconds) spent to process DICT LRU list",
1185 MONITOR_NONE,
1186 MONITOR_DEFAULT_START, MONITOR_SRV_DICT_LRU_MICROSECOND},
1187
1188 {"innodb_dict_lru_count", "server",
1189 "Number of tables evicted from DICT LRU list",
1190 MONITOR_NONE,
1191 MONITOR_DEFAULT_START, MONITOR_SRV_DICT_LRU_EVICT_COUNT},
1192
1193 {"innodb_checkpoint_usec", "server",
1194 "Time (in microseconds) spent by master thread to do checkpoint",
1195 MONITOR_NONE,
1196 MONITOR_DEFAULT_START, MONITOR_SRV_CHECKPOINT_MICROSECOND},
1197
1198 {"innodb_dblwr_writes", "server",
1199 "Number of doublewrite operations that have been performed"
1200 " (innodb_dblwr_writes)",
1201 static_cast<monitor_type_t>(
1202 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
1203 MONITOR_DEFAULT_START, MONITOR_OVLD_SRV_DBLWR_WRITES},
1204
1205 {"innodb_dblwr_pages_written", "server",
1206 "Number of pages that have been written for doublewrite operations"
1207 " (innodb_dblwr_pages_written)",
1208 static_cast<monitor_type_t>(
1209 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
1210 MONITOR_DEFAULT_START, MONITOR_OVLD_SRV_DBLWR_PAGES_WRITTEN},
1211
1212 {"innodb_page_size", "server",
1213 "InnoDB page size in bytes (innodb_page_size)",
1214 static_cast<monitor_type_t>(
1215 MONITOR_EXISTING | MONITOR_DEFAULT_ON | MONITOR_DISPLAY_CURRENT),
1216 MONITOR_DEFAULT_START, MONITOR_OVLD_SRV_PAGE_SIZE},
1217
1218 {"innodb_rwlock_s_spin_waits", "server",
1219 "Number of rwlock spin waits due to shared latch request",
1220 static_cast<monitor_type_t>(
1221 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
1222 MONITOR_DEFAULT_START, MONITOR_OVLD_RWLOCK_S_SPIN_WAITS},
1223
1224 {"innodb_rwlock_x_spin_waits", "server",
1225 "Number of rwlock spin waits due to exclusive latch request",
1226 static_cast<monitor_type_t>(
1227 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
1228 MONITOR_DEFAULT_START, MONITOR_OVLD_RWLOCK_X_SPIN_WAITS},
1229
1230 {"innodb_rwlock_sx_spin_waits", "server",
1231 "Number of rwlock spin waits due to sx latch request",
1232 static_cast<monitor_type_t>(
1233 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
1234 MONITOR_DEFAULT_START, MONITOR_OVLD_RWLOCK_SX_SPIN_WAITS},
1235
1236 {"innodb_rwlock_s_spin_rounds", "server",
1237 "Number of rwlock spin loop rounds due to shared latch request",
1238 static_cast<monitor_type_t>(
1239 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
1240 MONITOR_DEFAULT_START, MONITOR_OVLD_RWLOCK_S_SPIN_ROUNDS},
1241
1242 {"innodb_rwlock_x_spin_rounds", "server",
1243 "Number of rwlock spin loop rounds due to exclusive latch request",
1244 static_cast<monitor_type_t>(
1245 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
1246 MONITOR_DEFAULT_START, MONITOR_OVLD_RWLOCK_X_SPIN_ROUNDS},
1247
1248 {"innodb_rwlock_sx_spin_rounds", "server",
1249 "Number of rwlock spin loop rounds due to sx latch request",
1250 static_cast<monitor_type_t>(
1251 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
1252 MONITOR_DEFAULT_START, MONITOR_OVLD_RWLOCK_SX_SPIN_ROUNDS},
1253
1254 {"innodb_rwlock_s_os_waits", "server",
1255 "Number of OS waits due to shared latch request",
1256 static_cast<monitor_type_t>(
1257 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
1258 MONITOR_DEFAULT_START, MONITOR_OVLD_RWLOCK_S_OS_WAITS},
1259
1260 {"innodb_rwlock_x_os_waits", "server",
1261 "Number of OS waits due to exclusive latch request",
1262 static_cast<monitor_type_t>(
1263 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
1264 MONITOR_DEFAULT_START, MONITOR_OVLD_RWLOCK_X_OS_WAITS},
1265
1266 {"innodb_rwlock_sx_os_waits", "server",
1267 "Number of OS waits due to sx latch request",
1268 static_cast<monitor_type_t>(
1269 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
1270 MONITOR_DEFAULT_START, MONITOR_OVLD_RWLOCK_SX_OS_WAITS},
1271
1272 /* ========== Counters for DML operations ========== */
1273 {"module_dml", "dml", "Statistics for DMLs",
1274 MONITOR_MODULE,
1275 MONITOR_DEFAULT_START, MONITOR_MODULE_DML_STATS},
1276
1277 {"dml_reads", "dml", "Number of rows read",
1278 static_cast<monitor_type_t>(MONITOR_EXISTING),
1279 MONITOR_DEFAULT_START, MONITOR_OLVD_ROW_READ},
1280
1281 {"dml_inserts", "dml", "Number of rows inserted",
1282 static_cast<monitor_type_t>(
1283 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
1284 MONITOR_DEFAULT_START, MONITOR_OLVD_ROW_INSERTED},
1285
1286 {"dml_deletes", "dml", "Number of rows deleted",
1287 static_cast<monitor_type_t>(
1288 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
1289 MONITOR_DEFAULT_START, MONITOR_OLVD_ROW_DELETED},
1290
1291 {"dml_updates", "dml", "Number of rows updated",
1292 static_cast<monitor_type_t>(
1293 MONITOR_EXISTING | MONITOR_DEFAULT_ON),
1294 MONITOR_DEFAULT_START, MONITOR_OLVD_ROW_UPDTATED},
1295
1296 /* ========== Counters for DDL operations ========== */
1297 {"module_ddl", "ddl", "Statistics for DDLs",
1298 MONITOR_MODULE,
1299 MONITOR_DEFAULT_START, MONITOR_MODULE_DDL_STATS},
1300
1301 {"ddl_background_drop_indexes", "ddl",
1302 "Number of indexes waiting to be dropped after failed index creation",
1303 MONITOR_NONE,
1304 MONITOR_DEFAULT_START, MONITOR_BACKGROUND_DROP_INDEX},
1305
1306 {"ddl_background_drop_tables", "ddl",
1307 "Number of tables in background drop table list",
1308 MONITOR_NONE,
1309 MONITOR_DEFAULT_START, MONITOR_BACKGROUND_DROP_TABLE},
1310
1311 {"ddl_online_create_index", "ddl",
1312 "Number of indexes being created online",
1313 MONITOR_NONE,
1314 MONITOR_DEFAULT_START, MONITOR_ONLINE_CREATE_INDEX},
1315
1316 {"ddl_pending_alter_table", "ddl",
1317 "Number of ALTER TABLE, CREATE INDEX, DROP INDEX in progress",
1318 MONITOR_NONE,
1319 MONITOR_DEFAULT_START, MONITOR_PENDING_ALTER_TABLE},
1320
1321 {"ddl_sort_file_alter_table", "ddl",
1322 "Number of sort files created during alter table",
1323 MONITOR_NONE,
1324 MONITOR_DEFAULT_START, MONITOR_ALTER_TABLE_SORT_FILES},
1325
1326 {"ddl_log_file_alter_table", "ddl",
1327 "Number of log files created during alter table",
1328 MONITOR_NONE,
1329 MONITOR_DEFAULT_START, MONITOR_ALTER_TABLE_LOG_FILES},
1330
1331 /* ===== Counters for ICP (Index Condition Pushdown) Module ===== */
1332 {"module_icp", "icp", "Index Condition Pushdown",
1333 MONITOR_MODULE,
1334 MONITOR_DEFAULT_START, MONITOR_MODULE_ICP},
1335
1336 {"icp_attempts", "icp",
1337 "Number of attempts for index push-down condition checks",
1338 MONITOR_NONE,
1339 MONITOR_DEFAULT_START, MONITOR_ICP_ATTEMPTS},
1340
1341 {"icp_no_match", "icp", "Index push-down condition does not match",
1342 MONITOR_NONE,
1343 MONITOR_DEFAULT_START, MONITOR_ICP_NO_MATCH},
1344
1345 {"icp_out_of_range", "icp", "Index push-down condition out of range",
1346 MONITOR_NONE,
1347 MONITOR_DEFAULT_START, MONITOR_ICP_OUT_OF_RANGE},
1348
1349 {"icp_match", "icp", "Index push-down condition matches",
1350 MONITOR_NONE,
1351 MONITOR_DEFAULT_START, MONITOR_ICP_MATCH},
1352
1353 /* ========== Mutex monitoring on/off ========== */
1354 {"latch_status", "Latch counters",
1355 "Collect latch counters to display via SHOW ENGING INNODB MUTEX",
1356 MONITOR_MODULE,
1357 MONITOR_DEFAULT_START, MONITOR_MODULE_LATCHES},
1358
1359 {"latch", "sync", "Latch monitoring control",
1360 MONITOR_HIDDEN,
1361 MONITOR_DEFAULT_START, MONITOR_LATCHES},
1362
1363 /* ========== To turn on/off reset all counters ========== */
1364 {"all", "All Counters", "Turn on/off and reset all counters",
1365 MONITOR_MODULE,
1366 MONITOR_DEFAULT_START, MONITOR_ALL_COUNTER}
1367 };
1368
1369 /* The "innodb_counter_value" array stores actual counter values */
1370 monitor_value_t innodb_counter_value[NUM_MONITOR];
1371
1372 /* monitor_set_tbl is used to record and determine whether a monitor
1373 has been turned on/off. */
1374 ulint monitor_set_tbl[(NUM_MONITOR + NUM_BITS_ULINT
1375 - 1) / NUM_BITS_ULINT];
1376
1377 /****************************************************************//**
1378 Get a monitor's "monitor_info" by its monitor id (index into the
1379 innodb_counter_info array.
1380 @return Point to corresponding monitor_info_t, or NULL if no such
1381 monitor */
1382 monitor_info_t*
srv_mon_get_info(monitor_id_t monitor_id)1383 srv_mon_get_info(
1384 /*=============*/
1385 monitor_id_t monitor_id) /*!< id indexing into the
1386 innodb_counter_info array */
1387 {
1388 ut_a(monitor_id < NUM_MONITOR);
1389
1390 return((monitor_id < NUM_MONITOR)
1391 ? &innodb_counter_info[monitor_id]
1392 : NULL);
1393 }
1394
1395 /****************************************************************//**
1396 Get monitor's name by its monitor id (indexing into the
1397 innodb_counter_info array.
1398 @return corresponding monitor name, or NULL if no such
1399 monitor */
1400 const char*
srv_mon_get_name(monitor_id_t monitor_id)1401 srv_mon_get_name(
1402 /*=============*/
1403 monitor_id_t monitor_id) /*!< id index into the
1404 innodb_counter_info array */
1405 {
1406 ut_a(monitor_id < NUM_MONITOR);
1407
1408 return((monitor_id < NUM_MONITOR)
1409 ? innodb_counter_info[monitor_id].monitor_name
1410 : NULL);
1411 }
1412
1413 /****************************************************************//**
1414 Turn on/off, reset monitor counters in a module. If module_id
1415 is MONITOR_ALL_COUNTER then turn on all monitor counters.
1416 turned on because it has already been turned on. */
1417 void
srv_mon_set_module_control(monitor_id_t module_id,mon_option_t set_option)1418 srv_mon_set_module_control(
1419 /*=======================*/
1420 monitor_id_t module_id, /*!< in: Module ID as in
1421 monitor_counter_id. If it is
1422 set to MONITOR_ALL_COUNTER, this means
1423 we shall turn on all the counters */
1424 mon_option_t set_option) /*!< in: Turn on/off reset the
1425 counter */
1426 {
1427 ulint ix;
1428 ulint start_id;
1429 ibool set_current_module = FALSE;
1430
1431 ut_a(module_id <= NUM_MONITOR);
1432 ut_a(UT_ARR_SIZE(innodb_counter_info) == NUM_MONITOR);
1433
1434 /* The module_id must be an ID of MONITOR_MODULE type */
1435 ut_a(innodb_counter_info[module_id].monitor_type & MONITOR_MODULE);
1436
1437 /* start with the first monitor in the module. If module_id
1438 is MONITOR_ALL_COUNTER, this means we need to turn on all
1439 monitor counters. */
1440 if (module_id == MONITOR_ALL_COUNTER) {
1441 start_id = 1;
1442 } else if (innodb_counter_info[module_id].monitor_type
1443 & MONITOR_GROUP_MODULE) {
1444 /* Counters in this module are set as a group together
1445 and cannot be turned on/off individually. Need to set
1446 the on/off bit in the module counter */
1447 start_id = module_id;
1448 set_current_module = TRUE;
1449
1450 } else {
1451 start_id = module_id + 1;
1452 }
1453
1454 for (ix = start_id; ix < NUM_MONITOR; ix++) {
1455 /* if we hit the next module counter, we will
1456 continue if we want to turn on all monitor counters,
1457 and break if just turn on the counters in the
1458 current module. */
1459 if (innodb_counter_info[ix].monitor_type & MONITOR_MODULE) {
1460
1461 if (set_current_module) {
1462 /* Continue to set on/off bit on current
1463 module */
1464 set_current_module = FALSE;
1465 } else if (module_id == MONITOR_ALL_COUNTER) {
1466 if (!(innodb_counter_info[ix].monitor_type
1467 & MONITOR_GROUP_MODULE)) {
1468 continue;
1469 }
1470 } else {
1471 /* Hitting the next module, stop */
1472 break;
1473 }
1474 }
1475
1476 /* Cannot turn on a monitor already been turned on. User
1477 should be aware some counters are already on before
1478 turn them on again (which could reset counter value) */
1479 if (MONITOR_IS_ON(ix) && (set_option == MONITOR_TURN_ON)) {
1480 ib::info() << "Monitor '"
1481 << srv_mon_get_name((monitor_id_t) ix)
1482 << "' is already enabled.";
1483 continue;
1484 }
1485
1486 /* For some existing counters (server status variables),
1487 we will get its counter value at the start/stop time
1488 to calculate the actual value during the time. */
1489 if (innodb_counter_info[ix].monitor_type & MONITOR_EXISTING) {
1490 srv_mon_process_existing_counter(
1491 static_cast<monitor_id_t>(ix), set_option);
1492 }
1493
1494 /* Currently support 4 operations on the monitor counters:
1495 turn on, turn off, reset and reset all operations. */
1496 switch (set_option) {
1497 case MONITOR_TURN_ON:
1498 MONITOR_ON(ix);
1499 MONITOR_INIT(ix);
1500 MONITOR_SET_START(ix);
1501 break;
1502
1503 case MONITOR_TURN_OFF:
1504 MONITOR_OFF(ix);
1505 MONITOR_SET_OFF(ix);
1506 break;
1507
1508 case MONITOR_RESET_VALUE:
1509 srv_mon_reset(static_cast<monitor_id_t>(ix));
1510 break;
1511
1512 case MONITOR_RESET_ALL_VALUE:
1513 srv_mon_reset_all(static_cast<monitor_id_t>(ix));
1514 break;
1515
1516 default:
1517 ut_error;
1518 }
1519 }
1520 }
1521
1522 /****************************************************************//**
1523 Get transaction system's rollback segment size in pages
1524 @return size in pages */
1525 static
1526 ulint
srv_mon_get_rseg_size(void)1527 srv_mon_get_rseg_size(void)
1528 /*=======================*/
1529 {
1530 ulint i;
1531 ulint value = 0;
1532
1533 /* rseg_array is a static array, so we can go through it without
1534 mutex protection. In addition, we provide an estimate of the
1535 total rollback segment size and to avoid mutex contention we
1536 don't acquire the rseg->mutex" */
1537 for (i = 0; i < TRX_SYS_N_RSEGS; ++i) {
1538 const trx_rseg_t* rseg = trx_sys->rseg_array[i];
1539
1540 if (rseg != NULL) {
1541 value += rseg->curr_size;
1542 }
1543 }
1544
1545 return(value);
1546 }
1547
1548 /****************************************************************//**
1549 This function consolidates some existing server counters used
1550 by "system status variables". These existing system variables do not have
1551 mechanism to start/stop and reset the counters, so we simulate these
1552 controls by remembering the corresponding counter values when the
1553 corresponding monitors are turned on/off/reset, and do appropriate
1554 mathematics to deduct the actual value. Please also refer to
1555 srv_export_innodb_status() for related global counters used by
1556 the existing status variables.*/
1557 void
srv_mon_process_existing_counter(monitor_id_t monitor_id,mon_option_t set_option)1558 srv_mon_process_existing_counter(
1559 /*=============================*/
1560 monitor_id_t monitor_id, /*!< in: the monitor's ID as in
1561 monitor_counter_id */
1562 mon_option_t set_option) /*!< in: Turn on/off reset the
1563 counter */
1564 {
1565 mon_type_t value;
1566 monitor_info_t* monitor_info;
1567 ibool update_min = FALSE;
1568 buf_pool_stat_t stat;
1569 buf_pools_list_size_t buf_pools_list_size;
1570 ulint LRU_len;
1571 ulint free_len;
1572 ulint flush_list_len;
1573
1574 monitor_info = srv_mon_get_info(monitor_id);
1575
1576 ut_a(monitor_info->monitor_type & MONITOR_EXISTING);
1577 ut_a(monitor_id < NUM_MONITOR);
1578
1579 /* Get the value from corresponding global variable */
1580 switch (monitor_id) {
1581 /* export_vars.innodb_buffer_pool_reads. Num Reads from
1582 disk (page not in buffer) */
1583 case MONITOR_OVLD_BUF_POOL_READS:
1584 value = srv_stats.buf_pool_reads;
1585 break;
1586
1587 /* innodb_buffer_pool_read_requests, the number of logical
1588 read requests */
1589 case MONITOR_OVLD_BUF_POOL_READ_REQUESTS:
1590 buf_get_total_stat(&stat);
1591 value = stat.n_page_gets;
1592 break;
1593
1594 /* innodb_buffer_pool_write_requests, the number of
1595 write request */
1596 case MONITOR_OVLD_BUF_POOL_WRITE_REQUEST:
1597 value = srv_stats.buf_pool_write_requests;
1598 break;
1599
1600 /* innodb_buffer_pool_wait_free */
1601 case MONITOR_OVLD_BUF_POOL_WAIT_FREE:
1602 value = srv_stats.buf_pool_wait_free;
1603 break;
1604
1605 /* innodb_buffer_pool_read_ahead */
1606 case MONITOR_OVLD_BUF_POOL_READ_AHEAD:
1607 buf_get_total_stat(&stat);
1608 value = stat.n_ra_pages_read;
1609 break;
1610
1611 /* innodb_buffer_pool_read_ahead_evicted */
1612 case MONITOR_OVLD_BUF_POOL_READ_AHEAD_EVICTED:
1613 buf_get_total_stat(&stat);
1614 value = stat.n_ra_pages_evicted;
1615 break;
1616
1617 /* innodb_buffer_pool_pages_total */
1618 case MONITOR_OVLD_BUF_POOL_PAGE_TOTAL:
1619 value = buf_pool_get_n_pages();
1620 break;
1621
1622 /* innodb_buffer_pool_pages_misc */
1623 case MONITOR_OVLD_BUF_POOL_PAGE_MISC:
1624 buf_get_total_list_len(&LRU_len, &free_len, &flush_list_len);
1625 value = buf_pool_get_n_pages() - LRU_len - free_len;
1626 break;
1627
1628 /* innodb_buffer_pool_pages_data */
1629 case MONITOR_OVLD_BUF_POOL_PAGES_DATA:
1630 buf_get_total_list_len(&LRU_len, &free_len, &flush_list_len);
1631 value = LRU_len;
1632 break;
1633
1634 /* innodb_buffer_pool_bytes_data */
1635 case MONITOR_OVLD_BUF_POOL_BYTES_DATA:
1636 buf_get_total_list_size_in_bytes(&buf_pools_list_size);
1637 value = buf_pools_list_size.LRU_bytes
1638 + buf_pools_list_size.unzip_LRU_bytes;
1639 break;
1640
1641 /* innodb_buffer_pool_pages_dirty */
1642 case MONITOR_OVLD_BUF_POOL_PAGES_DIRTY:
1643 buf_get_total_list_len(&LRU_len, &free_len, &flush_list_len);
1644 value = flush_list_len;
1645 break;
1646
1647 /* innodb_buffer_pool_bytes_dirty */
1648 case MONITOR_OVLD_BUF_POOL_BYTES_DIRTY:
1649 buf_get_total_list_size_in_bytes(&buf_pools_list_size);
1650 value = buf_pools_list_size.flush_list_bytes;
1651 break;
1652
1653 /* innodb_buffer_pool_pages_free */
1654 case MONITOR_OVLD_BUF_POOL_PAGES_FREE:
1655 buf_get_total_list_len(&LRU_len, &free_len, &flush_list_len);
1656 value = free_len;
1657 break;
1658
1659 /* innodb_pages_created, the number of pages created */
1660 case MONITOR_OVLD_PAGE_CREATED:
1661 buf_get_total_stat(&stat);
1662 value = stat.n_pages_created;
1663 break;
1664
1665 /* innodb_pages_written, the number of page written */
1666 case MONITOR_OVLD_PAGES_WRITTEN:
1667 buf_get_total_stat(&stat);
1668 value = stat.n_pages_written;
1669 break;
1670
1671 /* innodb_pages_read */
1672 case MONITOR_OVLD_PAGES_READ:
1673 buf_get_total_stat(&stat);
1674 value = stat.n_pages_read;
1675 break;
1676
1677 /* innodb_pages0_read */
1678 case MONITOR_OVLD_PAGES0_READ:
1679 value = srv_stats.page0_read;
1680 break;
1681
1682 /* innodb_data_reads, the total number of data reads */
1683 case MONITOR_OVLD_BYTE_READ:
1684 value = srv_stats.data_read;
1685 break;
1686
1687 /* innodb_data_writes, the total number of data writes. */
1688 case MONITOR_OVLD_BYTE_WRITTEN:
1689 value = srv_stats.data_written;
1690 break;
1691
1692 /* innodb_data_reads, the total number of data reads. */
1693 case MONITOR_OVLD_OS_FILE_READ:
1694 value = os_n_file_reads;
1695 break;
1696
1697 /* innodb_data_writes, the total number of data writes*/
1698 case MONITOR_OVLD_OS_FILE_WRITE:
1699 value = os_n_file_writes;
1700 break;
1701
1702 /* innodb_data_fsyncs, number of fsync() operations so far. */
1703 case MONITOR_OVLD_OS_FSYNC:
1704 value = os_n_fsyncs;
1705 break;
1706
1707 /* innodb_os_log_written */
1708 case MONITOR_OVLD_OS_LOG_WRITTEN:
1709 value = (mon_type_t) srv_stats.os_log_written;
1710 break;
1711
1712 /* innodb_os_log_fsyncs */
1713 case MONITOR_OVLD_OS_LOG_FSYNC:
1714 value = fil_n_log_flushes;
1715 break;
1716
1717 /* innodb_os_log_pending_fsyncs */
1718 case MONITOR_OVLD_OS_LOG_PENDING_FSYNC:
1719 value = fil_n_pending_log_flushes;
1720 update_min = TRUE;
1721 break;
1722
1723 /* innodb_os_log_pending_writes */
1724 case MONITOR_OVLD_OS_LOG_PENDING_WRITES:
1725 value = srv_stats.os_log_pending_writes;
1726 update_min = TRUE;
1727 break;
1728
1729 /* innodb_log_waits */
1730 case MONITOR_OVLD_LOG_WAITS:
1731 value = srv_stats.log_waits;
1732 break;
1733
1734 /* innodb_log_write_requests */
1735 case MONITOR_OVLD_LOG_WRITE_REQUEST:
1736 value = srv_stats.log_write_requests;
1737 break;
1738
1739 /* innodb_log_writes */
1740 case MONITOR_OVLD_LOG_WRITES:
1741 value = srv_stats.log_writes;
1742 break;
1743
1744 case MONITOR_OVLD_LOG_PADDED:
1745 value = srv_stats.log_padded;
1746 break;
1747
1748 case MONITOR_OVLD_PAGES_ENCRYPTED:
1749 value = srv_stats.pages_encrypted;
1750 break;
1751 case MONITOR_OVLD_PAGES_DECRYPTED:
1752 value = srv_stats.pages_decrypted;
1753 break;
1754
1755 /* innodb_dblwr_writes */
1756 case MONITOR_OVLD_SRV_DBLWR_WRITES:
1757 value = srv_stats.dblwr_writes;
1758 break;
1759
1760 /* innodb_dblwr_pages_written */
1761 case MONITOR_OVLD_SRV_DBLWR_PAGES_WRITTEN:
1762 value = srv_stats.dblwr_pages_written;
1763 break;
1764
1765 /* innodb_page_size */
1766 case MONITOR_OVLD_SRV_PAGE_SIZE:
1767 value = UNIV_PAGE_SIZE;
1768 break;
1769
1770 case MONITOR_OVLD_RWLOCK_S_SPIN_WAITS:
1771 value = rw_lock_stats.rw_s_spin_wait_count;
1772 break;
1773
1774 case MONITOR_OVLD_RWLOCK_X_SPIN_WAITS:
1775 value = rw_lock_stats.rw_x_spin_wait_count;
1776 break;
1777
1778 case MONITOR_OVLD_RWLOCK_SX_SPIN_WAITS:
1779 value = rw_lock_stats.rw_sx_spin_wait_count;
1780 break;
1781
1782 case MONITOR_OVLD_RWLOCK_S_SPIN_ROUNDS:
1783 value = rw_lock_stats.rw_s_spin_round_count;
1784 break;
1785
1786 case MONITOR_OVLD_RWLOCK_X_SPIN_ROUNDS:
1787 value = rw_lock_stats.rw_x_spin_round_count;
1788 break;
1789
1790 case MONITOR_OVLD_RWLOCK_SX_SPIN_ROUNDS:
1791 value = rw_lock_stats.rw_sx_spin_round_count;
1792 break;
1793
1794 case MONITOR_OVLD_RWLOCK_S_OS_WAITS:
1795 value = rw_lock_stats.rw_s_os_wait_count;
1796 break;
1797
1798 case MONITOR_OVLD_RWLOCK_X_OS_WAITS:
1799 value = rw_lock_stats.rw_x_os_wait_count;
1800 break;
1801
1802 case MONITOR_OVLD_RWLOCK_SX_OS_WAITS:
1803 value = rw_lock_stats.rw_sx_os_wait_count;
1804 break;
1805
1806 case MONITOR_OVLD_BUFFER_POOL_SIZE:
1807 value = srv_buf_pool_size;
1808 break;
1809
1810 /* innodb_rows_read */
1811 case MONITOR_OLVD_ROW_READ:
1812 value = srv_stats.n_rows_read;
1813 break;
1814
1815 /* innodb_rows_inserted */
1816 case MONITOR_OLVD_ROW_INSERTED:
1817 value = srv_stats.n_rows_inserted;
1818 break;
1819
1820 /* innodb_rows_deleted */
1821 case MONITOR_OLVD_ROW_DELETED:
1822 value = srv_stats.n_rows_deleted;
1823 break;
1824
1825 /* innodb_rows_updated */
1826 case MONITOR_OLVD_ROW_UPDTATED:
1827 value = srv_stats.n_rows_updated;
1828 break;
1829
1830 /* innodb_row_lock_current_waits */
1831 case MONITOR_OVLD_ROW_LOCK_CURRENT_WAIT:
1832 value = srv_stats.n_lock_wait_current_count;
1833 break;
1834
1835 /* innodb_row_lock_time */
1836 case MONITOR_OVLD_LOCK_WAIT_TIME:
1837 value = srv_stats.n_lock_wait_time / 1000;
1838 break;
1839
1840 /* innodb_row_lock_time_max */
1841 case MONITOR_OVLD_LOCK_MAX_WAIT_TIME:
1842 value = lock_sys->n_lock_max_wait_time / 1000;
1843 break;
1844
1845 /* innodb_row_lock_time_avg */
1846 case MONITOR_OVLD_LOCK_AVG_WAIT_TIME:
1847 if (srv_stats.n_lock_wait_count > 0) {
1848 value = srv_stats.n_lock_wait_time / 1000
1849 / srv_stats.n_lock_wait_count;
1850 } else {
1851 value = 0;
1852 }
1853 break;
1854
1855 /* innodb_row_lock_waits */
1856 case MONITOR_OVLD_ROW_LOCK_WAIT:
1857 value = srv_stats.n_lock_wait_count;
1858 break;
1859
1860 case MONITOR_RSEG_HISTORY_LEN:
1861 value = trx_sys->rseg_history_len;
1862 break;
1863
1864 case MONITOR_RSEG_CUR_SIZE:
1865 value = srv_mon_get_rseg_size();
1866 break;
1867
1868 case MONITOR_OVLD_N_FILE_OPENED:
1869 value = fil_n_file_opened;
1870 break;
1871
1872 case MONITOR_OVLD_IBUF_MERGE_INSERT:
1873 value = ibuf->n_merged_ops[IBUF_OP_INSERT];
1874 break;
1875
1876 case MONITOR_OVLD_IBUF_MERGE_DELETE:
1877 value = ibuf->n_merged_ops[IBUF_OP_DELETE_MARK];
1878 break;
1879
1880 case MONITOR_OVLD_IBUF_MERGE_PURGE:
1881 value = ibuf->n_merged_ops[IBUF_OP_DELETE];
1882 break;
1883
1884 case MONITOR_OVLD_IBUF_MERGE_DISCARD_INSERT:
1885 value = ibuf->n_discarded_ops[IBUF_OP_INSERT];
1886 break;
1887
1888 case MONITOR_OVLD_IBUF_MERGE_DISCARD_DELETE:
1889 value = ibuf->n_discarded_ops[IBUF_OP_DELETE_MARK];
1890 break;
1891
1892 case MONITOR_OVLD_IBUF_MERGE_DISCARD_PURGE:
1893 value = ibuf->n_discarded_ops[IBUF_OP_DELETE];
1894 break;
1895
1896 case MONITOR_OVLD_IBUF_MERGES:
1897 value = ibuf->n_merges;
1898 break;
1899
1900 case MONITOR_OVLD_IBUF_SIZE:
1901 value = ibuf->size;
1902 break;
1903
1904 case MONITOR_OVLD_SERVER_ACTIVITY:
1905 value = srv_get_activity_count();
1906 break;
1907
1908 case MONITOR_OVLD_LSN_FLUSHDISK:
1909 value = (mon_type_t) log_sys->flushed_to_disk_lsn;
1910 break;
1911
1912 case MONITOR_OVLD_LSN_CURRENT:
1913 value = (mon_type_t) log_sys->lsn;
1914 break;
1915
1916 case MONITOR_OVLD_BUF_OLDEST_LSN:
1917 value = (mon_type_t) buf_pool_get_oldest_modification();
1918 break;
1919
1920 case MONITOR_OVLD_LSN_CHECKPOINT:
1921 value = (mon_type_t) log_sys->last_checkpoint_lsn;
1922 break;
1923
1924 case MONITOR_OVLD_MAX_AGE_ASYNC:
1925 value = log_sys->max_modified_age_async;
1926 break;
1927
1928 case MONITOR_OVLD_MAX_AGE_SYNC:
1929 value = log_sys->max_modified_age_sync;
1930 break;
1931
1932 case MONITOR_OVLD_ADAPTIVE_HASH_SEARCH:
1933 value = btr_cur_n_sea;
1934 break;
1935
1936 case MONITOR_OVLD_ADAPTIVE_HASH_SEARCH_BTREE:
1937 value = btr_cur_n_non_sea;
1938 break;
1939
1940 default:
1941 ut_error;
1942 }
1943
1944 switch (set_option) {
1945 case MONITOR_TURN_ON:
1946 /* Save the initial counter value in mon_start_value
1947 field */
1948 MONITOR_SAVE_START(monitor_id, value);
1949 return;
1950
1951 case MONITOR_TURN_OFF:
1952 /* Save the counter value to mon_last_value when we
1953 turn off the monitor but not yet reset. Note the
1954 counter has not yet been set to off in the bitmap
1955 table for normal turn off. We need to check the
1956 count status (on/off) to avoid reset the value
1957 for an already off conte */
1958 if (MONITOR_IS_ON(monitor_id)) {
1959 srv_mon_process_existing_counter(monitor_id,
1960 MONITOR_GET_VALUE);
1961 MONITOR_SAVE_LAST(monitor_id);
1962 }
1963 return;
1964
1965 case MONITOR_GET_VALUE:
1966 if (MONITOR_IS_ON(monitor_id)) {
1967
1968 /* If MONITOR_DISPLAY_CURRENT bit is on, we
1969 only record the current value, rather than
1970 incremental value over a period. Most of
1971 ` this type of counters are resource related
1972 counters such as number of buffer pages etc. */
1973 if (monitor_info->monitor_type
1974 & MONITOR_DISPLAY_CURRENT) {
1975 MONITOR_SET(monitor_id, value);
1976 } else {
1977 /* Most status counters are monotonically
1978 increasing, no need to update their
1979 minimum values. Only do so
1980 if "update_min" set to TRUE */
1981 MONITOR_SET_DIFF(monitor_id, value);
1982
1983 if (update_min
1984 && (MONITOR_VALUE(monitor_id)
1985 < MONITOR_MIN_VALUE(monitor_id))) {
1986 MONITOR_MIN_VALUE(monitor_id) =
1987 MONITOR_VALUE(monitor_id);
1988 }
1989 }
1990 }
1991 return;
1992
1993 case MONITOR_RESET_VALUE:
1994 if (!MONITOR_IS_ON(monitor_id)) {
1995 MONITOR_LAST_VALUE(monitor_id) = 0;
1996 }
1997 return;
1998
1999 /* Nothing special for reset all operation for these existing
2000 counters */
2001 case MONITOR_RESET_ALL_VALUE:
2002 return;
2003 }
2004 }
2005
2006 /*************************************************************//**
2007 Reset a monitor, create a new base line with the current monitor
2008 value. This baseline is recorded by MONITOR_VALUE_RESET(monitor) */
2009 void
srv_mon_reset(monitor_id_t monitor)2010 srv_mon_reset(
2011 /*==========*/
2012 monitor_id_t monitor) /*!< in: monitor id */
2013 {
2014 ibool monitor_was_on;
2015
2016 monitor_was_on = MONITOR_IS_ON(monitor);
2017
2018 if (monitor_was_on) {
2019 /* Temporarily turn off the counter for the resetting
2020 operation */
2021 MONITOR_OFF(monitor);
2022 }
2023
2024 /* Before resetting the current monitor value, first
2025 calculate and set the max/min value since monitor
2026 start */
2027 srv_mon_calc_max_since_start(monitor);
2028 srv_mon_calc_min_since_start(monitor);
2029
2030 /* Monitors with MONITOR_DISPLAY_CURRENT bit
2031 are not incremental, no need to remember
2032 the reset value. */
2033 if (innodb_counter_info[monitor].monitor_type
2034 & MONITOR_DISPLAY_CURRENT) {
2035 MONITOR_VALUE_RESET(monitor) = 0;
2036 } else {
2037 /* Remember the new baseline */
2038 MONITOR_VALUE_RESET(monitor) = MONITOR_VALUE_RESET(monitor)
2039 + MONITOR_VALUE(monitor);
2040 }
2041
2042 /* Reset the counter value */
2043 MONITOR_VALUE(monitor) = 0;
2044 MONITOR_MAX_VALUE(monitor) = MAX_RESERVED;
2045 MONITOR_MIN_VALUE(monitor) = MIN_RESERVED;
2046
2047 MONITOR_FIELD((monitor), mon_reset_time) = time(NULL);
2048
2049 if (monitor_was_on) {
2050 MONITOR_ON(monitor);
2051 }
2052 }
2053
2054 /*************************************************************//**
2055 Turn on monitor counters that are marked as default ON. */
2056 void
srv_mon_default_on(void)2057 srv_mon_default_on(void)
2058 /*====================*/
2059 {
2060 ulint ix;
2061
2062 for (ix = 0; ix < NUM_MONITOR; ix++) {
2063 if (innodb_counter_info[ix].monitor_type
2064 & MONITOR_DEFAULT_ON) {
2065 /* Turn on monitor counters that are default on */
2066 MONITOR_ON(ix);
2067 MONITOR_INIT(ix);
2068 MONITOR_SET_START(ix);
2069 }
2070 }
2071 }
2072 #endif /* !UNIV_HOTBACKUP */
2073