From 1a0de8ebd8f82f41b0fa0cb3d172c85a3a24bc3a Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Sun, 27 Nov 2016 20:50:13 -0500 Subject: Updated the format of H5AC/C_dump_cache() to include more information and be easier to read. --- src/H5ACprivate.h | 6 ++++- src/H5Cdbg.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 66 insertions(+), 13 deletions(-) diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 2251af4..19d3657 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -57,7 +57,11 @@ #define H5AC_TAG_SIZE sizeof(haddr_t) #define H5AC_TAG_DEF (H5AC__INVALID_TAG) -/* Types of metadata objects cached */ +/* Types of metadata objects cached + * + * NOTE: If you add types to this enum, please update + * the list of types in type_names_g in H5Cdbg.c! + */ typedef enum { H5AC_BT_ID = 0, /* ( 0) B-tree nodes */ H5AC_SNODE_ID, /* ( 1) symbol table nodes */ diff --git a/src/H5Cdbg.c b/src/H5Cdbg.c index 3961aa4..10c1384 100644 --- a/src/H5Cdbg.c +++ b/src/H5Cdbg.c @@ -72,6 +72,40 @@ herr_t H5C_dump_cache_skip_list(H5C_t *cache_ptr, char *calling_fcn); /* Local Variables */ /*******************/ +/* Constant names for the dump cache function. + * Needs to be kept in sync with the H5AC_type_t enum in H5ACprivate.h! + */ +static const char *type_names_g[] = { + "(H5AC_BT_ID)", /* 0 */ + "(H5AC_SNODE_ID)", /* 1 */ + "(H5AC_LHEAP_PRFX_ID)", /* 2 */ + "(H5AC_LHEAP_DBLK_ID)", /* 3 */ + "(H5AC_GHEAP_ID)", /* 4 */ + "(H5AC_OHDR_ID)", /* 5 */ + "(H5AC_OHDR_CHK_ID)", /* 6 */ + "(H5AC_BT2_HDR_ID)", /* 7 */ + "(H5AC_BT2_INT_ID)", /* 8 */ + "(H5AC_BT2_LEAF_ID)", /* 9 */ + "(H5AC_FHEAP_HDR_ID)", /* 10 */ + "(H5AC_FHEAP_DBLOCK_ID)", /* 11 */ + "(H5AC_FHEAP_IBLOCK_ID)", /* 12 */ + "(H5AC_FSPACE_HDR_ID)", /* 13 */ + "(H5AC_FSPACE_SINFO_ID)", /* 14 */ + "(H5AC_SOHM_TABLE_ID)", /* 15 */ + "(H5AC_SOHM_LIST_ID)", /* 16 */ + "(H5AC_EARRAY_HDR_ID)", /* 17 */ + "(H5AC_EARRAY_IBLOCK_ID)", /* 18 */ + "(H5AC_EARRAY_SBLOCK_ID)", /* 19 */ + "(H5AC_EARRAY_DBLOCK_ID)", /* 20 */ + "(H5AC_EARRAY_DBLK_PAGE_ID)", /* 21 */ + "(H5AC_FARRAY_HDR_ID)", /* 22 */ + "(H5AC_FARRAY_DBLOCK_ID)", /* 23 */ + "(H5AC_FARRAY_DBLK_PAGE_ID)", /* 24 */ + "(H5AC_SUPERBLOCK_ID)", /* 25 */ + "(H5AC_DRVRINFO_ID)", /* 26 */ + "(H5AC_TEST_ID (BADNESS!))", /* 27 */ + "(H5AC_NTYPES (BADNESS!))" /* 28 */ +}; /*------------------------------------------------------------------------- @@ -126,24 +160,39 @@ H5C_dump_cache(H5C_t * cache_ptr, const char * cache_name) * skip list -- scan the skip list generating the desired output. */ - HDfprintf(stdout, "\n\nDump of metadata cache \"%s\".\n", cache_name); - HDfprintf(stdout, - "Num: Addr: Len: Type: Prot: Pinned: Dirty:\n"); + HDfprintf(stdout, "\n\nDump of metadata cache \"%s\"\n", cache_name); + + /* Print header */ + HDfprintf(stdout, "Entry "); + HDfprintf(stdout, "| Address "); + HDfprintf(stdout, "| Tag "); + HDfprintf(stdout, "| Len "); + HDfprintf(stdout, "| Ring "); + HDfprintf(stdout, "| Type "); + HDfprintf(stdout, "| Prot/Pin/Dirty"); + HDfprintf(stdout, "\n"); + + HDfprintf(stdout, "----------------------------------------------------------------------------------------------------------\n"); i = 0; entry_ptr = (H5C_cache_entry_t *)H5SL_remove_first(slist_ptr); while(entry_ptr != NULL) { HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDfprintf(stdout, - "%s%d 0x%16llx 0x%3llx %2d %d %d %d\n", - cache_ptr->prefix, i, - (long long)(entry_ptr->addr), - (long long)(entry_ptr->size), - (int)(entry_ptr->type->id), - (int)(entry_ptr->is_protected), - (int)(entry_ptr->is_pinned), - (int)(entry_ptr->is_dirty)); + /* Print entry */ + HDfprintf(stdout, "%s%5d ", cache_ptr->prefix, i); + HDfprintf(stdout, " 0x%16llx ", (long long)(entry_ptr->addr)); + if(NULL == entry_ptr->tag_info) + HDfprintf(stdout, " %16s ", "N/A"); + else + HDfprintf(stdout, " 0x%16llx ", (long long)(entry_ptr->tag_info->tag)); + HDfprintf(stdout, " %5lld ", (long long)(entry_ptr->size)); + HDfprintf(stdout, " %d ", (int)(entry_ptr->ring)); + HDfprintf(stdout, " %2d %-26s ", (int)(entry_ptr->type->id), type_names_g[(int)(entry_ptr->type->id)]); + HDfprintf(stdout, " %d", (int)(entry_ptr->is_protected)); + HDfprintf(stdout, " %d", (int)(entry_ptr->is_pinned)); + HDfprintf(stdout, " %d", (int)(entry_ptr->is_dirty)); + HDfprintf(stdout, "\n"); /* remove the next (first) item in the skip list */ entry_ptr = (H5C_cache_entry_t *)H5SL_remove_first(slist_ptr); -- cgit v0.12