From 06806a27655c2bf776156bf7fbfc260f80c24a3a Mon Sep 17 00:00:00 2001 From: David Young Date: Wed, 25 Sep 2019 11:02:40 -0500 Subject: Add to the page buffer a local printf-like debug function that I can turn on and off. Use it here and there. --- src/H5PB.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/H5PB.c b/src/H5PB.c index 086efd7..29dda96 100644 --- a/src/H5PB.c +++ b/src/H5PB.c @@ -112,6 +112,7 @@ static herr_t H5PB__write_meta(H5F_t *f, H5FD_mem_t type, haddr_t addr, static herr_t H5PB__write_raw(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf/*out*/); +static void ldbgf(const char *, ...) H5_ATTR_FORMAT(printf, 1, 2); /*********************/ /* Package Variables */ @@ -137,6 +138,22 @@ H5FL_DEFINE_STATIC(H5PB_t); /* Declare a free list to manage the H5PB_entry_t struct */ H5FL_DEFINE_STATIC(H5PB_entry_t); +static const bool ldbg_enabled = false; + +static void +ldbgf(const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + + if (!ldbg_enabled) + return; + + (void)vprintf(fmt, ap); + + va_end(ap); +} /*------------------------------------------------------------------------- @@ -813,6 +830,8 @@ H5PB_flush(H5F_t *f) flush_ptr = entry_ptr; entry_ptr = entry_ptr->ht_next; + ldbgf("%s: visiting %zu-byte page %" PRIu64 "\n", + __func__, flush_ptr->size, flush_ptr->page); if ( flush_ptr->is_dirty ) { @@ -2467,6 +2486,9 @@ H5PB__flush_entry(H5F_t *f, H5PB_t *pb_ptr, H5PB_entry_t *entry_ptr) HDassert((pb_ptr->vfd_swmr_writer) || (!(entry_ptr->is_mpmde))); HDassert(0 == entry_ptr->delay_write_until); + ldbgf("%s: flushing %zu-byte page %" PRIu64 " @ %ju\n", + __func__, entry_ptr->size, entry_ptr->page, (uintmax_t)entry_ptr->addr); + /* Retrieve the 'eoa' for the file */ if ( HADDR_UNDEF == (eoa = H5F_get_eoa(f, entry_ptr->mem_type)) ) -- cgit v0.12