summaryrefslogtreecommitdiffstats
path: root/tools/src/h5stat
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2020-01-16 21:29:34 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2020-01-16 21:29:34 (GMT)
commita92c735c9b57049e8c4037d3490f7e10f8eef4d6 (patch)
tree74da25151de6d1e32329dfcd62e17c863e2e3de1 /tools/src/h5stat
parent024f7ba09250110c19b070c9699cfbc0f9dc2b96 (diff)
downloadhdf5-a92c735c9b57049e8c4037d3490f7e10f8eef4d6.zip
hdf5-a92c735c9b57049e8c4037d3490f7e10f8eef4d6.tar.gz
hdf5-a92c735c9b57049e8c4037d3490f7e10f8eef4d6.tar.bz2
Squashed commit of the token_refactoring branch:
Diffstat (limited to 'tools/src/h5stat')
-rw-r--r--tools/src/h5stat/h5stat.c53
1 files changed, 29 insertions, 24 deletions
diff --git a/tools/src/h5stat/h5stat.c b/tools/src/h5stat/h5stat.c
index f160671..adc905a 100644
--- a/tools/src/h5stat/h5stat.c
+++ b/tools/src/h5stat/h5stat.c
@@ -379,13 +379,13 @@ ceil_log10(unsigned long x)
*-------------------------------------------------------------------------
*/
static herr_t
-attribute_stats(iter_t *iter, const H5O_info_t *oi)
+attribute_stats(iter_t *iter, const H5O_info2_t *oi, const H5O_native_info_t *native_oi)
{
unsigned bin; /* "bin" the number of objects falls in */
/* Update dataset & attribute metadata info */
- iter->attrs_btree_storage_size += oi->meta_size.attr.index_size;
- iter->attrs_heap_storage_size += oi->meta_size.attr.heap_size;
+ iter->attrs_btree_storage_size += native_oi->meta_size.attr.index_size;
+ iter->attrs_heap_storage_size += native_oi->meta_size.attr.heap_size;
/* Update small # of attribute count & limits */
if(oi->num_attrs <= (hsize_t)sattrs_threshold)
@@ -440,7 +440,7 @@ attribute_stats(iter_t *iter, const H5O_info_t *oi)
*-------------------------------------------------------------------------
*/
static herr_t
-group_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
+group_stats(iter_t *iter, const char *name, const H5O_info2_t *oi, const H5O_native_info_t *native_oi)
{
H5G_info_t ginfo; /* Group information */
unsigned bin; /* "bin" the number of objects falls in */
@@ -450,8 +450,8 @@ group_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
iter->uniq_groups++;
/* Get object header information */
- iter->group_ohdr_info.total_size += oi->hdr.space.total;
- iter->group_ohdr_info.free_size += oi->hdr.space.free;
+ iter->group_ohdr_info.total_size += native_oi->hdr.space.total;
+ iter->group_ohdr_info.free_size += native_oi->hdr.space.free;
/* Get group information */
if((ret_value = H5Gget_info_by_name(iter->fid, name, &ginfo, H5P_DEFAULT)) < 0)
@@ -484,11 +484,11 @@ group_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
(iter->group_bins[bin])++;
/* Update group metadata info */
- iter->groups_btree_storage_size += oi->meta_size.obj.index_size;
- iter->groups_heap_storage_size += oi->meta_size.obj.heap_size;
+ iter->groups_btree_storage_size += native_oi->meta_size.obj.index_size;
+ iter->groups_heap_storage_size += native_oi->meta_size.obj.heap_size;
/* Update attribute metadata info */
- if((ret_value = attribute_stats(iter, oi)) < 0)
+ if((ret_value = attribute_stats(iter, oi, native_oi)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "attribute_stats failed");
done:
@@ -510,7 +510,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
+dataset_stats(iter_t *iter, const char *name, const H5O_info2_t *oi, const H5O_native_info_t *native_oi)
{
unsigned bin; /* "bin" the number of objects falls in */
hid_t did; /* Dataset ID */
@@ -533,18 +533,18 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
iter->uniq_dsets++;
/* Get object header information */
- iter->dset_ohdr_info.total_size += oi->hdr.space.total;
- iter->dset_ohdr_info.free_size += oi->hdr.space.free;
+ iter->dset_ohdr_info.total_size += native_oi->hdr.space.total;
+ iter->dset_ohdr_info.free_size += native_oi->hdr.space.free;
if((did = H5Dopen2(iter->fid, name, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Dopen() failed");
/* 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;
+ iter->datasets_index_storage_size += native_oi->meta_size.obj.index_size;
+ iter->datasets_heap_storage_size += native_oi->meta_size.obj.heap_size;
/* Update attribute metadata info */
- if((ret_value = attribute_stats(iter, oi)) < 0)
+ if((ret_value = attribute_stats(iter, oi, native_oi)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "attribute_stats() failed");
/* Get storage info */
@@ -702,7 +702,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-datatype_stats(iter_t *iter, const H5O_info_t *oi)
+datatype_stats(iter_t *iter, const H5O_info2_t *oi, const H5O_native_info_t *native_oi)
{
herr_t ret_value = SUCCEED;
@@ -710,11 +710,11 @@ datatype_stats(iter_t *iter, const H5O_info_t *oi)
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;
+ iter->dtype_ohdr_info.total_size += native_oi->hdr.space.total;
+ iter->dtype_ohdr_info.free_size += native_oi->hdr.space.free;
/* Update attribute metadata info */
- if((ret_value = attribute_stats(iter, oi)) < 0)
+ if((ret_value = attribute_stats(iter, oi, native_oi)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "attribute_stats() failed");
done:
return ret_value;
@@ -735,31 +735,36 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-obj_stats(const char *path, const H5O_info_t *oi, const char *already_visited,
+obj_stats(const char *path, const H5O_info2_t *oi, const char *already_visited,
void *_iter)
{
+ H5O_native_info_t native_info;
iter_t *iter = (iter_t *)_iter;
herr_t ret_value = SUCCEED;
/* If the object has already been seen then just return */
if(NULL == already_visited) {
+ /* Retrieve the native info for the object */
+ if(H5Oget_native_info_by_name(iter->fid, path, &native_info, H5O_NATIVE_INFO_ALL, H5P_DEFAULT) < 0)
+ H5TOOLS_GOTO_ERROR(FAIL, "H5Oget_native_info_by_name failed");
+
/* Gather some general statistics about the object */
if(oi->rc > iter->max_links)
iter->max_links = oi->rc;
switch(oi->type) {
case H5O_TYPE_GROUP:
- if(group_stats(iter, path, oi) < 0)
+ if(group_stats(iter, path, oi, &native_info) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "group_stats failed");
break;
case H5O_TYPE_DATASET:
- if(dataset_stats(iter, path, oi) < 0)
+ if(dataset_stats(iter, path, oi, &native_info) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "dataset_stats failed");
break;
case H5O_TYPE_NAMED_DATATYPE:
- if(datatype_stats(iter, oi) < 0)
+ if(datatype_stats(iter, oi, &native_info) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "datatype_stats failed");
break;
@@ -792,7 +797,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-lnk_stats(const char H5_ATTR_UNUSED *path, const H5L_info_t *li, void *_iter)
+lnk_stats(const char H5_ATTR_UNUSED *path, const H5L_info2_t *li, void *_iter)
{
iter_t *iter = (iter_t *)_iter;