diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2008-09-22 15:22:03 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2008-09-22 15:22:03 (GMT) |
commit | 00bd6ae9c27f520b4badbe0698ea1a1e1044f305 (patch) | |
tree | 0ca87cd3b1254b3faa9fbcbea2e76d4248f9ffb9 /src/H5EAdbg.c | |
parent | 0402e025278dbd5ac463ce27805231d5302def1d (diff) | |
download | hdf5-00bd6ae9c27f520b4badbe0698ea1a1e1044f305.zip hdf5-00bd6ae9c27f520b4badbe0698ea1a1e1044f305.tar.gz hdf5-00bd6ae9c27f520b4badbe0698ea1a1e1044f305.tar.bz2 |
[svn-r15674] Description:
Add base support for extensible array "data blocks" to code, tests and
h5debug.
Tested on:
Mac OS X/32 10.5.4 (amazon) in debug mode
Mac OS X/32 10.5.4 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Diffstat (limited to 'src/H5EAdbg.c')
-rw-r--r-- | src/H5EAdbg.c | 134 |
1 files changed, 127 insertions, 7 deletions
diff --git a/src/H5EAdbg.c b/src/H5EAdbg.c index c75ced7..26c1070 100644 --- a/src/H5EAdbg.c +++ b/src/H5EAdbg.c @@ -131,7 +131,7 @@ H5EA__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, "Native Element Size (on this platform):", hdr->cls->nat_elmt_size); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Log2(Max. # of elements in array):", + "# of elements in index block:", (unsigned)hdr->idx_blk_elmts); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Min. # of elements per data block:", @@ -141,7 +141,16 @@ H5EA__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, (unsigned)hdr->sup_blk_min_data_ptrs); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, "Highest element index stored (+1):", - hdr->max_idx_set); + hdr->stats.max_idx_set); + HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + "Number of super blocks created:", + hdr->stats.nsuper_blks); + HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + "Number of data blocks created:", + hdr->stats.ndata_blks); + HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + "Number of elements 'realized':", + hdr->stats.nelmts); HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Index Block Address:", hdr->idx_blk_addr); @@ -206,27 +215,138 @@ H5EA__iblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int inde HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Index Block size:", iblock->size); + HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, + "# of data block addresses in index block:", + iblock->ndblk_addrs); + HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, + "# of super block addresses in index block:", + iblock->nsblk_addrs); - /* Check if there are any elements in array */ - if(hdr->max_idx_set > 0) { + /* Check if there are any elements in index block */ + if(hdr->idx_blk_elmts > 0) { unsigned u; /* Local index variable */ /* Print the elements in the index block */ HDfprintf(stream, "%*sElements in Index Block:\n", indent, ""); - for(u = 0; u < MIN(hdr->idx_blk_elmts, hdr->max_idx_set); u++) { + for(u = 0; u < hdr->idx_blk_elmts; u++) { /* Call the class's 'debug' callback */ - if((hdr->cls->debug)(stream, (indent + 6), MAX(0, (fwidth - 6)), + if((hdr->cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)), (hsize_t)u, ((uint8_t *)iblock->elmts) + (hdr->cls->nat_elmt_size * u)) < 0) H5E_THROW(H5E_CANTGET, "can't get element for debugging") } /* end for */ } /* end if */ + /* Check if there are any data block addresses in index block */ + if(iblock->ndblk_addrs > 0) { + char temp_str[128]; /* Temporary string, for formatting */ + unsigned u; /* Local index variable */ + + /* Print the data block addresses in the index block */ + HDfprintf(stream, "%*sData Block Addresses in Index Block:\n", indent, ""); + for(u = 0; u < iblock->ndblk_addrs; u++) { + /* Print address */ + sprintf(temp_str, "Address #%u:", u); + HDfprintf(stream, "%*s%-*s %a\n", (indent + 3), "", MAX(0, (fwidth - 3)), + temp_str, + iblock->dblk_addrs[u]); + } /* end for */ + } /* end if */ + + /* Check if there are any super block addresses in index block */ + if(iblock->nsblk_addrs > 0) { + char temp_str[128]; /* Temporary string, for formatting */ + unsigned u; /* Local index variable */ + + /* Print the super block addresses in the index block */ + HDfprintf(stream, "%*sSuper Block Addresses in Index Block:\n", indent, ""); + for(u = 0; u < iblock->nsblk_addrs; u++) { + /* Print address */ + sprintf(temp_str, "Address #%u:", u); + HDfprintf(stream, "%*s%-*s %a\n", (indent + 3), "", MAX(0, (fwidth - 3)), + temp_str, + iblock->sblk_addrs[u]); + } /* end for */ + } /* end if */ + CATCH if(iblock && H5EA__iblock_unprotect(iblock, dxpl_id, H5AC__NO_FLAGS_SET) < 0) H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array index block") if(hdr && H5AC_unprotect(f, dxpl_id, H5AC_EARRAY_HDR, hdr_addr, hdr, H5AC__NO_FLAGS_SET) < 0) H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header") -END_FUNC(PKG) /* end H5EA__hdr_debug() */ +END_FUNC(PKG) /* end H5EA__iblock_debug() */ + + +/*------------------------------------------------------------------------- + * Function: H5EA__dblock_debug + * + * Purpose: Prints debugging info about a extensible array data block. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Sep 22 2008 + * + *------------------------------------------------------------------------- + */ +BEGIN_FUNC(PKG, ERR, +herr_t, SUCCEED, FAIL, +H5EA__dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, + int fwidth, const H5EA_class_t *cls, haddr_t hdr_addr, size_t dblk_nelmts)) + + /* Local variables */ + H5EA_hdr_t *hdr = NULL; /* Shared extensible array header */ + H5EA_dblock_t *dblock = NULL; /* Extensible array data block */ + size_t u; /* Local index variable */ + + /* Check arguments */ + HDassert(f); + HDassert(H5F_addr_defined(addr)); + HDassert(stream); + HDassert(indent >= 0); + HDassert(fwidth >= 0); + HDassert(cls); + HDassert(H5F_addr_defined(hdr_addr)); + HDassert(dblk_nelmts > 0); + + /* Load the extensible array header */ + if(NULL == (hdr = (H5EA_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_EARRAY_HDR, hdr_addr, cls, NULL, H5AC_READ))) + H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header") + + /* Protect data block */ + if(NULL == (dblock = H5EA__dblock_protect(hdr, dxpl_id, addr, (size_t)dblk_nelmts, H5AC_READ))) + H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu", (unsigned long_long)addr) + + /* Print opening message */ + HDfprintf(stream, "%*sExtensible Array data Block...\n", indent, ""); + + /* Print the values */ + HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + "Array class ID:", + (hdr->cls->id == H5EA_CLS_TEST_ID ? "H5EA_CLS_TEST_ID" : + "Unknown!")); + HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, + "Data Block size:", + dblock->size); + + + /* Print the elements in the index block */ + HDfprintf(stream, "%*sElements:\n", indent, ""); + for(u = 0; u < dblk_nelmts; u++) { + /* Call the class's 'debug' callback */ + if((hdr->cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)), + (hsize_t)u, + ((uint8_t *)dblock->elmts) + (hdr->cls->nat_elmt_size * u)) < 0) + H5E_THROW(H5E_CANTGET, "can't get element for debugging") + } /* end for */ + +CATCH + if(dblock && H5EA__dblock_unprotect(dblock, dxpl_id, H5AC__NO_FLAGS_SET) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array data block") + if(hdr && H5AC_unprotect(f, dxpl_id, H5AC_EARRAY_HDR, hdr_addr, hdr, H5AC__NO_FLAGS_SET) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header") + +END_FUNC(PKG) /* end H5EA__dblock_debug() */ |