From 646e232a54d4b0c74cac374f5de50d42cd46a643 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 8 May 2003 12:21:43 -0500 Subject: [svn-r6832] Purpose: Code cleanup Description: Improve file format debugging output. Platforms tested: FreeBSD 4.8 (sleipnir) Triple check not needed --- src/H5HL.c | 28 +++++++++++++++------------- src/H5O.c | 4 ++-- src/H5Ofill.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 73 insertions(+), 16 deletions(-) diff --git a/src/H5HL.c b/src/H5HL.c index 2284984..6f5ea8a 100644 --- a/src/H5HL.c +++ b/src/H5HL.c @@ -1170,7 +1170,7 @@ herr_t H5HL_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, int fwidth) { H5HL_t *h = NULL; - int i, j, overlap; + int i, j, overlap, free_block; uint8_t c; H5HL_free_t *freelist = NULL; uint8_t *marker = NULL; @@ -1198,12 +1198,12 @@ H5HL_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, int HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Address of heap data:", h->addr); - fprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Data bytes allocated on disk:", - (unsigned long) (h->disk_alloc)); - fprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth, + h->disk_alloc); + HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Data bytes allocated in core:", - (unsigned long) (h->mem_alloc)); + h->mem_alloc); /* * Traverse the free list and check that all free blocks fall within @@ -1212,11 +1212,14 @@ H5HL_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, int */ if (NULL==(marker = H5MM_calloc(h->mem_alloc))) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); - for (freelist = h->freelist; freelist; freelist = freelist->next) { - fprintf(stream, "%*s%-*s %8lu, %8lu\n", indent, "", fwidth, - "Free Block (offset,size):", - (unsigned long) (freelist->offset), - (unsigned long) (freelist->size)); + fprintf(stream, "%*sFree Blocks (offset, size):\n", indent, ""); + for (free_block=0, freelist = h->freelist; freelist; freelist = freelist->next, free_block++) { + char temp_str[32]; + + sprintf(temp_str,"Block #%d:",free_block); + HDfprintf(stream, "%*s%-*s %8Zu, %8Zu\n", indent+3, "", MAX(0,fwidth-9), + temp_str, + freelist->offset, freelist->size); if (freelist->offset + freelist->size > h->mem_alloc) { fprintf(stream, "***THAT FREE BLOCK IS OUT OF BOUNDS!\n"); } else { @@ -1235,10 +1238,9 @@ H5HL_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, int } if (h->mem_alloc) { - fprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth, + fprintf(stream, "%*s%-*s %.2f%%\n", indent, "", fwidth, "Percent of heap used:", - (unsigned long) (100 * (h->mem_alloc - amount_free) / - h->mem_alloc)); + (100.0 * (double)(h->mem_alloc - amount_free) / (double)h->mem_alloc)); } /* * Print the data in a VMS-style octal dump. diff --git a/src/H5O.c b/src/H5O.c index 814eda3..573222a 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -3355,14 +3355,14 @@ H5O_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int f } /* message name and size */ - HDfprintf(stream, "%*s%-*s 0x%04x %s(%d)\n", + HDfprintf(stream, "%*s%-*s 0x%04x `%s' (%d)\n", indent + 3, "", MAX(0, fwidth - 3), "Message ID (sequence number):", (unsigned) (oh->mesg[i].type->id), oh->mesg[i].type->name, sequence[oh->mesg[i].type->id]++); HDfprintf (stream, "%*s%-*s %s\n", indent+3, "", MAX (0, fwidth-3), - "Shared message:", + "Shared:", (oh->mesg[i].flags & H5O_FLAG_SHARED) ? "Yes" : "No"); HDfprintf(stream, "%*s%-*s %s\n", indent + 3, "", MAX(0, fwidth - 3), "Constant:", diff --git a/src/H5Ofill.c b/src/H5Ofill.c index 6f94d01..210b2de 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -693,8 +693,63 @@ H5O_fill_new_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FIL assert(indent>=0); assert(fwidth>=0); + HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Version:", (unsigned)H5O_FILL_VERSION); + fprintf(stream, "%*s%-*s ", indent, "", fwidth, "Space Allocation Time:"); + switch(mesg->alloc_time) { + case H5D_ALLOC_TIME_EARLY: + fprintf(stream,"Early\n"); + break; + + case H5D_ALLOC_TIME_LATE: + fprintf(stream,"Late\n"); + break; + + case H5D_ALLOC_TIME_INCR: + fprintf(stream,"Incremental\n"); + break; + + default: + fprintf(stream,"Unknown!\n"); + break; + + } /* end switch */ + fprintf(stream, "%*s%-*s ", indent, "", fwidth, "Fill Time:"); + switch(mesg->fill_time) { + case H5D_FILL_TIME_ALLOC: + fprintf(stream,"On Allocation\n"); + break; + + case H5D_FILL_TIME_NEVER: + fprintf(stream,"Never\n"); + break; + + default: + fprintf(stream,"Unknown!\n"); + break; + + } /* end switch */ + fprintf(stream, "%*s%-*s ", indent, "", fwidth, "Fill Value Defined:"); + switch(mesg->fill_time) { + case H5D_FILL_VALUE_UNDEFINED: + fprintf(stream,"Undefined\n"); + break; + + case H5D_FILL_VALUE_DEFAULT: + fprintf(stream,"Default\n"); + break; + + case H5D_FILL_VALUE_USER_DEFINED: + fprintf(stream,"User Defined\n"); + break; + + default: + fprintf(stream,"Unknown!\n"); + break; + + } /* end switch */ HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, - "Bytes:", mesg->size); + "Size:", mesg->size); fprintf(stream, "%*s%-*s ", indent, "", fwidth, "Data type:"); if (mesg->type) { H5T_debug(mesg->type, stream); -- cgit v0.12