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,
314 MONITOR_MODULE_ADAPTIVE_HASH,
315 MONITOR_OVLD_ADAPTIVE_HASH_SEARCH,
316 MONITOR_OVLD_ADAPTIVE_HASH_SEARCH_BTREE,
317 MONITOR_ADAPTIVE_HASH_PAGE_ADDED,
318 MONITOR_ADAPTIVE_HASH_PAGE_REMOVED,
319 MONITOR_ADAPTIVE_HASH_ROW_ADDED,
320 MONITOR_ADAPTIVE_HASH_ROW_REMOVED,
321 MONITOR_ADAPTIVE_HASH_ROW_REMOVE_NOT_FOUND,
322 MONITOR_ADAPTIVE_HASH_ROW_UPDATED,
325 MONITOR_MODULE_FIL_SYSTEM,
326 MONITOR_OVLD_N_FILE_OPENED,
329 MONITOR_MODULE_IBUF_SYSTEM,
330 MONITOR_OVLD_IBUF_MERGE_INSERT,
331 MONITOR_OVLD_IBUF_MERGE_DELETE,
332 MONITOR_OVLD_IBUF_MERGE_PURGE,
333 MONITOR_OVLD_IBUF_MERGE_DISCARD_INSERT,
334 MONITOR_OVLD_IBUF_MERGE_DISCARD_DELETE,
335 MONITOR_OVLD_IBUF_MERGE_DISCARD_PURGE,
336 MONITOR_OVLD_IBUF_MERGES,
337 MONITOR_OVLD_IBUF_SIZE,
340 MONITOR_MODULE_SERVER,
341 MONITOR_MASTER_THREAD_SLEEP,
342 MONITOR_OVLD_SERVER_ACTIVITY,
343 MONITOR_MASTER_ACTIVE_LOOPS,
344 MONITOR_MASTER_IDLE_LOOPS,
345 MONITOR_SRV_BACKGROUND_DROP_TABLE_MICROSECOND,
346 MONITOR_SRV_IBUF_MERGE_MICROSECOND,
347 MONITOR_SRV_LOG_FLUSH_MICROSECOND,
348 MONITOR_SRV_MEM_VALIDATE_MICROSECOND,
349 MONITOR_SRV_PURGE_MICROSECOND,
350 MONITOR_SRV_DICT_LRU_MICROSECOND,
351 MONITOR_SRV_CHECKPOINT_MICROSECOND,
352 MONITOR_OVLD_SRV_DBLWR_WRITES,
353 MONITOR_OVLD_SRV_DBLWR_PAGES_WRITTEN,
354 MONITOR_OVLD_SRV_PAGE_SIZE,
355 MONITOR_OVLD_RWLOCK_S_SPIN_WAITS,
356 MONITOR_OVLD_RWLOCK_X_SPIN_WAITS,
357 MONITOR_OVLD_RWLOCK_S_SPIN_ROUNDS,
358 MONITOR_OVLD_RWLOCK_X_SPIN_ROUNDS,
359 MONITOR_OVLD_RWLOCK_S_OS_WAITS,
360 MONITOR_OVLD_RWLOCK_X_OS_WAITS,
363 MONITOR_MODULE_DML_STATS,
364 MONITOR_OLVD_ROW_READ,
365 MONITOR_OLVD_ROW_INSERTED,
366 MONITOR_OLVD_ROW_DELETED,
367 MONITOR_OLVD_ROW_UPDTATED,
370 MONITOR_MODULE_DDL_STATS,
371 MONITOR_BACKGROUND_DROP_INDEX,
372 MONITOR_BACKGROUND_DROP_TABLE,
373 MONITOR_ONLINE_CREATE_INDEX,
374 MONITOR_PENDING_ALTER_TABLE,
377 MONITOR_ICP_ATTEMPTS,
378 MONITOR_ICP_NO_MATCH,
379 MONITOR_ICP_OUT_OF_RANGE,
392 #define MONITOR_WILDCARD_MATCH (NUM_MONITOR + 1)
395 #define MONITOR_NO_MATCH (NUM_MONITOR + 2)
427 #define NUM_BITS_ULINT (sizeof(ulint) * CHAR_BIT)
436 #define MONITOR_ON(monitor) \
437 (monitor_set_tbl[monitor / NUM_BITS_ULINT] |= \
438 ((ulint)1 << (monitor % NUM_BITS_ULINT)))
440 #define MONITOR_OFF(monitor) \
441 (monitor_set_tbl[monitor / NUM_BITS_ULINT] &= \
442 ~((ulint)1 << (monitor % NUM_BITS_ULINT)))
445 #define MONITOR_IS_ON(monitor) \
446 (monitor_set_tbl[monitor / NUM_BITS_ULINT] & \
447 ((ulint)1 << (monitor % NUM_BITS_ULINT)))
460 #define MONITOR_FIELD(monitor, field) \
461 (innodb_counter_value[monitor].field)
463 #define MONITOR_VALUE(monitor) \
464 MONITOR_FIELD(monitor, mon_value)
466 #define MONITOR_MAX_VALUE(monitor) \
467 MONITOR_FIELD(monitor, mon_max_value)
469 #define MONITOR_MIN_VALUE(monitor) \
470 MONITOR_FIELD(monitor, mon_min_value)
472 #define MONITOR_VALUE_RESET(monitor) \
473 MONITOR_FIELD(monitor, mon_value_reset)
475 #define MONITOR_MAX_VALUE_START(monitor) \
476 MONITOR_FIELD(monitor, mon_max_value_start)
478 #define MONITOR_MIN_VALUE_START(monitor) \
479 MONITOR_FIELD(monitor, mon_min_value_start)
481 #define MONITOR_LAST_VALUE(monitor) \
482 MONITOR_FIELD(monitor, mon_last_value)
484 #define MONITOR_START_VALUE(monitor) \
485 MONITOR_FIELD(monitor, mon_start_value)
487 #define MONITOR_VALUE_SINCE_START(monitor) \
488 (MONITOR_VALUE(monitor) + MONITOR_VALUE_RESET(monitor))
490 #define MONITOR_STATUS(monitor) \
491 MONITOR_FIELD(monitor, mon_status)
493 #define MONITOR_SET_START(monitor) \
495 MONITOR_STATUS(monitor) = MONITOR_STARTED; \
496 MONITOR_FIELD((monitor), mon_start_time) = time(NULL); \
499 #define MONITOR_SET_OFF(monitor) \
501 MONITOR_STATUS(monitor) = MONITOR_STOPPED; \
502 MONITOR_FIELD((monitor), mon_stop_time) = time(NULL); \
505 #define MONITOR_INIT_ZERO_VALUE 0
509 #define MONITOR_MAX_MIN_NOT_INIT(monitor) \
510 (MONITOR_STATUS(monitor) == MONITOR_INIT_ZERO_VALUE \
511 && MONITOR_MIN_VALUE(monitor) == MONITOR_INIT_ZERO_VALUE \
512 && MONITOR_MAX_VALUE(monitor) == MONITOR_INIT_ZERO_VALUE)
514 #define MONITOR_INIT(monitor) \
515 if (MONITOR_MAX_MIN_NOT_INIT(monitor)) { \
516 MONITOR_MIN_VALUE(monitor) = MIN_RESERVED; \
517 MONITOR_MIN_VALUE_START(monitor) = MIN_RESERVED; \
518 MONITOR_MAX_VALUE(monitor) = MAX_RESERVED; \
519 MONITOR_MAX_VALUE_START(monitor) = MAX_RESERVED; \
526 #define MONITOR_INC(monitor) \
527 if (MONITOR_IS_ON(monitor)) { \
528 MONITOR_VALUE(monitor)++; \
529 if (MONITOR_VALUE(monitor) > MONITOR_MAX_VALUE(monitor)) { \
530 MONITOR_MAX_VALUE(monitor) = MONITOR_VALUE(monitor);\
538 # define MONITOR_MUTEX_INC(mutex, monitor) \
539 ut_ad(!mutex_own(mutex)); \
540 if (MONITOR_IS_ON(monitor)) { \
541 mutex_enter(mutex); \
542 if (++MONITOR_VALUE(monitor) > MONITOR_MAX_VALUE(monitor)) { \
543 MONITOR_MAX_VALUE(monitor) = MONITOR_VALUE(monitor); \
551 # define MONITOR_MUTEX_DEC(mutex, monitor) \
552 ut_ad(!mutex_own(mutex)); \
553 if (MONITOR_IS_ON(monitor)) { \
554 mutex_enter(mutex); \
555 if (--MONITOR_VALUE(monitor) < MONITOR_MIN_VALUE(monitor)) { \
556 MONITOR_MIN_VALUE(monitor) = MONITOR_VALUE(monitor); \
561 #if defined HAVE_ATOMIC_BUILTINS_64
565 # define MONITOR_ATOMIC_INC(monitor) \
566 if (MONITOR_IS_ON(monitor)) { \
568 value = os_atomic_increment_uint64( \
569 (ib_uint64_t*) &MONITOR_VALUE(monitor), 1); \
572 if (value > (ib_uint64_t) MONITOR_MAX_VALUE(monitor)) { \
573 MONITOR_MAX_VALUE(monitor) = value; \
580 # define MONITOR_ATOMIC_DEC(monitor) \
581 if (MONITOR_IS_ON(monitor)) { \
583 value = os_atomic_decrement_uint64( \
584 (ib_uint64_t*) &MONITOR_VALUE(monitor), 1); \
587 if (value < (ib_uint64_t) MONITOR_MIN_VALUE(monitor)) { \
588 MONITOR_MIN_VALUE(monitor) = value; \
591 # define srv_mon_create() ((void) 0)
592 # define srv_mon_free() ((void) 0)
613 # define MONITOR_ATOMIC_INC(monitor) MONITOR_MUTEX_INC(&monitor_mutex, monitor)
617 # define MONITOR_ATOMIC_DEC(monitor) MONITOR_MUTEX_DEC(&monitor_mutex, monitor)
620 #define MONITOR_DEC(monitor) \
621 if (MONITOR_IS_ON(monitor)) { \
622 MONITOR_VALUE(monitor)--; \
623 if (MONITOR_VALUE(monitor) < MONITOR_MIN_VALUE(monitor)) { \
624 MONITOR_MIN_VALUE(monitor) = MONITOR_VALUE(monitor);\
628 #ifdef UNIV_DEBUG_VALGRIND
629 # define MONITOR_CHECK_DEFINED(value) do { \
630 mon_type_t m = value; \
631 UNIV_MEM_ASSERT_RW(&m, sizeof m); \
634 # define MONITOR_CHECK_DEFINED(value) (void) 0
637 #define MONITOR_INC_VALUE(monitor, value) \
638 MONITOR_CHECK_DEFINED(value); \
639 if (MONITOR_IS_ON(monitor)) { \
640 MONITOR_VALUE(monitor) += (mon_type_t) (value); \
641 if (MONITOR_VALUE(monitor) > MONITOR_MAX_VALUE(monitor)) { \
642 MONITOR_MAX_VALUE(monitor) = MONITOR_VALUE(monitor);\
646 #define MONITOR_DEC_VALUE(monitor, value) \
647 MONITOR_CHECK_DEFINED(value); \
648 if (MONITOR_IS_ON(monitor)) { \
649 ut_ad(MONITOR_VALUE(monitor) >= (mon_type_t) (value); \
650 MONITOR_VALUE(monitor) -= (mon_type_t) (value); \
651 if (MONITOR_VALUE(monitor) < MONITOR_MIN_VALUE(monitor)) { \
652 MONITOR_MIN_VALUE(monitor) = MONITOR_VALUE(monitor);\
658 #define MONITOR_INC_NOCHECK(monitor) \
660 MONITOR_VALUE(monitor)++; \
661 if (MONITOR_VALUE(monitor) > MONITOR_MAX_VALUE(monitor)) { \
662 MONITOR_MAX_VALUE(monitor) = MONITOR_VALUE(monitor);\
666 #define MONITOR_DEC_NOCHECK(monitor) \
668 MONITOR_VALUE(monitor)--; \
669 if (MONITOR_VALUE(monitor) < MONITOR_MIN_VALUE(monitor)) { \
670 MONITOR_MIN_VALUE(monitor) = MONITOR_VALUE(monitor);\
675 #define MONITOR_SET(monitor, value) \
676 MONITOR_CHECK_DEFINED(value); \
677 if (MONITOR_IS_ON(monitor)) { \
678 MONITOR_VALUE(monitor) = (mon_type_t) (value); \
679 if (MONITOR_VALUE(monitor) > MONITOR_MAX_VALUE(monitor)) { \
680 MONITOR_MAX_VALUE(monitor) = MONITOR_VALUE(monitor);\
682 if (MONITOR_VALUE(monitor) < MONITOR_MIN_VALUE(monitor)) { \
683 MONITOR_MIN_VALUE(monitor) = MONITOR_VALUE(monitor);\
691 #define MONITOR_INC_TIME_IN_MICRO_SECS(monitor, value) \
692 MONITOR_CHECK_DEFINED(value); \
693 if (MONITOR_IS_ON(monitor)) { \
694 ullint old_time = (value); \
695 value = ut_time_us(NULL); \
696 MONITOR_VALUE(monitor) += (mon_type_t) (value - old_time);\
709 #define MONITOR_INC_VALUE_CUMULATIVE( \
710 monitor, monitor_n_calls, monitor_per_call, value) \
711 MONITOR_CHECK_DEFINED(value); \
712 if (MONITOR_IS_ON(monitor)) { \
713 MONITOR_VALUE(monitor_n_calls)++; \
714 MONITOR_VALUE(monitor_per_call) = (mon_type_t) (value); \
715 if (MONITOR_VALUE(monitor_per_call) \
716 > MONITOR_MAX_VALUE(monitor_per_call)) { \
717 MONITOR_MAX_VALUE(monitor_per_call) = \
718 (mon_type_t) (value); \
720 MONITOR_VALUE(monitor) += (mon_type_t) (value); \
721 if (MONITOR_VALUE(monitor) > MONITOR_MAX_VALUE(monitor)) { \
722 MONITOR_MAX_VALUE(monitor) = MONITOR_VALUE(monitor);\
728 #define MONITOR_SET_UPD_MAX_ONLY(monitor, value) \
729 MONITOR_CHECK_DEFINED(value); \
730 if (MONITOR_IS_ON(monitor)) { \
731 MONITOR_VALUE(monitor) = (mon_type_t) (value); \
732 if (MONITOR_VALUE(monitor) > MONITOR_MAX_VALUE(monitor)) { \
733 MONITOR_MAX_VALUE(monitor) = MONITOR_VALUE(monitor);\
739 #define MONITOR_SET_SIMPLE(monitor, value) \
740 MONITOR_CHECK_DEFINED(value); \
741 if (MONITOR_IS_ON(monitor)) { \
742 MONITOR_VALUE(monitor) = (mon_type_t) (value); \
747 #define MONITOR_RESET_ALL(monitor) \
749 MONITOR_VALUE(monitor) = MONITOR_INIT_ZERO_VALUE; \
750 MONITOR_MAX_VALUE(monitor) = MAX_RESERVED; \
751 MONITOR_MIN_VALUE(monitor) = MIN_RESERVED; \
752 MONITOR_VALUE_RESET(monitor) = MONITOR_INIT_ZERO_VALUE; \
753 MONITOR_MAX_VALUE_START(monitor) = MAX_RESERVED; \
754 MONITOR_MIN_VALUE_START(monitor) = MIN_RESERVED; \
755 MONITOR_LAST_VALUE(monitor) = MONITOR_INIT_ZERO_VALUE; \
756 MONITOR_FIELD(monitor, mon_start_time) = \
757 MONITOR_INIT_ZERO_VALUE; \
758 MONITOR_FIELD(monitor, mon_stop_time) = \
759 MONITOR_INIT_ZERO_VALUE; \
760 MONITOR_FIELD(monitor, mon_reset_time) = \
761 MONITOR_INIT_ZERO_VALUE; \
769 #define MONITOR_SAVE_START(monitor, value) do { \
770 MONITOR_CHECK_DEFINED(value); \
771 (MONITOR_START_VALUE(monitor) = \
772 (mon_type_t) (value) - MONITOR_VALUE_RESET(monitor)); \
777 #define MONITOR_SAVE_LAST(monitor) \
779 MONITOR_LAST_VALUE(monitor) = MONITOR_VALUE(monitor); \
780 MONITOR_START_VALUE(monitor) += MONITOR_VALUE(monitor); \
785 #define MONITOR_SET_DIFF(monitor, value) \
786 MONITOR_SET_UPD_MAX_ONLY(monitor, ((value) \
787 - MONITOR_VALUE_RESET(monitor) \
788 - MONITOR_FIELD(monitor, mon_start_value) \
789 + MONITOR_FIELD(monitor, mon_last_value)))
885 #include "srv0mon.ic"
888 # define MONITOR_INC(x) ((void) 0)
889 # define MONITOR_DEC(x) ((void) 0)