summaryrefslogtreecommitdiffstats
path: root/tools/h5stat
diff options
context:
space:
mode:
Diffstat (limited to 'tools/h5stat')
-rw-r--r--tools/h5stat/h5stat.c91
-rw-r--r--tools/h5stat/testfiles/h5stat_filters-F.ddl1
-rw-r--r--tools/h5stat/testfiles/h5stat_filters.ddl1
-rw-r--r--tools/h5stat/testfiles/h5stat_help1.ddl7
-rw-r--r--tools/h5stat/testfiles/h5stat_help2.ddl7
-rw-r--r--tools/h5stat/testfiles/h5stat_newgrat.ddl1
-rw-r--r--tools/h5stat/testfiles/h5stat_tsohm.ddl1
7 files changed, 48 insertions, 61 deletions
diff --git a/tools/h5stat/h5stat.c b/tools/h5stat/h5stat.c
index 315c558..75481ff 100644
--- a/tools/h5stat/h5stat.c
+++ b/tools/h5stat/h5stat.c
@@ -51,7 +51,7 @@ typedef struct iter_t {
unsigned long uniq_groups; /* Number of unique groups */
unsigned long uniq_dsets; /* Number of unique datasets */
- unsigned long uniq_types; /* Number of unique named datatypes */
+ unsigned long uniq_dtypes; /* Number of unique named datatypes */
unsigned long uniq_links; /* Number of unique links */
unsigned long uniq_others; /* Number of other unique objects */
@@ -64,11 +64,11 @@ typedef struct iter_t {
hsize_t max_attrs; /* Maximum attributes from a group */
unsigned long num_small_attrs[SIZE_SMALL_ATTRS]; /* Size of small attributes tracked */
- unsigned attr_nbins;
- unsigned long *attr_bins;
+ unsigned attr_nbins; /* Number of bins for attribute counts */
+ unsigned long *attr_bins; /* Pointer to array of bins for attribute counts */
- unsigned long max_dset_rank; /* Maximum rank of dataset */
- unsigned long dset_rank_count[H5S_MAX_RANK]; /* Number of datasets of each rank */
+ unsigned max_dset_rank; /* Maximum rank of dataset */
+ unsigned long dset_rank_count[H5S_MAX_RANK]; /* Number of datasets of each rank */
hsize_t max_dset_dims; /* Maximum dimension size of dataset */
unsigned long small_dset_dims[SIZE_SMALL_DSETS]; /* Size of dimensions of small datasets tracked */
unsigned long dset_layouts[H5D_NLAYOUTS]; /* Type of storage for each dataset */
@@ -79,6 +79,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 */
+ 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 */
hsize_t attrs_btree_storage_size; /* btree size for attributes (1.8) */
@@ -110,7 +111,7 @@ struct handler_t {
};
-static const char *s_opts ="AFfhGgDdTO:V";
+static const char *s_opts ="ADdFfhGgTO:V";
static struct long_options l_opts[] = {
{"help", no_arg, 'h'},
{"hel", no_arg, 'h'},
@@ -192,13 +193,6 @@ leave(int ret)
static void usage(const char *prog)
{
fflush(stdout);
- fprintf(stdout, "\n");
- fprintf(stdout, "This tool is under development. For detailed information\n");
- fprintf(stdout, "please see the specification document at\n");
- fprintf(stdout, "http://hdf.ncsa.uiuc.edu/RFC/h5stat/h5stat-spec.pdf\n");
- fprintf(stdout, "\n");
- fprintf(stdout, "Please send your comments and questions to help@hdfgroup.org\n");
- fprintf(stdout, "\n");
fprintf(stdout, "Usage: %s [OPTIONS] file\n", prog);
fprintf(stdout, "\n");
fprintf(stdout, " OPTIONS\n");
@@ -277,7 +271,7 @@ attribute_stats(iter_t *iter, const H5O_info_t *oi)
/* Add attribute count to proper bin */
bin = ceil_log10((unsigned long)oi->num_attrs);
if((bin + 1) > iter->attr_nbins) {
- iter->attr_bins = realloc(iter->attr_bins, (bin + 1) * sizeof(unsigned long));
+ iter->attr_bins = (unsigned long *)realloc(iter->attr_bins, (bin + 1) * sizeof(unsigned long));
assert(iter->attr_bins);
/* Initialize counts for intermediate bins */
@@ -349,7 +343,7 @@ group_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
bin = ceil_log10((unsigned long)ginfo.nlinks);
if((bin + 1) > iter->group_nbins) {
/* Allocate more storage for info about dataset's datatype */
- iter->group_bins = realloc(iter->group_bins, (bin + 1) * sizeof(unsigned long));
+ iter->group_bins = (unsigned long *)realloc(iter->group_bins, (bin + 1) * sizeof(unsigned long));
assert(iter->group_bins);
/* Initialize counts for intermediate bins */
@@ -451,7 +445,7 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
/* Check for larger rank of dataset */
if((unsigned)ndims > iter->max_dset_rank)
- iter->max_dset_rank = ndims;
+ iter->max_dset_rank = (unsigned)ndims;
/* Track the number of datasets with each rank */
(iter->dset_rank_count[ndims])++;
@@ -466,7 +460,7 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
bin = ceil_log10((unsigned long)dims[0]);
if((bin + 1) > iter->dset_dim_nbins) {
/* Allocate more storage for info about dataset's datatype */
- iter->dset_dim_bins = realloc(iter->dset_dim_bins, (bin + 1) * sizeof(unsigned long));
+ iter->dset_dim_bins = (unsigned long *)realloc(iter->dset_dim_bins, (bin + 1) * sizeof(unsigned long));
assert(iter->dset_dim_bins);
/* Initialize counts for intermediate bins */
@@ -503,7 +497,7 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
iter->dset_ntypes++;
/* Allocate more storage for info about dataset's datatype */
- iter->dset_type_info = realloc(iter->dset_type_info, iter->dset_ntypes * sizeof(dtype_info_t));
+ iter->dset_type_info = (dtype_info_t *)realloc(iter->dset_type_info, iter->dset_ntypes * sizeof(dtype_info_t));
assert(iter->dset_type_info);
/* Initialize information about datatype */
@@ -537,7 +531,7 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
assert (num_ext >= 0);
if(num_ext)
- iter->nexternal = iter->nexternal + num_ext;
+ iter->nexternal += (unsigned long)num_ext;
/* Track different filters */
if((nfltr = H5Pget_nfilters(dcpl)) >= 0) {
@@ -561,6 +555,31 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
return 0;
} /* end dataset_stats() */
+/*-------------------------------------------------------------------------
+ * Function: datatype_stats
+ *
+ * Purpose: Gather statistics about the datatype
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Vailin Choi; July 7th, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+datatype_stats(iter_t *iter, const H5O_info_t *oi)
+{
+ /* Gather statistics about this type of object */
+ iter->uniq_dtypes++;
+
+ /* Get object header information */
+ iter->dtype_ohdr_info.total_size += oi->hdr.space.total;
+ iter->dtype_ohdr_info.free_size += oi->hdr.space.free;
+
+ return 0;
+} /* end datatype_stats() */
+
/*-------------------------------------------------------------------------
* Function: obj_stats
@@ -598,8 +617,7 @@ obj_stats(const char *path, const H5O_info_t *oi, const char *already_visited,
break;
case H5O_TYPE_NAMED_DATATYPE:
- /* Gather statistics about this type of object */
- iter->uniq_types++;
+ datatype_stats(iter, oi);
break;
default:
@@ -661,10 +679,6 @@ lnk_stats(const char UNUSED *path, const H5L_info_t *li, void *_iter)
* Programmer: Elena Pourmal
* Saturday, August 12, 2006
*
- * Modifications:
- * Vailin Choi 12 July 2007
- * Added 'A' option to display attribute info
- *
*-------------------------------------------------------------------------
*/
static struct handler_t *
@@ -674,7 +688,7 @@ parse_command_line(int argc, const char *argv[])
struct handler_t *hand;
/* Allocate space to hold the command line info */
- hand = calloc((size_t)argc, sizeof(struct handler_t));
+ hand = (struct handler_t *)calloc((size_t)argc, sizeof(struct handler_t));
/* parse command line options */
while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
@@ -801,7 +815,7 @@ print_file_info(const iter_t *iter)
printf("File information\n");
printf("\t# of unique groups: %lu\n", iter->uniq_groups);
printf("\t# of unique datasets: %lu\n", iter->uniq_dsets);
- printf("\t# of unique named dataypes: %lu\n", iter->uniq_types);
+ printf("\t# of unique named dataypes: %lu\n", iter->uniq_dtypes);
printf("\t# of unique links: %lu\n", iter->uniq_links);
printf("\t# of unique other: %lu\n", iter->uniq_others);
printf("\tMax. # of links to object: %lu\n", iter->max_links);
@@ -823,14 +837,6 @@ print_file_info(const iter_t *iter)
* Programmer: Elena Pourmal
* Saturday, August 12, 2006
*
- * Modifications:
- * Vailin Choi 12 July 2007
- * Print storage info for:
- * 1. btree/heap storage for groups and attributes
- * 2. btree storage for chunked dataset
- * 3. hdr/btree/list/heap storage for SOHM table
- * 4. superblock extension size
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -841,6 +847,8 @@ print_file_metadata(const iter_t *iter)
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");
HDfprintf(stdout, "\tGroups:\n");
@@ -999,7 +1007,7 @@ print_dataset_info(const iter_t *iter)
if(iter->uniq_dsets > 0) {
printf("Dataset dimension information:\n");
- printf("\tMax. rank of datasets: %lu\n", iter->max_dset_rank);
+ printf("\tMax. rank of datasets: %u\n", iter->max_dset_rank);
printf("\tDataset ranks:\n");
for(u = 0; u < H5S_MAX_RANK; u++)
if(iter->dset_rank_count[u] > 0)
@@ -1091,8 +1099,6 @@ print_dataset_info(const iter_t *iter)
* Programmer: Elena Pourmal
* Saturday, August 12, 2006
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void
@@ -1163,15 +1169,6 @@ print_statistics(const char *name, const iter_t *iter)
print_file_statistics(iter);
}
-/*-------------------------------------------------------------------------
- *
- * Modifications:
- * bug #1253; Oct 6th 2008; Vailin Choi
- * Call print_statistics() when objects/links are successfully traversed.
- * Otherwise, return warning message.
- *
- *-------------------------------------------------------------------------
- */
int
main(int argc, const char *argv[])
diff --git a/tools/h5stat/testfiles/h5stat_filters-F.ddl b/tools/h5stat/testfiles/h5stat_filters-F.ddl
index 544d0c7..6bc6cc2 100644
--- a/tools/h5stat/testfiles/h5stat_filters-F.ddl
+++ b/tools/h5stat/testfiles/h5stat_filters-F.ddl
@@ -5,6 +5,7 @@ Filename: h5stat_filters.h5
Object header size: (total/unused)
Groups: 48/8
Datasets: 4936/1344
+ Datatypes: 80/0
Storage information:
Groups:
B-tree/List: 1200
diff --git a/tools/h5stat/testfiles/h5stat_filters.ddl b/tools/h5stat/testfiles/h5stat_filters.ddl
index 8afdf82..8243a23 100644
--- a/tools/h5stat/testfiles/h5stat_filters.ddl
+++ b/tools/h5stat/testfiles/h5stat_filters.ddl
@@ -13,6 +13,7 @@ File information
Object header size: (total/unused)
Groups: 48/8
Datasets: 4936/1344
+ Datatypes: 80/0
Storage information:
Groups:
B-tree/List: 1200
diff --git a/tools/h5stat/testfiles/h5stat_help1.ddl b/tools/h5stat/testfiles/h5stat_help1.ddl
index 0841572..0a86b4c 100644
--- a/tools/h5stat/testfiles/h5stat_help1.ddl
+++ b/tools/h5stat/testfiles/h5stat_help1.ddl
@@ -1,13 +1,6 @@
#############################
Expected output for 'h5stat -h'
#############################
-
-This tool is under development. For detailed information
-please see the specification document at
-http://hdf.ncsa.uiuc.edu/RFC/h5stat/h5stat-spec.pdf
-
-Please send your comments and questions to help@hdfgroup.org
-
Usage: h5stat [OPTIONS] file
OPTIONS
diff --git a/tools/h5stat/testfiles/h5stat_help2.ddl b/tools/h5stat/testfiles/h5stat_help2.ddl
index 1e6295b..e41eb9e 100644
--- a/tools/h5stat/testfiles/h5stat_help2.ddl
+++ b/tools/h5stat/testfiles/h5stat_help2.ddl
@@ -1,13 +1,6 @@
#############################
Expected output for 'h5stat --help'
#############################
-
-This tool is under development. For detailed information
-please see the specification document at
-http://hdf.ncsa.uiuc.edu/RFC/h5stat/h5stat-spec.pdf
-
-Please send your comments and questions to help@hdfgroup.org
-
Usage: h5stat [OPTIONS] file
OPTIONS
diff --git a/tools/h5stat/testfiles/h5stat_newgrat.ddl b/tools/h5stat/testfiles/h5stat_newgrat.ddl
index 5ba2e7f..f87f297 100644
--- a/tools/h5stat/testfiles/h5stat_newgrat.ddl
+++ b/tools/h5stat/testfiles/h5stat_newgrat.ddl
@@ -13,6 +13,7 @@ File information
Object header size: (total/unused)
Groups: 5145147/3220092
Datasets: 414/312
+ Datatypes: 0/0
Storage information:
Groups:
B-tree/List: 470054
diff --git a/tools/h5stat/testfiles/h5stat_tsohm.ddl b/tools/h5stat/testfiles/h5stat_tsohm.ddl
index 56524e1..577dfdd 100644
--- a/tools/h5stat/testfiles/h5stat_tsohm.ddl
+++ b/tools/h5stat/testfiles/h5stat_tsohm.ddl
@@ -13,6 +13,7 @@ File information
Object header size: (total/unused)
Groups: 51/2
Datasets: 852/447
+ Datatypes: 0/0
Storage information:
Groups:
B-tree/List: 872