From c9d8f3e4f145bfdbdf72579075999ed0b84275c7 Mon Sep 17 00:00:00 2001 From: David Young Date: Wed, 15 Jul 2020 16:44:52 -0500 Subject: Log the number of page-buffer accesses at various multiples of the page size with log outlet `pb_access_sizes`. --- src/H5PB.c | 42 ++++++++++++++++++++++++++++++++++++++++++ src/H5PBprivate.h | 1 + 2 files changed, 43 insertions(+) diff --git a/src/H5PB.c b/src/H5PB.c index b0aae86..794e6ed 100644 --- a/src/H5PB.c +++ b/src/H5PB.c @@ -122,6 +122,8 @@ static herr_t metadata_multipart_read(H5F_shared_t *, H5FD_mem_t, haddr_t, static herr_t metadata_multipart_write(H5F_shared_t *, H5FD_mem_t, haddr_t, size_t, const void *); +static void H5PB_log_access_by_size_counts(const H5PB_t *); + /*********************/ /* Package Variables */ /*********************/ @@ -148,6 +150,7 @@ H5FL_DEFINE_STATIC(H5PB_entry_t); HLOG_OUTLET_DECL(pagebuffer); HLOG_OUTLET_SHORT_DEFN(pagebuffer, all); +HLOG_OUTLET_SHORT_DEFN(pb_access_sizes, pagebuffer); HLOG_OUTLET_SHORT_DEFN(pbflush, pagebuffer); HLOG_OUTLET_SHORT_DEFN(pbflush_entry, pbflush); HLOG_OUTLET_SHORT_DEFN(pbio, pagebuffer); @@ -714,6 +717,8 @@ H5PB_dest(H5F_shared_t *shared) pb_ptr = shared->pb_ptr; + H5PB_log_access_by_size_counts(pb_ptr); + HDassert(pb_ptr->magic == H5PB__H5PB_T_MAGIC); /* the current implementation if very inefficient, and will @@ -913,6 +918,37 @@ done: } /* H5PB_page_exists */ +static void +H5PB_count_access_by_size(H5PB_t *pb, size_t size) +{ + const size_t nslots = NELMTS(pb->access_size_count); + size_t i, hi; + + for (hi = pb->page_size, i = 0; i < nslots - 1; i++, hi *= 2){ + if (size <= hi) + break; + } + pb->access_size_count[i]++; +} + +static void +H5PB_log_access_by_size_counts(const H5PB_t *pb) +{ + const size_t nslots = NELMTS(pb->access_size_count); + size_t i, lo, hi; + + for (lo = 0, hi = pb->page_size, i = 0; + i < nslots - 1; + i++, lo = hi + 1, hi *= 2) { + hlog_fast(pb_access_sizes, + "%p %16" PRIu64 " accesses %8zu - %8zu bytes long", + (const void *)pb, pb->access_size_count[i], lo, hi); + } + hlog_fast(pb_access_sizes, + "%p %16" PRIu64 " accesses %8zu - greater bytes long", + (const void *)pb, pb->access_size_count[i], lo); +} + /*------------------------------------------------------------------------- * @@ -1072,6 +1108,9 @@ H5PB_read(H5F_shared_t *shared, H5FD_mem_t type, haddr_t addr, size_t size, pb_ptr = shared->pb_ptr; + if (pb_ptr != NULL) + H5PB_count_access_by_size(pb_ptr, size); + HDassert(pb_ptr == NULL || pb_ptr->magic == H5PB__H5PB_T_MAGIC); /* Bypass the page buffer in case @@ -1956,6 +1995,9 @@ H5PB_write(H5F_shared_t *shared, H5FD_mem_t type, haddr_t addr, size_t size, pb_ptr = shared->pb_ptr; + if (pb_ptr != NULL) + H5PB_count_access_by_size(pb_ptr, size); + if ( pb_ptr == NULL ) { bypass_pb = TRUE; /* case 1) -- page buffer is disabled */ diff --git a/src/H5PBprivate.h b/src/H5PBprivate.h index 6b879c7..983d183 100644 --- a/src/H5PBprivate.h +++ b/src/H5PBprivate.h @@ -610,6 +610,7 @@ typedef struct H5PB_t { int64_t flushes[H5PB__NUM_STAT_TYPES]; int64_t evictions[H5PB__NUM_STAT_TYPES]; int64_t clears[H5PB__NUM_STAT_TYPES]; + uint64_t access_size_count[6]; int64_t max_lru_len; int64_t max_lru_size; int64_t lru_md_skips; -- cgit v0.12