summaryrefslogtreecommitdiffstats
path: root/src/H5HFdbg.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2006-03-13 19:47:16 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2006-03-13 19:47:16 (GMT)
commitee3fdc2dbcdf9daaf4e41c085fddd37c1eadbcf9 (patch)
tree7cbd8c5fc545197f4efed76b9c317c817ebf791f /src/H5HFdbg.c
parentc619cf0f518bfea91a34136a1424951eb17b99a4 (diff)
downloadhdf5-ee3fdc2dbcdf9daaf4e41c085fddd37c1eadbcf9.zip
hdf5-ee3fdc2dbcdf9daaf4e41c085fddd37c1eadbcf9.tar.gz
hdf5-ee3fdc2dbcdf9daaf4e41c085fddd37c1eadbcf9.tar.bz2
[svn-r12084] Purpose:
Code checkpoint Description: The fractal heap code is reasonably stable and is passing all its current tests, so checkpoint everything with CVS. Also, add "statistics" module for v2 B-trees code, which is only a stub right now. Platforms tested: FreeBSD 4.11 (sleipnir) Mac OSX (amazon) Linux 2.4 (chicago)
Diffstat (limited to 'src/H5HFdbg.c')
-rw-r--r--src/H5HFdbg.c211
1 files changed, 189 insertions, 22 deletions
diff --git a/src/H5HFdbg.c b/src/H5HFdbg.c
index 2024402..977f40f 100644
--- a/src/H5HFdbg.c
+++ b/src/H5HFdbg.c
@@ -52,7 +52,7 @@
/* Local Prototypes */
/********************/
-static herr_t H5HF_dtable_debug(H5HF_dtable_param_t *dt_param, FILE *stream,
+static herr_t H5HF_dtable_debug(H5HF_dtable_t *dtable, FILE *stream,
int indent, int fwidth);
@@ -85,14 +85,14 @@ static herr_t H5HF_dtable_debug(H5HF_dtable_param_t *dt_param, FILE *stream,
*-------------------------------------------------------------------------
*/
static herr_t
-H5HF_dtable_debug(H5HF_dtable_param_t *dt_param, FILE *stream, int indent, int fwidth)
+H5HF_dtable_debug(H5HF_dtable_t *dtable, FILE *stream, int indent, int fwidth)
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_dtable_debug)
/*
* Check arguments.
*/
- HDassert(dt_param);
+ HDassert(dtable);
HDassert(stream);
HDassert(indent >= 0);
HDassert(fwidth >= 0);
@@ -100,27 +100,50 @@ H5HF_dtable_debug(H5HF_dtable_param_t *dt_param, FILE *stream, int indent, int f
/*
* Print the values.
*/
+ /* Creation parameter values */
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Doubling table width:",
- dt_param->cparam.width);
+ dtable->cparam.width);
HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
"Starting block size:",
- dt_param->cparam.start_block_size);
+ dtable->cparam.start_block_size);
HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
"Max. direct block size:",
- dt_param->cparam.max_direct_size);
+ dtable->cparam.max_direct_size);
HDfprintf(stream, "%*s%-*s %u (bits)\n", indent, "", fwidth,
"Max. index size:",
- dt_param->cparam.max_index);
+ dtable->cparam.max_index);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Starting # of rows in root indirect block:",
- dt_param->cparam.start_root_rows);
+ dtable->cparam.start_root_rows);
+
+ /* Run-time varying parameter values */
HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
"Table's root address:",
- dt_param->table_addr);
+ dtable->table_addr);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Current # of rows in root indirect block:",
- dt_param->curr_root_rows);
+ dtable->curr_root_rows);
+ HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
+ "Next direct block size:",
+ dtable->next_dir_size);
+ HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
+ "Next direct block column:",
+ dtable->next_dir_col);
+
+ /* Computed values */
+ HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
+ "Max. # of rows in root indirect block:",
+ dtable->max_root_indirect_rows);
+ HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
+ "Max. # of direct rows in any indirect block:",
+ dtable->max_direct_rows);
+ HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
+ "# of bits for IDs in first row:",
+ dtable->first_row_bits);
+ HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
+ "# of IDs in first row:",
+ dtable->num_id_first_row);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5HF_dtable_debug() */
@@ -181,15 +204,31 @@ H5HF_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
HDfprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth,
"Min. size of standalone object:",
(unsigned long)shared->standalone_size);
- HDfprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth,
- "Fixed length object size:",
- (unsigned long)shared->fixed_len_size);
- HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
- "Ref. count size:",
- (unsigned)shared->ref_count_size);
+ HDfprintf(stream, "%*s%-*s %u%s\n", indent, "", fwidth,
+ "Ref. count size:",
+ (unsigned)shared->ref_count_size,
+ (shared->ref_count_size == 0 ? " (ref. count not stored)" : ""));
+ HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
+ "Total free space in managed blocks:",
+ shared->total_man_free);
+ HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
+ "Total # of free entries for standalone blocks:",
+ shared->total_std_free);
+ HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
+ "Total data block size:",
+ shared->total_size);
+ HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
+ "Total managed space data block size:",
+ shared->man_size);
+ HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
+ "Total standalone space data block size:",
+ shared->std_size);
+ HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
+ "Number of objects in heap:",
+ shared->nobjs);
HDfprintf(stream, "%*sManaged Objects Doubling-Table Info...\n", indent, "");
- H5HF_dtable_debug(&shared->man_dtable_info, stream, indent + 3, MAX(0, fwidth -3));
+ H5HF_dtable_debug(&shared->man_dtable, stream, indent + 3, MAX(0, fwidth -3));
done:
if(fh && H5AC_unprotect(f, dxpl_id, H5AC_FHEAP_HDR, addr, fh, H5AC__NO_FLAGS_SET) < 0)
@@ -225,7 +264,7 @@ H5HF_dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream,
size_t amount_free = 0; /* Amount of free space in block */
uint8_t *marker = NULL; /* Track free space for block */
size_t overlap; /* Number of free space overlaps */
- size_t u, v; /* Local index variable */
+ size_t u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5HF_dblock_debug, FAIL)
@@ -276,7 +315,7 @@ H5HF_dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream,
dblock->block_off);
blk_prefix_size = H5HF_MAN_ABS_DIRECT_OVERHEAD_DBLOCK(shared, dblock);
HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
- "Size of prefix:",
+ "Size of block header:",
blk_prefix_size);
HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
"Size of block offsets:",
@@ -290,7 +329,7 @@ H5HF_dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream,
/* Check for valid free list */
if(!dblock->free_list)
- if(H5HF_man_dblock_build_freelist(dblock) < 0)
+ if(H5HF_man_dblock_build_freelist(dblock, addr) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTDECODE, FAIL, "can't decode free list for block")
HDassert(dblock->free_list);
@@ -333,8 +372,8 @@ H5HF_dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream,
} /* end while */
HDfprintf(stream, "%*s%-*s %.2f%%\n", indent, "", fwidth,
- "Percent of block used:",
- (100.0 * (double)(dblock->size - (blk_prefix_size + amount_free)) / (double)dblock->size));
+ "Percent of available space for data used:",
+ (100.0 * (double)((dblock->size - blk_prefix_size) - amount_free) / (double)(dblock->size - blk_prefix_size)));
/*
* Print the data in a VMS-style octal dump.
@@ -348,3 +387,131 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HF_dblock_debug() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5HF_iblock_debug
+ *
+ * Purpose: Prints debugging info about a fractal heap indirect block.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@ncsa.uiuc.edu
+ * Mar 7 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5HF_iblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream,
+ int indent, int fwidth, haddr_t hdr_addr, unsigned nrows)
+{
+ H5HF_t *fh = NULL; /* Fractal heap header info */
+ H5HF_shared_t *shared; /* Shared fractal heap information */
+ H5HF_indirect_t *iblock = NULL; /* Fractal heap direct block info */
+ char temp_str[64]; /* Temporary string, for formatting */
+ size_t u, v; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5HF_iblock_debug, FAIL)
+
+ /*
+ * Check arguments.
+ */
+ HDassert(f);
+ HDassert(H5F_addr_defined(addr));
+ HDassert(stream);
+ HDassert(indent >= 0);
+ HDassert(fwidth >= 0);
+ HDassert(H5F_addr_defined(hdr_addr));
+ HDassert(nrows > 0);
+
+ /*
+ * Load the fractal heap header.
+ */
+ if(NULL == (fh = H5AC_protect(f, dxpl_id, H5AC_FHEAP_HDR, hdr_addr, NULL, NULL, H5AC_READ)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap header")
+
+ /* Get the pointer to the shared fractal heap info */
+ shared = H5RC_GET_OBJ(fh->shared);
+ HDassert(shared);
+
+ /*
+ * Load the heap direct block
+ */
+ if(NULL == (iblock = H5AC_protect(f, dxpl_id, H5AC_FHEAP_IBLOCK, addr, &nrows, fh->shared, H5AC_READ)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap indirect block")
+
+ /* Release the heap header */
+ if(H5AC_unprotect(f, dxpl_id, H5AC_FHEAP_HDR, hdr_addr, fh, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release fractal heap header")
+ fh = NULL;
+
+ /* Print opening message */
+ HDfprintf(stream, "%*sFractal Heap Indirect Block...\n", indent, "");
+
+ /*
+ * Print the values.
+ */
+ HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
+ "Address of fractal heap that owns this block:",
+ shared->heap_addr);
+ HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
+ "Offset of indirect block in heap:",
+ iblock->block_off);
+ HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
+ "Size of indirect block:",
+ iblock->size);
+ HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
+ "Total # of rows:",
+ iblock->nrows);
+ HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
+ "# of direct rows:",
+ iblock->ndir_rows);
+ HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
+ "# of indirect rows:",
+ iblock->nindir_rows);
+
+ /* Print the entry tables */
+ HDfprintf(stream, "%*sDirect Block Entries (address, free space):\n", indent, "");
+ for(u = 0; u < iblock->ndir_rows; u++) {
+ sprintf(temp_str, "Row #%u:", (unsigned)u);
+ HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3),
+ temp_str);
+ for(v = 0; v < shared->man_dtable.cparam.width; v++) {
+ size_t off = (u * shared->man_dtable.cparam.width) + v;
+
+ sprintf(temp_str, "Col #%u:", (unsigned)v);
+ HDfprintf(stream, "%*s%-*s %8a, %8Zu\n", indent + 6, "", MAX(0, fwidth - 6),
+ temp_str,
+ iblock->dblock_ents[off].addr,
+ iblock->dblock_ents[off].free_space);
+ } /* end for */
+ } /* end for */
+ HDfprintf(stream, "%*sIndirect Block Entries:\n", indent, "");
+ if(iblock->nindir_rows > 0) {
+ for(u = 0; u < iblock->nindir_rows; u++) {
+ sprintf(temp_str, "Row #%u:", (unsigned)u);
+ HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3),
+ temp_str);
+ for(v = 0; v < shared->man_dtable.cparam.width; v++) {
+ size_t off = (u * shared->man_dtable.cparam.width) + v;
+
+ sprintf(temp_str, "Col #%u:", (unsigned)v);
+ HDfprintf(stream, "%*s%-*s %8a\n", indent + 6, "", MAX(0, fwidth - 6),
+ temp_str,
+ iblock->iblock_ents[off].addr);
+ } /* end for */
+ } /* end for */
+ } /* end if */
+ else
+ HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3),
+ "<none>");
+
+
+done:
+ if(iblock && H5AC_unprotect(f, dxpl_id, H5AC_FHEAP_IBLOCK, addr, iblock, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release fractal heap direct block")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HF_iblock_debug() */
+