summaryrefslogtreecommitdiffstats
path: root/src/H5HL.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2003-05-08 17:21:43 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2003-05-08 17:21:43 (GMT)
commit646e232a54d4b0c74cac374f5de50d42cd46a643 (patch)
tree525a1048b8ee96740f03beb7b027ab909e96c1ba /src/H5HL.c
parent55dbd8d92a0d2d1dd9c56eef89d9e1981dddde22 (diff)
downloadhdf5-646e232a54d4b0c74cac374f5de50d42cd46a643.zip
hdf5-646e232a54d4b0c74cac374f5de50d42cd46a643.tar.gz
hdf5-646e232a54d4b0c74cac374f5de50d42cd46a643.tar.bz2
[svn-r6832] Purpose:
Code cleanup Description: Improve file format debugging output. Platforms tested: FreeBSD 4.8 (sleipnir) Triple check not needed
Diffstat (limited to 'src/H5HL.c')
-rw-r--r--src/H5HL.c28
1 files changed, 15 insertions, 13 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.