32 #ifndef UNIV_HOTBACKUP
71 monitor_running_t mon_status;
101 #define MIN_RESERVED ((mon_type_t) (IB_UINT64_MAX >> 1))
102 #define MAX_RESERVED (~MIN_RESERVED)
120 MONITOR_DEFAULT_START = 0,
123 MONITOR_MODULE_METADATA,
126 MONITOR_TABLE_REFERENCE,
127 MONITOR_OVLD_META_MEM_POOL,
133 MONITOR_LOCKREC_WAIT,
134 MONITOR_TABLELOCK_WAIT,
135 MONITOR_NUM_RECLOCK_REQ,
136 MONITOR_RECLOCK_CREATED,
137 MONITOR_RECLOCK_REMOVED,
139 MONITOR_TABLELOCK_CREATED,
140 MONITOR_TABLELOCK_REMOVED,
141 MONITOR_NUM_TABLELOCK,
142 MONITOR_OVLD_ROW_LOCK_CURRENT_WAIT,
143 MONITOR_OVLD_LOCK_WAIT_TIME,
144 MONITOR_OVLD_LOCK_MAX_WAIT_TIME,
145 MONITOR_OVLD_ROW_LOCK_WAIT,
146 MONITOR_OVLD_LOCK_AVG_WAIT_TIME,
149 MONITOR_MODULE_BUFFER,
150 MONITOR_OVLD_BUFFER_POOL_SIZE,
151 MONITOR_OVLD_BUF_POOL_READS,
152 MONITOR_OVLD_BUF_POOL_READ_REQUESTS,
153 MONITOR_OVLD_BUF_POOL_WRITE_REQUEST,
154 MONITOR_OVLD_BUF_POOL_WAIT_FREE,
155 MONITOR_OVLD_BUF_POOL_READ_AHEAD,
156 MONITOR_OVLD_BUF_POOL_READ_AHEAD_EVICTED,
157 MONITOR_OVLD_BUF_POOL_PAGE_TOTAL,
158 MONITOR_OVLD_BUF_POOL_PAGE_MISC,
159 MONITOR_OVLD_BUF_POOL_PAGES_DATA,
160 MONITOR_OVLD_BUF_POOL_BYTES_DATA,
161 MONITOR_OVLD_BUF_POOL_PAGES_DIRTY,
162 MONITOR_OVLD_BUF_POOL_BYTES_DIRTY,
163 MONITOR_OVLD_BUF_POOL_PAGES_FREE,
164 MONITOR_OVLD_PAGE_CREATED,
165 MONITOR_OVLD_PAGES_WRITTEN,
166 MONITOR_OVLD_PAGES_READ,
167 MONITOR_OVLD_BYTE_READ,
168 MONITOR_OVLD_BYTE_WRITTEN,
169 MONITOR_FLUSH_BATCH_SCANNED,
170 MONITOR_FLUSH_BATCH_SCANNED_NUM_CALL,
171 MONITOR_FLUSH_BATCH_SCANNED_PER_CALL,
172 MONITOR_FLUSH_HP_RESCAN,
173 MONITOR_FLUSH_BATCH_TOTAL_PAGE,
174 MONITOR_FLUSH_BATCH_COUNT,
175 MONITOR_FLUSH_BATCH_PAGES,
176 MONITOR_FLUSH_NEIGHBOR_TOTAL_PAGE,
177 MONITOR_FLUSH_NEIGHBOR_COUNT,
178 MONITOR_FLUSH_NEIGHBOR_PAGES,
179 MONITOR_FLUSH_N_TO_FLUSH_REQUESTED,
180 MONITOR_FLUSH_AVG_PAGE_RATE,
181 MONITOR_FLUSH_LSN_AVG_RATE,
182 MONITOR_FLUSH_PCT_FOR_DIRTY,
183 MONITOR_FLUSH_PCT_FOR_LSN,
184 MONITOR_FLUSH_SYNC_WAITS,
185 MONITOR_FLUSH_ADAPTIVE_TOTAL_PAGE,
186 MONITOR_FLUSH_ADAPTIVE_COUNT,
187 MONITOR_FLUSH_ADAPTIVE_PAGES,
188 MONITOR_FLUSH_SYNC_TOTAL_PAGE,
189 MONITOR_FLUSH_SYNC_COUNT,
190 MONITOR_FLUSH_SYNC_PAGES,
191 MONITOR_FLUSH_BACKGROUND_TOTAL_PAGE,
192 MONITOR_FLUSH_BACKGROUND_COUNT,
193 MONITOR_FLUSH_BACKGROUND_PAGES,
194 MONITOR_LRU_BATCH_SCANNED,
195 MONITOR_LRU_BATCH_SCANNED_NUM_CALL,
196 MONITOR_LRU_BATCH_SCANNED_PER_CALL,
197 MONITOR_LRU_BATCH_TOTAL_PAGE,
198 MONITOR_LRU_BATCH_COUNT,
199 MONITOR_LRU_BATCH_PAGES,
200 MONITOR_LRU_SINGLE_FLUSH_SCANNED,
201 MONITOR_LRU_SINGLE_FLUSH_SCANNED_NUM_CALL,
202 MONITOR_LRU_SINGLE_FLUSH_SCANNED_PER_CALL,
203 MONITOR_LRU_SINGLE_FLUSH_FAILURE_COUNT,
204 MONITOR_LRU_GET_FREE_SEARCH,
205 MONITOR_LRU_SEARCH_SCANNED,
206 MONITOR_LRU_SEARCH_SCANNED_NUM_CALL,
207 MONITOR_LRU_SEARCH_SCANNED_PER_CALL,
208 MONITOR_LRU_UNZIP_SEARCH_SCANNED,
209 MONITOR_LRU_UNZIP_SEARCH_SCANNED_NUM_CALL,
210 MONITOR_LRU_UNZIP_SEARCH_SCANNED_PER_CALL,
213 MONITOR_MODULE_BUF_PAGE,
214 MONITOR_INDEX_LEAF_PAGE_READ,
215 MONITOR_INDEX_NON_LEAF_PAGE_READ,
216 MONITOR_INDEX_IBUF_LEAF_PAGE_READ,
217 MONITOR_INDEX_IBUF_NON_LEAF_PAGE_READ,
218 MONITOR_UNDO_LOG_PAGE_READ,
219 MONITOR_INODE_PAGE_READ,
220 MONITOR_IBUF_FREELIST_PAGE_READ,
221 MONITOR_IBUF_BITMAP_PAGE_READ,
222 MONITOR_SYSTEM_PAGE_READ,
223 MONITOR_TRX_SYSTEM_PAGE_READ,
224 MONITOR_FSP_HDR_PAGE_READ,
225 MONITOR_XDES_PAGE_READ,
226 MONITOR_BLOB_PAGE_READ,
227 MONITOR_ZBLOB_PAGE_READ,
228 MONITOR_ZBLOB2_PAGE_READ,
229 MONITOR_OTHER_PAGE_READ,
230 MONITOR_INDEX_LEAF_PAGE_WRITTEN,
231 MONITOR_INDEX_NON_LEAF_PAGE_WRITTEN,
232 MONITOR_INDEX_IBUF_LEAF_PAGE_WRITTEN,
233 MONITOR_INDEX_IBUF_NON_LEAF_PAGE_WRITTEN,
234 MONITOR_UNDO_LOG_PAGE_WRITTEN,
235 MONITOR_INODE_PAGE_WRITTEN,
236 MONITOR_IBUF_FREELIST_PAGE_WRITTEN,
237 MONITOR_IBUF_BITMAP_PAGE_WRITTEN,
238 MONITOR_SYSTEM_PAGE_WRITTEN,
239 MONITOR_TRX_SYSTEM_PAGE_WRITTEN,
240 MONITOR_FSP_HDR_PAGE_WRITTEN,
241 MONITOR_XDES_PAGE_WRITTEN,
242 MONITOR_BLOB_PAGE_WRITTEN,
243 MONITOR_ZBLOB_PAGE_WRITTEN,
244 MONITOR_ZBLOB2_PAGE_WRITTEN,
245 MONITOR_OTHER_PAGE_WRITTEN,
249 MONITOR_OVLD_OS_FILE_READ,
250 MONITOR_OVLD_OS_FILE_WRITE,
251 MONITOR_OVLD_OS_FSYNC,
252 MONITOR_OS_PENDING_READS,
253 MONITOR_OS_PENDING_WRITES,
254 MONITOR_OVLD_OS_LOG_WRITTEN,
255 MONITOR_OVLD_OS_LOG_FSYNC,
256 MONITOR_OVLD_OS_LOG_PENDING_FSYNC,
257 MONITOR_OVLD_OS_LOG_PENDING_WRITES,
261 MONITOR_TRX_RW_COMMIT,
262 MONITOR_TRX_RO_COMMIT,
263 MONITOR_TRX_NL_RO_COMMIT,
264 MONITOR_TRX_COMMIT_UNDO,
265 MONITOR_TRX_ROLLBACK,
266 MONITOR_TRX_ROLLBACK_SAVEPOINT,
267 MONITOR_TRX_ROLLBACK_ACTIVE,
269 MONITOR_RSEG_HISTORY_LEN,
270 MONITOR_NUM_UNDO_SLOT_USED,
271 MONITOR_NUM_UNDO_SLOT_CACHED,
272 MONITOR_RSEG_CUR_SIZE,
275 MONITOR_MODULE_PURGE,
276 MONITOR_N_DEL_ROW_PURGE,
277 MONITOR_N_UPD_EXIST_EXTERN,
278 MONITOR_PURGE_INVOKED,
279 MONITOR_PURGE_N_PAGE_HANDLED,
280 MONITOR_DML_PURGE_DELAY,
281 MONITOR_PURGE_STOP_COUNT,
282 MONITOR_PURGE_RESUME_COUNT,
285 MONITOR_MODULE_RECOVERY,
286 MONITOR_NUM_CHECKPOINT,
287 MONITOR_OVLD_LSN_FLUSHDISK,
288 MONITOR_OVLD_LSN_CHECKPOINT,
289 MONITOR_OVLD_LSN_CURRENT,
290 MONITOR_LSN_CHECKPOINT_AGE,
291 MONITOR_OVLD_BUF_OLDEST_LSN,
292 MONITOR_OVLD_MAX_AGE_ASYNC,
293 MONITOR_OVLD_MAX_AGE_SYNC,
294 MONITOR_PENDING_LOG_WRITE,
295 MONITOR_PENDING_CHECKPOINT_WRITE,
297 MONITOR_OVLD_LOG_WAITS,
298 MONITOR_OVLD_LOG_WRITE_REQUEST,
299 MONITOR_OVLD_LOG_WRITES,
303 MONITOR_PAGE_COMPRESS,
304 MONITOR_PAGE_DECOMPRESS,
305 MONITOR_PAD_INCREMENTS,
306 MONITOR_PAD_DECREMENTS,
309 MONITOR_MODULE_INDEX,
311 MONITOR_INDEX_MERGE_ATTEMPTS,
312 MONITOR_INDEX_MERGE_SUCCESSFUL,
313 MONITOR_INDEX_REORG_ATTEMPTS,
314 MONITOR_INDEX_REORG_SUCCESSFUL,
315 MONITOR_INDEX_DISCARD,
318 MONITOR_MODULE_ADAPTIVE_HASH,
319 MONITOR_OVLD_ADAPTIVE_HASH_SEARCH,
320 MONITOR_OVLD_ADAPTIVE_HASH_SEARCH_BTREE,
321 MONITOR_ADAPTIVE_HASH_PAGE_ADDED,
322 MONITOR_ADAPTIVE_HASH_PAGE_REMOVED,
323 MONITOR_ADAPTIVE_HASH_ROW_ADDED,
324 MONITOR_ADAPTIVE_HASH_ROW_REMOVED,
325 MONITOR_ADAPTIVE_HASH_ROW_REMOVE_NOT_FOUND,
326 MONITOR_ADAPTIVE_HASH_ROW_UPDATED,
329 MONITOR_MODULE_FIL_SYSTEM,
330 MONITOR_OVLD_N_FILE_OPENED,
333 MONITOR_MODULE_IBUF_SYSTEM,
334 MONITOR_OVLD_IBUF_MERGE_INSERT,
335 MONITOR_OVLD_IBUF_MERGE_DELETE,
336 MONITOR_OVLD_IBUF_MERGE_PURGE,
337 MONITOR_OVLD_IBUF_MERGE_DISCARD_INSERT,
338 MONITOR_OVLD_IBUF_MERGE_DISCARD_DELETE,
339 MONITOR_OVLD_IBUF_MERGE_DISCARD_PURGE,
340 MONITOR_OVLD_IBUF_MERGES,
341 MONITOR_OVLD_IBUF_SIZE,
344 MONITOR_MODULE_SERVER,
345 MONITOR_MASTER_THREAD_SLEEP,
346 MONITOR_OVLD_SERVER_ACTIVITY,
347 MONITOR_MASTER_ACTIVE_LOOPS,
348 MONITOR_MASTER_IDLE_LOOPS,
349 MONITOR_SRV_BACKGROUND_DROP_TABLE_MICROSECOND,
350 MONITOR_SRV_IBUF_MERGE_MICROSECOND,
351 MONITOR_SRV_LOG_FLUSH_MICROSECOND,
352 MONITOR_SRV_MEM_VALIDATE_MICROSECOND,
353 MONITOR_SRV_PURGE_MICROSECOND,
354 MONITOR_SRV_DICT_LRU_MICROSECOND,
355 MONITOR_SRV_CHECKPOINT_MICROSECOND,
356 MONITOR_OVLD_SRV_DBLWR_WRITES,
357 MONITOR_OVLD_SRV_DBLWR_PAGES_WRITTEN,
358 MONITOR_OVLD_SRV_PAGE_SIZE,
359 MONITOR_OVLD_RWLOCK_S_SPIN_WAITS,
360 MONITOR_OVLD_RWLOCK_X_SPIN_WAITS,
361 MONITOR_OVLD_RWLOCK_S_SPIN_ROUNDS,
362 MONITOR_OVLD_RWLOCK_X_SPIN_ROUNDS,
363 MONITOR_OVLD_RWLOCK_S_OS_WAITS,
364 MONITOR_OVLD_RWLOCK_X_OS_WAITS,
367 MONITOR_MODULE_DML_STATS,
368 MONITOR_OLVD_ROW_READ,
369 MONITOR_OLVD_ROW_INSERTED,
370 MONITOR_OLVD_ROW_DELETED,
371 MONITOR_OLVD_ROW_UPDTATED,
374 MONITOR_MODULE_DDL_STATS,
375 MONITOR_BACKGROUND_DROP_INDEX,
376 MONITOR_BACKGROUND_DROP_TABLE,
377 MONITOR_ONLINE_CREATE_INDEX,
378 MONITOR_PENDING_ALTER_TABLE,
381 MONITOR_ICP_ATTEMPTS,
382 MONITOR_ICP_NO_MATCH,
383 MONITOR_ICP_OUT_OF_RANGE,
396 #define MONITOR_WILDCARD_MATCH (NUM_MONITOR + 1)
399 #define MONITOR_NO_MATCH (NUM_MONITOR + 2)
431 #define NUM_BITS_ULINT (sizeof(ulint) * CHAR_BIT)
440 #define MONITOR_ON(monitor) \
441 (monitor_set_tbl[monitor / NUM_BITS_ULINT] |= \
442 ((ulint)1 << (monitor % NUM_BITS_ULINT)))
444 #define MONITOR_OFF(monitor) \
445 (monitor_set_tbl[monitor / NUM_BITS_ULINT] &= \
446 ~((ulint)1 << (monitor % NUM_BITS_ULINT)))
449 #define MONITOR_IS_ON(monitor) \
450 (monitor_set_tbl[monitor / NUM_BITS_ULINT] & \
451 ((ulint)1 << (monitor % NUM_BITS_ULINT)))
464 #define MONITOR_FIELD(monitor, field) \
465 (innodb_counter_value[monitor].field)
467 #define MONITOR_VALUE(monitor) \
468 MONITOR_FIELD(monitor, mon_value)
470 #define MONITOR_MAX_VALUE(monitor) \
471 MONITOR_FIELD(monitor, mon_max_value)
473 #define MONITOR_MIN_VALUE(monitor) \
474 MONITOR_FIELD(monitor, mon_min_value)
476 #define MONITOR_VALUE_RESET(monitor) \
477 MONITOR_FIELD(monitor, mon_value_reset)
479 #define MONITOR_MAX_VALUE_START(monitor) \
480 MONITOR_FIELD(monitor, mon_max_value_start)
482 #define MONITOR_MIN_VALUE_START(monitor) \
483 MONITOR_FIELD(monitor, mon_min_value_start)
485 #define MONITOR_LAST_VALUE(monitor) \
486 MONITOR_FIELD(monitor, mon_last_value)
488 #define MONITOR_START_VALUE(monitor) \
489 MONITOR_FIELD(monitor, mon_start_value)
491 #define MONITOR_VALUE_SINCE_START(monitor) \
492 (MONITOR_VALUE(monitor) + MONITOR_VALUE_RESET(monitor))
494 #define MONITOR_STATUS(monitor) \
495 MONITOR_FIELD(monitor, mon_status)
497 #define MONITOR_SET_START(monitor) \
499 MONITOR_STATUS(monitor) = MONITOR_STARTED; \
500 MONITOR_FIELD((monitor), mon_start_time) = time(NULL); \
503 #define MONITOR_SET_OFF(monitor) \
505 MONITOR_STATUS(monitor) = MONITOR_STOPPED; \
506 MONITOR_FIELD((monitor), mon_stop_time) = time(NULL); \
509 #define MONITOR_INIT_ZERO_VALUE 0
513 #define MONITOR_MAX_MIN_NOT_INIT(monitor) \
514 (MONITOR_STATUS(monitor) == MONITOR_INIT_ZERO_VALUE \
515 && MONITOR_MIN_VALUE(monitor) == MONITOR_INIT_ZERO_VALUE \
516 && MONITOR_MAX_VALUE(monitor) == MONITOR_INIT_ZERO_VALUE)
518 #define MONITOR_INIT(monitor) \
519 if (MONITOR_MAX_MIN_NOT_INIT(monitor)) { \
520 MONITOR_MIN_VALUE(monitor) = MIN_RESERVED; \
521 MONITOR_MIN_VALUE_START(monitor) = MIN_RESERVED; \
522 MONITOR_MAX_VALUE(monitor) = MAX_RESERVED; \
523 MONITOR_MAX_VALUE_START(monitor) = MAX_RESERVED; \
530 #define MONITOR_INC(monitor) \
531 if (MONITOR_IS_ON(monitor)) { \
532 MONITOR_VALUE(monitor)++; \
533 if (MONITOR_VALUE(monitor) > MONITOR_MAX_VALUE(monitor)) { \
534 MONITOR_MAX_VALUE(monitor) = MONITOR_VALUE(monitor);\
542 # define MONITOR_MUTEX_INC(mutex, monitor) \
543 ut_ad(!mutex_own(mutex)); \
544 if (MONITOR_IS_ON(monitor)) { \
545 mutex_enter(mutex); \
546 if (++MONITOR_VALUE(monitor) > MONITOR_MAX_VALUE(monitor)) { \
547 MONITOR_MAX_VALUE(monitor) = MONITOR_VALUE(monitor); \
555 # define MONITOR_MUTEX_DEC(mutex, monitor) \
556 ut_ad(!mutex_own(mutex)); \
557 if (MONITOR_IS_ON(monitor)) { \
558 mutex_enter(mutex); \
559 if (--MONITOR_VALUE(monitor) < MONITOR_MIN_VALUE(monitor)) { \
560 MONITOR_MIN_VALUE(monitor) = MONITOR_VALUE(monitor); \
565 #if defined HAVE_ATOMIC_BUILTINS_64
569 # define MONITOR_ATOMIC_INC(monitor) \
570 if (MONITOR_IS_ON(monitor)) { \
572 value = os_atomic_increment_uint64( \
573 (ib_uint64_t*) &MONITOR_VALUE(monitor), 1); \
576 if (value > (ib_uint64_t) MONITOR_MAX_VALUE(monitor)) { \
577 MONITOR_MAX_VALUE(monitor) = value; \
584 # define MONITOR_ATOMIC_DEC(monitor) \
585 if (MONITOR_IS_ON(monitor)) { \
587 value = os_atomic_decrement_uint64( \
588 (ib_uint64_t*) &MONITOR_VALUE(monitor), 1); \
591 if (value < (ib_uint64_t) MONITOR_MIN_VALUE(monitor)) { \
592 MONITOR_MIN_VALUE(monitor) = value; \
595 # define srv_mon_create() ((void) 0)
596 # define srv_mon_free() ((void) 0)
617 # define MONITOR_ATOMIC_INC(monitor) MONITOR_MUTEX_INC(&monitor_mutex, monitor)
621 # define MONITOR_ATOMIC_DEC(monitor) MONITOR_MUTEX_DEC(&monitor_mutex, monitor)
624 #define MONITOR_DEC(monitor) \
625 if (MONITOR_IS_ON(monitor)) { \
626 MONITOR_VALUE(monitor)--; \
627 if (MONITOR_VALUE(monitor) < MONITOR_MIN_VALUE(monitor)) { \
628 MONITOR_MIN_VALUE(monitor) = MONITOR_VALUE(monitor);\
632 #ifdef UNIV_DEBUG_VALGRIND
633 # define MONITOR_CHECK_DEFINED(value) do { \
634 mon_type_t m = value; \
635 UNIV_MEM_ASSERT_RW(&m, sizeof m); \
638 # define MONITOR_CHECK_DEFINED(value) (void) 0
641 #define MONITOR_INC_VALUE(monitor, value) \
642 MONITOR_CHECK_DEFINED(value); \
643 if (MONITOR_IS_ON(monitor)) { \
644 MONITOR_VALUE(monitor) += (mon_type_t) (value); \
645 if (MONITOR_VALUE(monitor) > MONITOR_MAX_VALUE(monitor)) { \
646 MONITOR_MAX_VALUE(monitor) = MONITOR_VALUE(monitor);\
650 #define MONITOR_DEC_VALUE(monitor, value) \
651 MONITOR_CHECK_DEFINED(value); \
652 if (MONITOR_IS_ON(monitor)) { \
653 ut_ad(MONITOR_VALUE(monitor) >= (mon_type_t) (value); \
654 MONITOR_VALUE(monitor) -= (mon_type_t) (value); \
655 if (MONITOR_VALUE(monitor) < MONITOR_MIN_VALUE(monitor)) { \
656 MONITOR_MIN_VALUE(monitor) = MONITOR_VALUE(monitor);\
662 #define MONITOR_INC_NOCHECK(monitor) \
664 MONITOR_VALUE(monitor)++; \
665 if (MONITOR_VALUE(monitor) > MONITOR_MAX_VALUE(monitor)) { \
666 MONITOR_MAX_VALUE(monitor) = MONITOR_VALUE(monitor);\
670 #define MONITOR_DEC_NOCHECK(monitor) \
672 MONITOR_VALUE(monitor)--; \
673 if (MONITOR_VALUE(monitor) < MONITOR_MIN_VALUE(monitor)) { \
674 MONITOR_MIN_VALUE(monitor) = MONITOR_VALUE(monitor);\
679 #define MONITOR_SET(monitor, value) \
680 MONITOR_CHECK_DEFINED(value); \
681 if (MONITOR_IS_ON(monitor)) { \
682 MONITOR_VALUE(monitor) = (mon_type_t) (value); \
683 if (MONITOR_VALUE(monitor) > MONITOR_MAX_VALUE(monitor)) { \
684 MONITOR_MAX_VALUE(monitor) = MONITOR_VALUE(monitor);\
686 if (MONITOR_VALUE(monitor) < MONITOR_MIN_VALUE(monitor)) { \
687 MONITOR_MIN_VALUE(monitor) = MONITOR_VALUE(monitor);\
695 #define MONITOR_INC_TIME_IN_MICRO_SECS(monitor, value) \
696 MONITOR_CHECK_DEFINED(value); \
697 if (MONITOR_IS_ON(monitor)) { \
698 ullint old_time = (value); \
699 value = ut_time_us(NULL); \
700 MONITOR_VALUE(monitor) += (mon_type_t) (value - old_time);\
713 #define MONITOR_INC_VALUE_CUMULATIVE( \
714 monitor, monitor_n_calls, monitor_per_call, value) \
715 MONITOR_CHECK_DEFINED(value); \
716 if (MONITOR_IS_ON(monitor)) { \
717 MONITOR_VALUE(monitor_n_calls)++; \
718 MONITOR_VALUE(monitor_per_call) = (mon_type_t) (value); \
719 if (MONITOR_VALUE(monitor_per_call) \
720 > MONITOR_MAX_VALUE(monitor_per_call)) { \
721 MONITOR_MAX_VALUE(monitor_per_call) = \
722 (mon_type_t) (value); \
724 MONITOR_VALUE(monitor) += (mon_type_t) (value); \
725 if (MONITOR_VALUE(monitor) > MONITOR_MAX_VALUE(monitor)) { \
726 MONITOR_MAX_VALUE(monitor) = MONITOR_VALUE(monitor);\
732 #define MONITOR_SET_UPD_MAX_ONLY(monitor, value) \
733 MONITOR_CHECK_DEFINED(value); \
734 if (MONITOR_IS_ON(monitor)) { \
735 MONITOR_VALUE(monitor) = (mon_type_t) (value); \
736 if (MONITOR_VALUE(monitor) > MONITOR_MAX_VALUE(monitor)) { \
737 MONITOR_MAX_VALUE(monitor) = MONITOR_VALUE(monitor);\
743 #define MONITOR_SET_SIMPLE(monitor, value) \
744 MONITOR_CHECK_DEFINED(value); \
745 if (MONITOR_IS_ON(monitor)) { \
746 MONITOR_VALUE(monitor) = (mon_type_t) (value); \
751 #define MONITOR_RESET_ALL(monitor) \
753 MONITOR_VALUE(monitor) = MONITOR_INIT_ZERO_VALUE; \
754 MONITOR_MAX_VALUE(monitor) = MAX_RESERVED; \
755 MONITOR_MIN_VALUE(monitor) = MIN_RESERVED; \
756 MONITOR_VALUE_RESET(monitor) = MONITOR_INIT_ZERO_VALUE; \
757 MONITOR_MAX_VALUE_START(monitor) = MAX_RESERVED; \
758 MONITOR_MIN_VALUE_START(monitor) = MIN_RESERVED; \
759 MONITOR_LAST_VALUE(monitor) = MONITOR_INIT_ZERO_VALUE; \
760 MONITOR_FIELD(monitor, mon_start_time) = \
761 MONITOR_INIT_ZERO_VALUE; \
762 MONITOR_FIELD(monitor, mon_stop_time) = \
763 MONITOR_INIT_ZERO_VALUE; \
764 MONITOR_FIELD(monitor, mon_reset_time) = \
765 MONITOR_INIT_ZERO_VALUE; \
773 #define MONITOR_SAVE_START(monitor, value) do { \
774 MONITOR_CHECK_DEFINED(value); \
775 (MONITOR_START_VALUE(monitor) = \
776 (mon_type_t) (value) - MONITOR_VALUE_RESET(monitor)); \
781 #define MONITOR_SAVE_LAST(monitor) \
783 MONITOR_LAST_VALUE(monitor) = MONITOR_VALUE(monitor); \
784 MONITOR_START_VALUE(monitor) += MONITOR_VALUE(monitor); \
789 #define MONITOR_SET_DIFF(monitor, value) \
790 MONITOR_SET_UPD_MAX_ONLY(monitor, ((value) \
791 - MONITOR_VALUE_RESET(monitor) \
792 - MONITOR_FIELD(monitor, mon_start_value) \
793 + MONITOR_FIELD(monitor, mon_last_value)))
892 # define MONITOR_INC(x) ((void) 0)
893 # define MONITOR_DEC(x) ((void) 0)