Move cache image macros (#2732)

* Move cache image stats macros to cache image source file

* Disable formatting on the macros
This commit is contained in:
Quincey Koziol 2023-04-14 07:55:06 -05:00 committed by GitHub
parent 2cb733ff1b
commit 2ad5a25243
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 42 additions and 33 deletions

View File

@ -80,6 +80,48 @@
/* Maximum ring allowed in image */ /* Maximum ring allowed in image */
#define H5C_MAX_RING_IN_IMAGE H5C_RING_MDFSM #define H5C_MAX_RING_IN_IMAGE H5C_RING_MDFSM
/***********************************************************************
*
* Stats collection macros
*
* The following macros must handle stats collection when collection
* is enabled, and evaluate to the empty string when it is not.
*
***********************************************************************/
#if H5C_COLLECT_CACHE_STATS
/* clang-format off */
#define H5C__UPDATE_STATS_FOR_CACHE_IMAGE_CREATE(cache_ptr) \
(cache_ptr)->images_created++;
#define H5C__UPDATE_STATS_FOR_CACHE_IMAGE_READ(cache_ptr) \
{ \
/* make sure image len is still good */ \
HDassert((cache_ptr)->image_len > 0); \
(cache_ptr)->images_read++; \
}
#define H5C__UPDATE_STATS_FOR_CACHE_IMAGE_LOAD(cache_ptr) \
{ \
/* make sure image len is still good */ \
HDassert((cache_ptr)->image_len > 0); \
(cache_ptr)->images_loaded++; \
(cache_ptr)->last_image_size = (cache_ptr)->image_len; \
}
#define H5C__UPDATE_STATS_FOR_PREFETCH(cache_ptr, dirty) \
{ \
(cache_ptr)->prefetches++; \
if (dirty) \
(cache_ptr)->dirty_prefetches++; \
}
#define H5C__UPDATE_STATS_FOR_PREFETCH_HIT(cache_ptr) \
(cache_ptr)->prefetch_hits++;
/* clang-format on */
#else /* H5C_COLLECT_CACHE_STATS */
#define H5C__UPDATE_STATS_FOR_CACHE_IMAGE_CREATE(cache_ptr)
#define H5C__UPDATE_STATS_FOR_CACHE_IMAGE_READ(cache_ptr)
#define H5C__UPDATE_STATS_FOR_CACHE_IMAGE_LOAD(cache_ptr)
#define H5C__UPDATE_STATS_FOR_PREFETCH(cache_ptr, dirty)
#define H5C__UPDATE_STATS_FOR_PREFETCH_HIT(cache_ptr)
#endif /* H5C_COLLECT_CACHE_STATS */
/******************/ /******************/
/* Local Typedefs */ /* Local Typedefs */
/******************/ /******************/

View File

@ -596,34 +596,6 @@ if ( ( ( ( (head_ptr) == NULL ) || ( (tail_ptr) == NULL ) ) && \
#define H5C__UPDATE_STATS_FOR_INDEX_SCAN_RESTART(cache_ptr) \ #define H5C__UPDATE_STATS_FOR_INDEX_SCAN_RESTART(cache_ptr) \
(cache_ptr)->index_scan_restarts++; (cache_ptr)->index_scan_restarts++;
#define H5C__UPDATE_STATS_FOR_CACHE_IMAGE_CREATE(cache_ptr) \
(cache_ptr)->images_created++;
#define H5C__UPDATE_STATS_FOR_CACHE_IMAGE_READ(cache_ptr) \
{ \
/* make sure image len is still good */ \
HDassert((cache_ptr)->image_len > 0); \
(cache_ptr)->images_read++; \
}
#define H5C__UPDATE_STATS_FOR_CACHE_IMAGE_LOAD(cache_ptr) \
{ \
/* make sure image len is still good */ \
HDassert((cache_ptr)->image_len > 0); \
(cache_ptr)->images_loaded++; \
(cache_ptr)->last_image_size = (cache_ptr)->image_len; \
}
#define H5C__UPDATE_STATS_FOR_PREFETCH(cache_ptr, dirty) \
{ \
(cache_ptr)->prefetches++; \
if (dirty) \
(cache_ptr)->dirty_prefetches++; \
}
#define H5C__UPDATE_STATS_FOR_PREFETCH_HIT(cache_ptr) \
(cache_ptr)->prefetch_hits++;
#if H5C_COLLECT_CACHE_ENTRY_STATS #if H5C_COLLECT_CACHE_ENTRY_STATS
#define H5C__RESET_CACHE_ENTRY_STATS(entry_ptr) \ #define H5C__RESET_CACHE_ENTRY_STATS(entry_ptr) \
@ -831,11 +803,6 @@ if ( ( ( ( (head_ptr) == NULL ) || ( (tail_ptr) == NULL ) ) && \
#define H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr) #define H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr)
#define H5C__UPDATE_STATS_FOR_LRU_SCAN_RESTART(cache_ptr) #define H5C__UPDATE_STATS_FOR_LRU_SCAN_RESTART(cache_ptr)
#define H5C__UPDATE_STATS_FOR_INDEX_SCAN_RESTART(cache_ptr) #define H5C__UPDATE_STATS_FOR_INDEX_SCAN_RESTART(cache_ptr)
#define H5C__UPDATE_STATS_FOR_CACHE_IMAGE_CREATE(cache_ptr)
#define H5C__UPDATE_STATS_FOR_CACHE_IMAGE_READ(cache_ptr)
#define H5C__UPDATE_STATS_FOR_CACHE_IMAGE_LOAD(cache_ptr)
#define H5C__UPDATE_STATS_FOR_PREFETCH(cache_ptr, dirty)
#define H5C__UPDATE_STATS_FOR_PREFETCH_HIT(cache_ptr)
#endif /* H5C_COLLECT_CACHE_STATS */ #endif /* H5C_COLLECT_CACHE_STATS */