summaryrefslogtreecommitdiffstats
path: root/tools/h5stat
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2009-10-02 02:08:59 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2009-10-02 02:08:59 (GMT)
commit37ec6dc75e85ebd7f9fb9b32fe978e47ab3fe918 (patch)
tree387658306d99e60d807c2eb8b3888a12aca4a75f /tools/h5stat
parent006071f2338faa14f2784562279cb78b4341bce0 (diff)
downloadhdf5-37ec6dc75e85ebd7f9fb9b32fe978e47ab3fe918.zip
hdf5-37ec6dc75e85ebd7f9fb9b32fe978e47ab3fe918.tar.gz
hdf5-37ec6dc75e85ebd7f9fb9b32fe978e47ab3fe918.tar.bz2
[svn-r17582] Description:
Bring changes from file free space branch back to the trunk. *yay!* Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x, 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 debug mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode Mac OS X/32 10.5.8 (amazon) in debug mode Mac OS X/32 10.5.8 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode
Diffstat (limited to 'tools/h5stat')
-rw-r--r--tools/h5stat/h5stat.c321
-rw-r--r--tools/h5stat/h5stat_gentest.c24
-rw-r--r--tools/h5stat/testfiles/h5stat_filters-F.ddl21
-rw-r--r--tools/h5stat/testfiles/h5stat_filters-d.ddl3
-rw-r--r--tools/h5stat/testfiles/h5stat_filters-dT.ddl3
-rw-r--r--tools/h5stat/testfiles/h5stat_filters.ddl28
-rw-r--r--tools/h5stat/testfiles/h5stat_help1.ddl3
-rw-r--r--tools/h5stat/testfiles/h5stat_help2.ddl3
-rw-r--r--tools/h5stat/testfiles/h5stat_newgrat.ddl38
-rw-r--r--tools/h5stat/testfiles/h5stat_newgrat.h5bin6363081 -> 6367669 bytes
-rw-r--r--tools/h5stat/testfiles/h5stat_tsohm.ddl26
11 files changed, 393 insertions, 77 deletions
diff --git a/tools/h5stat/h5stat.c b/tools/h5stat/h5stat.c
index f5537e1..30ad0a1 100644
--- a/tools/h5stat/h5stat.c
+++ b/tools/h5stat/h5stat.c
@@ -26,6 +26,7 @@
#define SIZE_SMALL_GROUPS 10
#define SIZE_SMALL_ATTRS 10
#define SIZE_SMALL_DSETS 10
+#define SIZE_SMALL_SECTS 10
#define H5_NFILTERS_IMPL 8 /* Number of currently implemented filters + one to
accommodate for user-define filters + one
@@ -48,7 +49,7 @@ typedef struct ohdr_info_t {
/* Info to pass to the iteration functions */
typedef struct iter_t {
hid_t fid; /* File ID */
-
+ hsize_t filesize; /* Size of the file */
unsigned long uniq_groups; /* Number of unique groups */
unsigned long uniq_dsets; /* Number of unique datasets */
unsigned long uniq_dtypes; /* Number of unique named datatypes */
@@ -79,6 +80,7 @@ typedef struct iter_t {
unsigned long *dset_dim_bins; /* Pointer to array of bins for dataset dimensions */
ohdr_info_t dset_ohdr_info; /* Object header information for datasets */
hsize_t dset_storage_size; /* Size of raw data for datasets */
+ hsize_t dset_external_storage_size; /* Size of raw data for datasets with external storage */
ohdr_info_t dtype_ohdr_info; /* Object header information for datatypes */
hsize_t groups_btree_storage_size; /* btree size for group */
hsize_t groups_heap_storage_size; /* heap size for group */
@@ -87,8 +89,16 @@ typedef struct iter_t {
hsize_t SM_hdr_storage_size; /* header size for SOHM table (1.8) */
hsize_t SM_index_storage_size; /* index (btree & list) size for SOHM table (1.8) */
hsize_t SM_heap_storage_size; /* fractal heap size for SOHM table (1.8) */
+ hsize_t super_size; /* superblock size */
hsize_t super_ext_size; /* superblock extension size */
+ hsize_t ublk_size; /* user block size (if exists) */
+ hsize_t free_space; /* amount of freespace in the file */
+ hsize_t free_hdr; /* free space manager header in the file */
+ unsigned long num_small_sects[SIZE_SMALL_SECTS]; /* Size of small free-space sections */
+ unsigned sect_nbins; /* Number of bins for free-space section sizes */
+ unsigned long *sect_bins; /* Pointer to array of bins for free-space section sizes */
hsize_t datasets_index_storage_size;/* meta size for chunked dataset's indexing type */
+ hsize_t datasets_heap_storage_size; /* heap size for dataset with external storage */
unsigned long nexternal; /* Number of external files for a dataset */
int local; /* Flag to indicate iteration over the object*/
} iter_t;
@@ -104,6 +114,8 @@ static int display_dset = FALSE;
static int display_dtype_metadata = FALSE;
static int display_object = FALSE;
static int display_attr = FALSE;
+static int display_free_sections = FALSE;
+static int display_summary = FALSE;
/* a structure for handling the order command-line parameters come in */
struct handler_t {
@@ -111,7 +123,7 @@ struct handler_t {
};
-static const char *s_opts ="ADdFfhGgTO:V";
+static const char *s_opts ="ADdFfhGgsSTO:V";
static struct long_options l_opts[] = {
{"help", no_arg, 'h'},
{"hel", no_arg, 'h'},
@@ -179,6 +191,20 @@ static struct long_options l_opts[] = {
{ "att", no_arg, 'A' },
{ "at", no_arg, 'A' },
{ "a", no_arg, 'A' },
+ { "freespace", no_arg, 's' },
+ { "freespac", no_arg, 's' },
+ { "freespa", no_arg, 's' },
+ { "freesp", no_arg, 's' },
+ { "frees", no_arg, 's' },
+ { "free", no_arg, 's' },
+ { "fre", no_arg, 's' },
+ { "fr", no_arg, 's' },
+ { "summary", no_arg, 'S' },
+ { "summar", no_arg, 'S' },
+ { "summa", no_arg, 'S' },
+ { "summ", no_arg, 'S' },
+ { "sum", no_arg, 'S' },
+ { "su", no_arg, 'S' },
{ NULL, 0, '\0' }
};
@@ -206,7 +232,8 @@ static void usage(const char *prog)
fprintf(stdout, " -D, --dsetmetadata Print dataset metadata\n");
fprintf(stdout, " -T, --dtypemetadata Print datatype metadata\n");
fprintf(stdout, " -A, --attribute Print attribute information\n");
- fprintf(stdout, "\n");
+ fprintf(stdout, " -s, --freespace Print free-space information\n");
+ fprintf(stdout, " -S, --Summary Print summary of storage information\n");
}
@@ -415,6 +442,7 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
/* Update dataset metadata info */
iter->datasets_index_storage_size += oi->meta_size.obj.index_size;
+ iter->datasets_heap_storage_size += oi->meta_size.obj.heap_size;
/* Update attribute metadata info */
ret = attribute_stats(iter, oi);
@@ -422,7 +450,32 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
/* Get storage info */
storage = H5Dget_storage_size(did);
- iter->dset_storage_size += storage;
+
+ /* Gather layout statistics */
+ dcpl = H5Dget_create_plist(did);
+ assert(dcpl > 0);
+
+ lout = H5Pget_layout(dcpl);
+ assert(lout >= 0);
+
+ /* Object header's total size for H5D_COMPACT layout includes raw data size */
+ /* "storage" also includes H5D_COMPACT raw data size */
+ if(lout == H5D_COMPACT)
+ iter->dset_ohdr_info.total_size -= storage;
+
+ /* Track the layout type for dataset */
+ (iter->dset_layouts[lout])++;
+
+ /* Get the number of external files for the dataset */
+ num_ext = H5Pget_external_count(dcpl);
+ assert (num_ext >= 0);
+
+ /* Accumulate raw data size accordingly */
+ if(num_ext) {
+ iter->nexternal += (unsigned long)num_ext;
+ iter->dset_external_storage_size += (unsigned long)storage;
+ } else
+ iter->dset_storage_size += storage;
/* Gather dataspace statistics */
sid = H5Dget_space(did);
@@ -505,22 +558,6 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
ret = H5Tclose(tid);
assert(ret >= 0);
- /* Gather layout statistics */
- dcpl = H5Dget_create_plist(did);
- assert(dcpl > 0);
-
- lout = H5Pget_layout(dcpl);
- assert(lout >= 0);
-
- /* Track the layout type for dataset */
- (iter->dset_layouts[lout])++;
-
- num_ext = H5Pget_external_count(dcpl);
- assert (num_ext >= 0);
-
- if(num_ext)
- iter->nexternal += (unsigned long)num_ext;
-
/* Track different filters */
if((nfltr = H5Pget_nfilters(dcpl)) >= 0) {
if(nfltr == 0)
@@ -653,6 +690,66 @@ lnk_stats(const char UNUSED *path, const H5L_info_t *li, void *_iter)
return 0;
} /* end lnk_stats() */
+/*-------------------------------------------------------------------------
+ * Function: freespace_stats
+ *
+ * Purpose: Gather statistics for free space sections in the file
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Vailin Choi; July 7th, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+freespace_stats(hid_t fid, iter_t *iter)
+{
+ H5F_sect_info_t *sect_info = NULL; /* Free space sections */
+ ssize_t nsects; /* Number of free space sections */
+ size_t u; /* Local index variable */
+
+ /* Query section information */
+ if((nsects = H5Fget_free_sections(fid, H5FD_MEM_DEFAULT, 0, NULL)) < 0)
+ return(FAIL);
+ else if(nsects) {
+ if(NULL == (sect_info = (H5F_sect_info_t *)calloc((size_t)nsects, sizeof(H5F_sect_info_t))))
+ return(FAIL);
+ nsects = H5Fget_free_sections(fid, H5FD_MEM_DEFAULT, (size_t)nsects, sect_info);
+ assert(nsects);
+ } /* end else-if */
+
+ for(u = 0; u < (size_t)nsects; u++) {
+ unsigned bin; /* "bin" the number of objects falls in */
+
+ if(sect_info[u].size < SIZE_SMALL_SECTS)
+ (iter->num_small_sects[(size_t)sect_info[u].size])++;
+
+ /* Add section size to proper bin */
+ bin = ceil_log10((unsigned long)sect_info[u].size);
+ if(bin >= iter->sect_nbins) {
+ /* Allocate more storage for section info */
+ iter->sect_bins = (unsigned long *)realloc(iter->sect_bins, (bin + 1) * sizeof(unsigned long));
+ assert(iter->sect_bins);
+
+ /* Initialize counts for intermediate bins */
+ while(iter->sect_nbins < bin)
+ iter->sect_bins[iter->sect_nbins++] = 0;
+ iter->sect_nbins++;
+
+ /* Initialize count for this bin */
+ iter->sect_bins[bin] = 1;
+ } /* end if */
+ else
+ (iter->sect_bins[bin])++;
+ } /* end for */
+
+ if(sect_info)
+ free(sect_info);
+
+ return 0;
+} /* end freespace_stats() */
+
/*-------------------------------------------------------------------------
* Function: parse_command_line
@@ -718,6 +815,16 @@ parse_command_line(int argc, const char *argv[])
display_dset = TRUE;
break;
+ case 's':
+ display_all = FALSE;
+ display_free_sections = TRUE;
+ break;
+
+ case 'S':
+ display_all = FALSE;
+ display_summary = TRUE;
+ break;
+
case 'h':
usage(progname);
leave(EXIT_SUCCESS);
@@ -829,15 +936,20 @@ print_file_info(const iter_t *iter)
static herr_t
print_file_metadata(const iter_t *iter)
{
- printf("Object header size: (total/unused)\n");
- HDfprintf(stdout, "\tGroups: %Hu/%Hu\n", iter->group_ohdr_info.total_size,
- iter->group_ohdr_info.free_size);
- HDfprintf(stdout, "\tDatasets: %Hu/%Hu\n", iter->dset_ohdr_info.total_size,
- iter->dset_ohdr_info.free_size);
- HDfprintf(stdout, "\tDatatypes: %Hu/%Hu\n", iter->dtype_ohdr_info.total_size,
- iter->dtype_ohdr_info.free_size);
-
- printf("Storage information:\n");
+ printf("Storage information (in bytes):\n");
+ HDfprintf(stdout, "\tSuperblock: %Hu\n", iter->super_size);
+ HDfprintf(stdout, "\tSuperblock extension: %Hu\n", iter->super_ext_size);
+ HDfprintf(stdout, "\tUser block: %Hu\n", iter->ublk_size);
+
+ HDfprintf(stdout, "\tObject headers: (total/unused)\n");
+ HDfprintf(stdout, "\t\tGroups: %Hu/%Hu\n", iter->group_ohdr_info.total_size,
+ iter->group_ohdr_info.free_size);
+ HDfprintf(stdout, "\t\tDatasets(exclude compact data): %Hu/%Hu\n",
+ iter->dset_ohdr_info.total_size,
+ iter->dset_ohdr_info.free_size);
+ HDfprintf(stdout, "\t\tDatatypes: %Hu/%Hu\n", iter->dtype_ohdr_info.total_size,
+ iter->dtype_ohdr_info.free_size);
+
HDfprintf(stdout, "\tGroups:\n");
HDfprintf(stdout, "\t\tB-tree/List: %Hu\n", iter->groups_btree_storage_size);
HDfprintf(stdout, "\t\tHeap: %Hu\n", iter->groups_heap_storage_size);
@@ -847,14 +959,19 @@ print_file_metadata(const iter_t *iter)
HDfprintf(stdout, "\t\tHeap: %Hu\n", iter->attrs_heap_storage_size);
HDfprintf(stdout, "\tChunked datasets:\n");
- HDfprintf(stdout, "\t\tB-tree: %Hu\n", iter->datasets_index_storage_size);
+ HDfprintf(stdout, "\t\tIndex: %Hu\n", iter->datasets_index_storage_size);
+
+ HDfprintf(stdout, "\tDatasets:\n");
+ HDfprintf(stdout, "\t\tHeap: %Hu\n", iter->datasets_heap_storage_size);
HDfprintf(stdout, "\tShared Messages:\n");
HDfprintf(stdout, "\t\tHeader: %Hu\n", iter->SM_hdr_storage_size);
HDfprintf(stdout, "\t\tB-tree/List: %Hu\n", iter->SM_index_storage_size);
HDfprintf(stdout, "\t\tHeap: %Hu\n", iter->SM_heap_storage_size);
- HDfprintf(stdout, "\tSuperblock extension: %Hu\n", iter->super_ext_size);
+ HDfprintf(stdout, "\tFree-space managers:\n");
+ HDfprintf(stdout, "\t\tHeader: %Hu\n", iter->free_hdr);
+ HDfprintf(stdout, "\t\tAmount of free space: %Hu\n", iter->free_space);
return 0;
}
@@ -1035,6 +1152,7 @@ print_dataset_info(const iter_t *iter)
printf("Dataset storage information:\n");
HDfprintf(stdout, "\tTotal raw data size: %Hu\n", iter->dset_storage_size);
+ HDfprintf(stdout, "\tTotal external raw data size: %Hu\n", iter->dset_external_storage_size);
printf("Dataset layout information:\n");
for(u = 0; u < H5D_NLAYOUTS; u++)
@@ -1075,6 +1193,116 @@ print_dataset_info(const iter_t *iter)
/*-------------------------------------------------------------------------
+ * Function: print_freespace_info
+ *
+ * Purpose: Prints information about free space in the file
+ *
+ * Return: Success: 0
+ *
+ * Failure: Never fails
+ *
+ * Programmer: Vailin Choi; July 7th, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+print_freespace_info(const iter_t *iter)
+{
+ unsigned long power; /* Temporary "power" for bins */
+ unsigned long total; /* Total count for various statistics */
+ unsigned u; /* Local index variable */
+
+ printf("Small size free-space sections (< %u bytes):\n", (unsigned)SIZE_SMALL_SECTS);
+ total = 0;
+ for(u = 0; u < SIZE_SMALL_SECTS; u++) {
+ if(iter->num_small_sects[u] > 0) {
+ printf("\t# of sections of size %u: %lu\n", u, iter->num_small_sects[u]);
+ total += iter->num_small_sects[u];
+ } /* end if */
+ } /* end for */
+ printf("\tTotal # of small size sections: %lu\n", total);
+
+ printf("Free-space section bins:\n");
+
+ total = 0;
+ power = 1;
+ for(u = 1; u < iter->sect_nbins; u++) {
+ if(iter->sect_bins[u] > 0) {
+ printf("\t# of sections of size %lu - %lu: %lu\n", power, (power * 10) - 1,
+ iter->sect_bins[u]);
+ total += iter->sect_bins[u];
+ } /* end if */
+ power *= 10;
+ } /* end for */
+ printf("\tTotal # of sections: %lu\n", total);
+
+ return 0;
+} /* print_freespace_info() */
+
+/*-------------------------------------------------------------------------
+ * Function: print_storage_summary
+ *
+ * Purpose: Prints summary of the storage information in the file
+ *
+ * Return: Success: 0
+ *
+ * Failure: Never fails
+ *
+ * Programmer: Vailin Choi; August 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+print_storage_summary(const iter_t *iter)
+{
+ hsize_t total_meta = 0;
+ hsize_t unaccount = 0;
+ float percent = 0.0;
+
+ printf("Summary of storage information:\n");
+ total_meta =
+ iter->super_size + iter->super_ext_size + iter->ublk_size +
+ iter->group_ohdr_info.total_size +
+ iter->dset_ohdr_info.total_size +
+ iter->dtype_ohdr_info.total_size +
+ iter->groups_btree_storage_size +
+ iter->groups_heap_storage_size +
+ iter->attrs_btree_storage_size +
+ iter->attrs_heap_storage_size +
+ iter->datasets_index_storage_size +
+ iter->datasets_heap_storage_size +
+ iter->SM_hdr_storage_size +
+ iter->SM_index_storage_size +
+ iter->SM_heap_storage_size +
+ iter->free_hdr;
+
+ HDfprintf(stdout, " File metadata: %Hu bytes\n", total_meta);
+ HDfprintf(stdout, " Raw data: %Hu bytes\n", iter->dset_storage_size);
+
+ percent = ((float)iter->free_space / (float)iter->filesize) * 100;
+ HDfprintf(stdout, " Amount/Percent of tracked free space: %Hu bytes/%3.1f%\n",
+ iter->free_space, percent);
+
+ if(iter->filesize < (total_meta+iter->dset_storage_size+iter->free_space)) {
+ unaccount = (total_meta + iter->dset_storage_size + iter->free_space) - iter->filesize;
+ HDfprintf(stdout, " ??? File has %Hu more bytes accounted for that its size! ???\n", unaccount);
+ }
+ else {
+ unaccount = iter->filesize - (total_meta + iter->dset_storage_size + iter->free_space);
+ HDfprintf(stdout, " Unaccounted space: %Hu bytes\n", unaccount);
+ }
+
+ HDfprintf(stdout, "Total space: %Hu bytes\n",
+ total_meta+iter->dset_storage_size+iter->free_space+unaccount);
+
+ if(iter->nexternal)
+ HDfprintf(stdout, "External raw data: %Hu bytes\n", iter->dset_external_storage_size);
+
+ return 0;
+} /* print_storage_summary() */
+
+
+/*-------------------------------------------------------------------------
* Function: print_file_statistics
*
* Purpose: Prints file statistics
@@ -1098,6 +1326,7 @@ print_file_statistics(const iter_t *iter)
display_dset = TRUE;
display_dtype_metadata = TRUE;
display_attr = TRUE;
+ display_free_sections = TRUE;
}
if(display_file) print_file_info(iter);
@@ -1105,6 +1334,8 @@ print_file_statistics(const iter_t *iter)
if(display_group) print_group_info(iter);
if(display_dset) print_dataset_info(iter);
if(display_attr) print_attr_info(iter);
+ if(display_free_sections) print_freespace_info(iter);
+ if(display_summary) print_storage_summary(iter);
}
@@ -1163,8 +1394,9 @@ main(int argc, const char *argv[])
iter_t iter;
const char *fname = NULL;
hid_t fid;
+ hid_t fcpl;
struct handler_t *hand;
- H5F_info_t finfo;
+ H5F_info2_t finfo;
/* Disable error reporting */
H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
@@ -1190,16 +1422,33 @@ main(int argc, const char *argv[])
/* Initialize iter structure */
iter_init(&iter, fid);
- /* Get storge info for SOHM's btree/list/heap and superblock extension */
- if(H5Fget_info(fid, &finfo) < 0)
- warn_msg(progname, "Unable to retrieve SOHM info\n");
+ if(H5Fget_filesize(fid, &iter.filesize) < 0)
+ warn_msg(progname, "Unable to retrieve file size\n");
+ assert(iter.filesize >= 0);
+
+ /* Get storge info for file-level structures */
+ if(H5Fget_info2(fid, &finfo) < 0)
+ warn_msg(progname, "Unable to retrieve file info\n");
else {
- iter.super_ext_size = finfo.super_ext_size;
+ iter.super_size = finfo.super.super_size;
+ iter.super_ext_size = finfo.super.super_ext_size;
iter.SM_hdr_storage_size = finfo.sohm.hdr_size;
iter.SM_index_storage_size = finfo.sohm.msgs_info.index_size;
iter.SM_heap_storage_size = finfo.sohm.msgs_info.heap_size;
+ iter.free_space = finfo.free.tot_space;
+ iter.free_hdr = finfo.free.meta_size;
} /* end else */
+ if((fcpl = H5Fget_create_plist(fid)) < 0)
+ warn_msg(progname, "Unable to retrieve file creation property\n");
+
+ if(H5Pget_userblock(fcpl, &iter.ublk_size) < 0)
+ warn_msg(progname, "Unable to retrieve userblock size\n");
+
+ /* get information for free-space sections */
+ if(freespace_stats(fid, &iter) < 0)
+ warn_msg(progname, "Unable to retrieve freespace info\n");
+
/* Walk the objects or all file */
if(display_object) {
unsigned u;
diff --git a/tools/h5stat/h5stat_gentest.c b/tools/h5stat/h5stat_gentest.c
index 3f933f2..e0ad3e2 100644
--- a/tools/h5stat/h5stat_gentest.c
+++ b/tools/h5stat/h5stat_gentest.c
@@ -40,18 +40,30 @@
*/
static void gen_file(void)
{
- int ret, i;
- hid_t fapl, gid;
- hid_t file, type_id, space_id, attr_id, dset_id;
- char name[30];
- char attrname[30];
+ hid_t fcpl; /* File creation property */
+ hid_t fapl; /* File access property */
+ hid_t file; /* File id */
+ hid_t gid; /* Group id */
+ hid_t type_id; /* Datatype id */
+ hid_t space_id; /* Dataspace id */
+ hid_t attr_id; /* Attribute id */
+ hid_t dset_id; /* Dataset id */
+ char name[30]; /* Group name */
+ char attrname[30]; /* Attribute name */
+ int ret; /* Return value */
+ int i; /* Local index variable */
fapl = H5Pcreate(H5P_FILE_ACCESS);
ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST);
assert(ret >= 0);
+ /* Set file space handling strategy */
+ fcpl = H5Pcreate(H5P_FILE_CREATE);
+ ret = H5Pset_file_space(fcpl, H5F_FILE_SPACE_ALL_PERSIST, 0);
+ assert(ret >= 0);
+
/* Create dataset */
- file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, fcpl, fapl);
for(i = 1; i <= NUM_GRPS; i++) {
sprintf(name, "%s%d", GROUP_NAME,i);
gid = H5Gcreate2(file, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
diff --git a/tools/h5stat/testfiles/h5stat_filters-F.ddl b/tools/h5stat/testfiles/h5stat_filters-F.ddl
index 6bc6cc2..78c7c5a 100644
--- a/tools/h5stat/testfiles/h5stat_filters-F.ddl
+++ b/tools/h5stat/testfiles/h5stat_filters-F.ddl
@@ -2,11 +2,14 @@
Expected output for 'h5stat -F h5stat_filters.h5'
#############################
Filename: h5stat_filters.h5
-Object header size: (total/unused)
- Groups: 48/8
- Datasets: 4936/1344
- Datatypes: 80/0
-Storage information:
+Storage information (in bytes):
+ Superblock: 96
+ Superblock extension: 0
+ User block: 0
+ Object headers: (total/unused)
+ Groups: 48/8
+ Datasets(exclude compact data): 4136/1344
+ Datatypes: 80/0
Groups:
B-tree/List: 1200
Heap: 288
@@ -14,9 +17,13 @@ Storage information:
B-tree/List: 0
Heap: 0
Chunked datasets:
- B-tree: 31392
+ Index: 31392
+ Datasets:
+ Heap: 72
Shared Messages:
Header: 0
B-tree/List: 0
Heap: 0
- Superblock extension: 0
+ Free-space managers:
+ Header: 0
+ Amount of free space: 0
diff --git a/tools/h5stat/testfiles/h5stat_filters-d.ddl b/tools/h5stat/testfiles/h5stat_filters-d.ddl
index 42d0de3..3cc9071 100644
--- a/tools/h5stat/testfiles/h5stat_filters-d.ddl
+++ b/tools/h5stat/testfiles/h5stat_filters-d.ddl
@@ -15,7 +15,8 @@ Dataset dimension information:
# of datasets of size 100 - 999: 1
Total # of datasets: 1
Dataset storage information:
- Total raw data size: 9059
+ Total raw data size: 8659
+ Total external raw data size: 400
Dataset layout information:
Dataset layout counts[COMPACT]: 1
Dataset layout counts[CONTIG]: 2
diff --git a/tools/h5stat/testfiles/h5stat_filters-dT.ddl b/tools/h5stat/testfiles/h5stat_filters-dT.ddl
index 2edcf7e..ae9121d 100644
--- a/tools/h5stat/testfiles/h5stat_filters-dT.ddl
+++ b/tools/h5stat/testfiles/h5stat_filters-dT.ddl
@@ -15,7 +15,8 @@ Dataset dimension information:
# of datasets of size 100 - 999: 1
Total # of datasets: 1
Dataset storage information:
- Total raw data size: 9059
+ Total raw data size: 8659
+ Total external raw data size: 400
Dataset layout information:
Dataset layout counts[COMPACT]: 1
Dataset layout counts[CONTIG]: 2
diff --git a/tools/h5stat/testfiles/h5stat_filters.ddl b/tools/h5stat/testfiles/h5stat_filters.ddl
index f9adebd..6ce04fe 100644
--- a/tools/h5stat/testfiles/h5stat_filters.ddl
+++ b/tools/h5stat/testfiles/h5stat_filters.ddl
@@ -10,11 +10,14 @@ File information
# of unique other: 0
Max. # of links to object: 1
Max. # of objects in group: 16
-Object header size: (total/unused)
- Groups: 48/8
- Datasets: 4936/1344
- Datatypes: 80/0
-Storage information:
+Storage information (in bytes):
+ Superblock: 96
+ Superblock extension: 0
+ User block: 0
+ Object headers: (total/unused)
+ Groups: 48/8
+ Datasets(exclude compact data): 4136/1344
+ Datatypes: 80/0
Groups:
B-tree/List: 1200
Heap: 288
@@ -22,12 +25,16 @@ Storage information:
B-tree/List: 0
Heap: 0
Chunked datasets:
- B-tree: 31392
+ Index: 31392
+ Datasets:
+ Heap: 72
Shared Messages:
Header: 0
B-tree/List: 0
Heap: 0
- Superblock extension: 0
+ Free-space managers:
+ Header: 0
+ Amount of free space: 0
Small groups:
Total # of small groups: 0
Group bins:
@@ -46,7 +53,8 @@ Dataset dimension information:
# of datasets of size 100 - 999: 1
Total # of datasets: 1
Dataset storage information:
- Total raw data size: 9059
+ Total raw data size: 8659
+ Total external raw data size: 400
Dataset layout information:
Dataset layout counts[COMPACT]: 1
Dataset layout counts[CONTIG]: 2
@@ -76,3 +84,7 @@ Small # of attributes:
Attribute bins:
Total # of objects with attributes: 0
Max. # of attributes to objects: 0
+Small size free-space sections (< 10 bytes):
+ Total # of small size sections: 0
+Free-space section bins:
+ Total # of sections: 0
diff --git a/tools/h5stat/testfiles/h5stat_help1.ddl b/tools/h5stat/testfiles/h5stat_help1.ddl
index 0a86b4c..5808c49 100644
--- a/tools/h5stat/testfiles/h5stat_help1.ddl
+++ b/tools/h5stat/testfiles/h5stat_help1.ddl
@@ -14,4 +14,5 @@ Usage: h5stat [OPTIONS] file
-D, --dsetmetadata Print dataset metadata
-T, --dtypemetadata Print datatype metadata
-A, --attribute Print attribute information
-
+ -s, --freespace Print free-space information
+ -S, --Summary Print summary of storage information
diff --git a/tools/h5stat/testfiles/h5stat_help2.ddl b/tools/h5stat/testfiles/h5stat_help2.ddl
index e41eb9e..169787f 100644
--- a/tools/h5stat/testfiles/h5stat_help2.ddl
+++ b/tools/h5stat/testfiles/h5stat_help2.ddl
@@ -14,4 +14,5 @@ Usage: h5stat [OPTIONS] file
-D, --dsetmetadata Print dataset metadata
-T, --dtypemetadata Print datatype metadata
-A, --attribute Print attribute information
-
+ -s, --freespace Print free-space information
+ -S, --Summary Print summary of storage information
diff --git a/tools/h5stat/testfiles/h5stat_newgrat.ddl b/tools/h5stat/testfiles/h5stat_newgrat.ddl
index 4f9bcac..877e55a 100644
--- a/tools/h5stat/testfiles/h5stat_newgrat.ddl
+++ b/tools/h5stat/testfiles/h5stat_newgrat.ddl
@@ -10,24 +10,31 @@ File information
# of unique other: 0
Max. # of links to object: 1
Max. # of objects in group: 35001
-Object header size: (total/unused)
- Groups: 5145147/3220092
- Datasets: 414/312
- Datatypes: 0/0
-Storage information:
+Storage information (in bytes):
+ Superblock: 48
+ Superblock extension: 119
+ User block: 0
+ Object headers: (total/unused)
+ Groups: 5145147/3220092
+ Datasets(exclude compact data): 414/312
+ Datatypes: 0/0
Groups:
B-tree/List: 470054
- Heap: 739102
+ Heap: 739045
Attributes:
B-tree/List: 2598
- Heap: 4442
+ Heap: 4431
Chunked datasets:
- B-tree: 0
+ Index: 0
+ Datasets:
+ Heap: 0
Shared Messages:
Header: 0
B-tree/List: 0
Heap: 0
- Superblock extension: 0
+ Free-space managers:
+ Header: 1350
+ Amount of free space: 4463
Small groups:
# of groups of size 0: 35000
Total # of small groups: 35000
@@ -45,6 +52,7 @@ Dataset dimension information:
Total small datasets: 0
Dataset storage information:
Total raw data size: 0
+ Total external raw data size: 0
Dataset layout information:
Dataset layout counts[COMPACT]: 0
Dataset layout counts[CONTIG]: 1
@@ -72,3 +80,15 @@ Attribute bins:
# of objects with 100 - 999 attributes: 1
Total # of objects with attributes: 1
Max. # of attributes to objects: 100
+Small size free-space sections (< 10 bytes):
+ # of sections of size 1: 1
+ # of sections of size 2: 12
+ # of sections of size 3: 3
+ # of sections of size 7: 1
+ # of sections of size 8: 2
+ Total # of small size sections: 19
+Free-space section bins:
+ # of sections of size 1 - 9: 19
+ # of sections of size 10 - 99: 44
+ # of sections of size 100 - 999: 18
+ Total # of sections: 81
diff --git a/tools/h5stat/testfiles/h5stat_newgrat.h5 b/tools/h5stat/testfiles/h5stat_newgrat.h5
index 8fa406b..1db0205 100644
--- a/tools/h5stat/testfiles/h5stat_newgrat.h5
+++ b/tools/h5stat/testfiles/h5stat_newgrat.h5
Binary files differ
diff --git a/tools/h5stat/testfiles/h5stat_tsohm.ddl b/tools/h5stat/testfiles/h5stat_tsohm.ddl
index e536c33..a53e40c 100644
--- a/tools/h5stat/testfiles/h5stat_tsohm.ddl
+++ b/tools/h5stat/testfiles/h5stat_tsohm.ddl
@@ -10,11 +10,14 @@ File information
# of unique other: 0
Max. # of links to object: 1
Max. # of objects in group: 3
-Object header size: (total/unused)
- Groups: 51/2
- Datasets: 852/447
- Datatypes: 0/0
-Storage information:
+Storage information (in bytes):
+ Superblock: 48
+ Superblock extension: 40
+ User block: 0
+ Object headers: (total/unused)
+ Groups: 51/2
+ Datasets(exclude compact data): 852/447
+ Datatypes: 0/0
Groups:
B-tree/List: 872
Heap: 120
@@ -22,12 +25,16 @@ Storage information:
B-tree/List: 0
Heap: 0
Chunked datasets:
- B-tree: 0
+ Index: 0
+ Datasets:
+ Heap: 0
Shared Messages:
Header: 38
B-tree/List: 550
Heap: 1316
- Superblock extension: 40
+ Free-space managers:
+ Header: 0
+ Amount of free space: 0
Small groups:
# of groups of size 3: 1
Total # of small groups: 1
@@ -44,6 +51,7 @@ Dataset dimension information:
Total small datasets: 0
Dataset storage information:
Total raw data size: 0
+ Total external raw data size: 0
Dataset layout information:
Dataset layout counts[COMPACT]: 0
Dataset layout counts[CONTIG]: 0
@@ -70,3 +78,7 @@ Small # of attributes:
Attribute bins:
Total # of objects with attributes: 0
Max. # of attributes to objects: 0
+Small size free-space sections (< 10 bytes):
+ Total # of small size sections: 0
+Free-space section bins:
+ Total # of sections: 0