diff options
author | Quincey Koziol <quincey@koziol.cc> | 2023-04-14 12:55:06 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-14 12:55:06 (GMT) |
commit | 2ad5a25243273b255b4860a2e37a113b01bd3552 (patch) | |
tree | faf74eda88dcc9bac6eff17d2ade1bd514b67440 | |
parent | 2cb733ff1b160be46f1f271d18ce1b2ec12363e0 (diff) | |
download | hdf5-2ad5a25243273b255b4860a2e37a113b01bd3552.zip hdf5-2ad5a25243273b255b4860a2e37a113b01bd3552.tar.gz hdf5-2ad5a25243273b255b4860a2e37a113b01bd3552.tar.bz2 |
Move cache image macros (#2732)
* Move cache image stats macros to cache image source file
* Disable formatting on the macros
-rw-r--r-- | src/H5Cimage.c | 42 | ||||
-rw-r--r-- | src/H5Cpkg.h | 33 |
2 files changed, 42 insertions, 33 deletions
diff --git a/src/H5Cimage.c b/src/H5Cimage.c index 105272c..b8f46f1 100644 --- a/src/H5Cimage.c +++ b/src/H5Cimage.c @@ -80,6 +80,48 @@ /* Maximum ring allowed in image */ #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 */ /******************/ diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h index ddecc91..a0acc66 100644 --- a/src/H5Cpkg.h +++ b/src/H5Cpkg.h @@ -596,34 +596,6 @@ if ( ( ( ( (head_ptr) == NULL ) || ( (tail_ptr) == NULL ) ) && \ #define H5C__UPDATE_STATS_FOR_INDEX_SCAN_RESTART(cache_ptr) \ (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 #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_LRU_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 */ |