diff options
author | Vailin Choi <vchoi@hdfgroup.org> | 2010-02-17 20:50:50 (GMT) |
---|---|---|
committer | Vailin Choi <vchoi@hdfgroup.org> | 2010-02-17 20:50:50 (GMT) |
commit | 0fb3254237255e8d145be86931c38ef77de02f78 (patch) | |
tree | e2c57b5ace89855c1571e2fd4bf892c13116afec | |
parent | ec709b76da66ff79c330a3a8d1d2164d4bfd354c (diff) | |
download | hdf5-0fb3254237255e8d145be86931c38ef77de02f78.zip hdf5-0fb3254237255e8d145be86931c38ef77de02f78.tar.gz hdf5-0fb3254237255e8d145be86931c38ef77de02f78.tar.bz2 |
[svn-r18270] Changes to h5stat in response to bug 1778:
1. Gather attribute info for named datatype,
2. Fixed -T, -G, -A, -D options
3. Brought over some changes from trunk h5stat
h5committested.
-rw-r--r-- | MANIFEST | 5 | ||||
-rwxr-xr-x | configure | 2 | ||||
-rw-r--r-- | tools/h5stat/h5stat.c | 425 | ||||
-rw-r--r-- | tools/h5stat/testfiles/h5stat_filters-F.ddl | 17 | ||||
-rw-r--r-- | tools/h5stat/testfiles/h5stat_filters-UD.ddl | 8 | ||||
-rw-r--r-- | tools/h5stat/testfiles/h5stat_filters-UT.ddl | 13 | ||||
-rw-r--r-- | tools/h5stat/testfiles/h5stat_filters-d.ddl | 3 | ||||
-rw-r--r-- | tools/h5stat/testfiles/h5stat_filters-dT.ddl | 3 | ||||
-rw-r--r-- | tools/h5stat/testfiles/h5stat_filters.ddl | 20 | ||||
-rw-r--r-- | tools/h5stat/testfiles/h5stat_help1.ddl | 8 | ||||
-rw-r--r-- | tools/h5stat/testfiles/h5stat_help2.ddl | 8 | ||||
-rw-r--r-- | tools/h5stat/testfiles/h5stat_newgrat-UA.ddl | 10 | ||||
-rw-r--r-- | tools/h5stat/testfiles/h5stat_newgrat-UG.ddl | 8 | ||||
-rw-r--r-- | tools/h5stat/testfiles/h5stat_newgrat.ddl | 18 | ||||
-rw-r--r-- | tools/h5stat/testfiles/h5stat_tsohm.ddl | 18 | ||||
-rw-r--r-- | tools/h5stat/testh5stat.sh.in | 4 |
16 files changed, 398 insertions, 172 deletions
@@ -1061,6 +1061,8 @@ ./tools/h5stat/h5stat.c ./tools/h5stat/h5stat_gentest.c ./tools/h5stat/testh5stat.sh.in +./tools/h5stat/testfiles/h5stat_filters-UT.ddl +./tools/h5stat/testfiles/h5stat_filters-UD.ddl ./tools/h5stat/testfiles/h5stat_filters-d.ddl ./tools/h5stat/testfiles/h5stat_filters.ddl ./tools/h5stat/testfiles/h5stat_filters-dT.ddl @@ -1070,11 +1072,14 @@ ./tools/h5stat/testfiles/h5stat_filters.h5 ./tools/h5stat/testfiles/h5stat_help1.ddl ./tools/h5stat/testfiles/h5stat_help2.ddl +./tools/h5stat/testfiles/h5stat_newgrat-UA.ddl +./tools/h5stat/testfiles/h5stat_newgrat-UG.ddl ./tools/h5stat/testfiles/h5stat_newgrat.ddl ./tools/h5stat/testfiles/h5stat_newgrat.h5 ./tools/h5stat/testfiles/h5stat_tsohm.ddl ./tools/h5stat/testfiles/h5stat_tsohm.h5 + # h5dump ./tools/testfiles/family_file00000.h5 ./tools/testfiles/family_file00001.h5 @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Id: configure.in 18234 2010-02-12 18:20:49Z hdftest . +# From configure.in Id: configure.in 18255 2010-02-14 23:55:45Z hdftest . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.64 for HDF5 1.8.4-snap13. # diff --git a/tools/h5stat/h5stat.c b/tools/h5stat/h5stat.c index 24bfce0..efcac48 100644 --- a/tools/h5stat/h5stat.c +++ b/tools/h5stat/h5stat.c @@ -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 */ + 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 */ @@ -88,7 +89,9 @@ typedef struct iter_t { 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_ext_size; /* superblock extension size */ + hsize_t ublk_size; /* user block size (if exists) */ 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; @@ -97,11 +100,13 @@ typedef struct iter_t { const char *progname = "h5stat"; int d_status = EXIT_SUCCESS; static int display_all = TRUE; -static int display_file_metadata = FALSE; static int display_file = FALSE; +static int display_file_metadata = FALSE; static int display_group = FALSE; +static int display_group_metadata = FALSE; static int display_dset = FALSE; -static int display_dtype_metadata = FALSE; +static int display_dset_metadata = FALSE; +static int display_dset_dtype_meta = FALSE; static int display_object = FALSE; static int display_attr = FALSE; @@ -112,24 +117,24 @@ struct handler_t { static const char *s_opts ="ADdFfhGgTO:V"; +/* e.g. "filemetadata" has to precedue "file"; "groupmetadata" has to precede "group" etc. */ static struct long_options l_opts[] = { {"help", no_arg, 'h'}, {"hel", no_arg, 'h'}, + {"he", no_arg, 'h'}, + + {"filemetadata", no_arg, 'F'}, + {"filemetadat", no_arg, 'F'}, + {"filemetada", no_arg, 'F'}, + {"filemetad", no_arg, 'F'}, + {"filemeta", no_arg, 'F'}, + {"filemet", no_arg, 'F'}, + {"fileme", no_arg, 'F'}, + {"filem", no_arg, 'F'}, {"file", no_arg, 'f'}, {"fil", no_arg, 'f'}, {"fi", no_arg, 'f'}, - {"FILEmetadata", no_arg, 'F'}, - {"FILEmetadat", no_arg, 'F'}, - {"FILEmetada", no_arg, 'F'}, - {"FILEmetad", no_arg, 'F'}, - {"FILEmeta", no_arg, 'F'}, - {"FILEmet", no_arg, 'F'}, - {"FILEme", no_arg, 'F'}, - {"FILEm", no_arg, 'F'}, - {"group", no_arg, 'g'}, - {"grou", no_arg, 'g'}, - {"gro", no_arg, 'g'}, - {"gr", no_arg, 'g'}, + {"groupmetadata", no_arg, 'G'}, {"groupmetadat", no_arg, 'G'}, {"groupmetada", no_arg, 'G'}, @@ -138,10 +143,11 @@ static struct long_options l_opts[] = { {"groupmet", no_arg, 'G'}, {"groupme", no_arg, 'G'}, {"groupm", no_arg, 'G'}, - {"dset", no_arg, 'd'}, - {"dse", no_arg, 'd'}, - {"ds", no_arg, 'd'}, - {"d", no_arg, 'd'}, + {"group", no_arg, 'g'}, + {"grou", no_arg, 'g'}, + {"gro", no_arg, 'g'}, + {"gr", no_arg, 'g'}, + {"dsetmetadata", no_arg, 'D'}, {"dsetmetadat", no_arg, 'D'}, {"dsetmetada", no_arg, 'D'}, @@ -150,6 +156,9 @@ static struct long_options l_opts[] = { {"dsetmet", no_arg, 'D'}, {"dsetme", no_arg, 'D'}, {"dsetm", no_arg, 'D'}, + {"dset", no_arg, 'd'}, + {"dse", no_arg, 'd'}, + {"ds", no_arg, 'd'}, {"dtypemetadata", no_arg, 'T'}, {"dtypemetadat", no_arg, 'T'}, {"dtypemetada", no_arg, 'T'}, @@ -159,6 +168,9 @@ static struct long_options l_opts[] = { {"dtypeme", no_arg, 'T'}, {"dtypem", no_arg, 'T'}, {"dtype", no_arg, 'T'}, + {"dtyp", no_arg, 'T'}, + {"dty", no_arg, 'T'}, + {"dt", no_arg, 'T'}, { "object", require_arg, 'O' }, { "objec", require_arg, 'O' }, { "obje", require_arg, 'O' }, @@ -178,7 +190,6 @@ static struct long_options l_opts[] = { { "attr", no_arg, 'A' }, { "att", no_arg, 'A' }, { "at", no_arg, 'A' }, - { "a", no_arg, 'A' }, { NULL, 0, '\0' } }; @@ -187,7 +198,7 @@ leave(int ret) { h5tools_close(); exit(ret); -} +} /* leave() */ static void usage(const char *prog) @@ -199,15 +210,15 @@ static void usage(const char *prog) fprintf(stdout, " -h, --help Print a usage message and exit\n"); fprintf(stdout, " -V, --version Print version number and exit\n"); fprintf(stdout, " -f, --file Print file information\n"); - fprintf(stdout, " -F, --filemetadata Print file metadata\n"); + fprintf(stdout, " -F, --filemetadata Print file space information for file's metadata\n"); fprintf(stdout, " -g, --group Print group information\n"); - fprintf(stdout, " -G, --groupmetadata Print group metadata\n"); + fprintf(stdout, " -G, --groupmetadata Print file space information for groups' metadata\n"); fprintf(stdout, " -d, --dset Print dataset information\n"); - fprintf(stdout, " -D, --dsetmetadata Print dataset metadata\n"); - fprintf(stdout, " -T, --dtypemetadata Print datatype metadata\n"); + fprintf(stdout, " -D, --dsetmetadata Print file space information for datasets' metadata\n"); + fprintf(stdout, " -T, --dtypemetadata Print datasets' datatype metadata\n"); fprintf(stdout, " -A, --attribute Print attribute information\n"); fprintf(stdout, "\n"); -} +} /* usage() */ /*------------------------------------------------------------------------- @@ -236,7 +247,7 @@ ceil_log10(unsigned long x) } /* end while */ return(ret); -} +} /* ceil_log10() */ /*------------------------------------------------------------------------- @@ -381,6 +392,10 @@ group_stats(iter_t *iter, const char *name, const H5O_info_t *oi) * Programmer: Quincey Koziol * Tuesday, August 16, 2005 * + * Modifications: + * 2/2010; Vailin Choi + * Handle external data (brought over from trunk h5stat) + * *------------------------------------------------------------------------- */ static herr_t @@ -415,6 +430,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 +438,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 +546,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) @@ -533,6 +558,7 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) else iter->dset_comptype[H5_NFILTERS_IMPL - 1]++; /*other filters*/ } /* end if */ + } /* end for */ } /* endif nfltr */ @@ -554,12 +580,18 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) * Failure: -1 * * Programmer: Vailin Choi; July 7th, 2009 + * + * Modifications: + * 2/2010; Vailin Choi + * Gather attribute info for named datatype * *------------------------------------------------------------------------- */ static herr_t datatype_stats(iter_t *iter, const H5O_info_t *oi) { + herr_t ret; + /* Gather statistics about this type of object */ iter->uniq_dtypes++; @@ -567,6 +599,10 @@ datatype_stats(iter_t *iter, const H5O_info_t *oi) iter->dtype_ohdr_info.total_size += oi->hdr.space.total; iter->dtype_ohdr_info.free_size += oi->hdr.space.free; + /* Update attribute metadata info */ + ret = attribute_stats(iter, oi); + assert(ret >= 0); + return 0; } /* end datatype_stats() */ @@ -668,6 +704,10 @@ lnk_stats(const char UNUSED *path, const H5L_info_t *li, void *_iter) * Programmer: Elena Pourmal * Saturday, August 12, 2006 * + * Modifications: + * 2/2010; Vailin Choi + * Handle -G and -T options + * *------------------------------------------------------------------------- */ static struct handler_t * @@ -682,9 +722,13 @@ parse_command_line(int argc, const char *argv[]) /* parse command line options */ while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) { switch ((char)opt) { - case 'A': - display_all = FALSE; - display_attr = TRUE; + case 'h': + usage(progname); + leave(EXIT_SUCCESS); + + case 'V': + print_version(progname); + leave(EXIT_SUCCESS); break; case 'F': @@ -699,6 +743,7 @@ parse_command_line(int argc, const char *argv[]) case 'G': display_all = FALSE; + display_group_metadata = TRUE; break; case 'g': @@ -706,13 +751,9 @@ parse_command_line(int argc, const char *argv[]) display_group = TRUE; break; - case 'T': - display_all = FALSE; - display_dtype_metadata = TRUE; - break; - case 'D': display_all = FALSE; + display_dset_metadata = TRUE; break; case 'd': @@ -720,13 +761,14 @@ parse_command_line(int argc, const char *argv[]) display_dset = TRUE; break; - case 'h': - usage(progname); - leave(EXIT_SUCCESS); + case 'T': + display_all = FALSE; + display_dset_dtype_meta = TRUE; + break; - case 'V': - print_version(progname); - leave(EXIT_SUCCESS); + case 'A': + display_all = FALSE; + display_attr = TRUE; break; case 'O': @@ -752,7 +794,7 @@ parse_command_line(int argc, const char *argv[]) } /* end if */ return hand; -} +} /* parse_command_line() */ /*------------------------------------------------------------------------- @@ -779,7 +821,7 @@ iter_init(iter_t *iter, hid_t fid) iter->fid = fid; return 0; -} +} /* iter_init() */ /*------------------------------------------------------------------------- @@ -811,7 +853,7 @@ print_file_info(const iter_t *iter) HDfprintf(stdout, "\tMax. # of objects in group: %Hu\n", iter->max_fanout); return 0; -} +} /* print_file_info() */ /*------------------------------------------------------------------------- @@ -826,20 +868,29 @@ print_file_info(const iter_t *iter) * Programmer: Elena Pourmal * Saturday, August 12, 2006 * + * Modifications: + * 2/2010; Vailin Choi + * Brought over from trunk h5stat + * (Note: couldn't get superblock size because of H5F_info_t in H5public.h) + * *------------------------------------------------------------------------- */ 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("File space information for file metadata (in bytes):\n"); + 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); @@ -849,17 +900,18 @@ 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); - return 0; -} +} /* print_file_metadata() */ /*------------------------------------------------------------------------- @@ -916,60 +968,35 @@ print_group_info(const iter_t *iter) printf("\tTotal # of groups: %lu\n", total); return 0; -} +} /* print_group_info() */ - /*------------------------------------------------------------------------- - * Function: print_attr_info + * Function: print_group_metadata * - * Purpose: Prints information about attributes in the file + * Purpose: Prints file space information for groups' metadata * * Return: Success: 0 * * Failure: Never fails * - * Programmer: Vailin Choi - * July 12, 2007 - * - * Modifications: + * Programmer: Vailin Choi; October 2009 * *------------------------------------------------------------------------- */ static herr_t -print_attr_info(const iter_t *iter) +print_group_metadata(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("File space information for groups' metadata (in bytes):\n"); - printf("Small # of attributes:\n"); - total = 0; - for(u = 1; u < SIZE_SMALL_ATTRS; u++) { - if(iter->num_small_attrs[u] > 0) { - printf("\t# of objects with %u attributes: %lu\n", u, iter->num_small_attrs[u]); - total += iter->num_small_attrs[u]; - } /* end if */ - } /* end for */ - printf("\tTotal # of objects with small # of attributes: %lu\n", total); + HDfprintf(stdout, "\tObject headers (total/unused): %Hu/%Hu\n", + iter->group_ohdr_info.total_size, iter->group_ohdr_info.free_size); - printf("Attribute bins:\n"); - total = 0; - power = 1; - for(u = 1; u < iter->attr_nbins; u++) { - if(iter->attr_bins[u] > 0) { - printf("\t# of objects with %lu - %lu attributes: %lu\n", power, (power * 10) - 1, - iter->attr_bins[u]); - total += iter->attr_bins[u]; - } /* end if */ - power *= 10; - } /* end for */ - printf("\tTotal # of objects with attributes: %lu\n", total); - printf("\tMax. # of attributes to objects: %lu\n", (unsigned long)iter->max_attrs); + HDfprintf(stdout, "\tB-tree/List: %Hu\n", iter->groups_btree_storage_size); + HDfprintf(stdout, "\tHeap: %Hu\n", iter->groups_heap_storage_size); return 0; -} +} /* print_group_metadata() */ - /*------------------------------------------------------------------------- * Function: print_dataset_info * @@ -983,6 +1010,8 @@ print_attr_info(const iter_t *iter) * Saturday, August 12, 2006 * * Modifications: + * 2/2010; Vailin Choi + * Moved coding for datatype to another routine. * *------------------------------------------------------------------------- */ @@ -991,7 +1020,6 @@ print_dataset_info(const iter_t *iter) { unsigned long power; /* Temporary "power" for bins */ unsigned long total; /* Total count for various statistics */ - size_t dtype_size; /* Size of encoded datatype */ unsigned u; /* Local index variable */ if(iter->uniq_dsets > 0) { @@ -1037,6 +1065,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++) @@ -1055,25 +1084,131 @@ print_dataset_info(const iter_t *iter) printf("\t\tSCALEOFFSET filter: %lu\n", iter->dset_comptype[H5Z_FILTER_SCALEOFFSET]); printf("\t\tUSER-DEFINED filter: %lu\n", iter->dset_comptype[H5_NFILTERS_IMPL-1]); - if(display_dtype_metadata) { - printf("Dataset datatype information:\n"); - printf("\t# of unique datatypes used by datasets: %lu\n", iter->dset_ntypes); - total = 0; - for(u = 0; u < iter->dset_ntypes; u++) { - H5Tencode(iter->dset_type_info[u].tid, NULL, &dtype_size); - printf("\tDataset datatype #%u:\n", u); - printf("\t\tCount (total/named) = (%lu/%lu)\n", iter->dset_type_info[u].count, iter->dset_type_info[u].named); - printf("\t\tSize (desc./elmt) = (%lu/%lu)\n", (unsigned long)dtype_size, - (unsigned long)H5Tget_size(iter->dset_type_info[u].tid)); - H5Tclose(iter->dset_type_info[u].tid); - total += iter->dset_type_info[u].count; - } /* end for */ - printf("\tTotal dataset datatype count: %lu\n", total); - } } /* end if */ return 0; -} +} /* print_dataset_info() */ + +/*------------------------------------------------------------------------- + * Function: print_dataset_metadata + * + * Purpose: Prints file space information for datasets' metadata + * + * Return: Success: 0 + * + * Failure: Never fails + * + * Programmer: Vailin Choi; October 2009 + * Brought over from trunk h5stat. + * + *------------------------------------------------------------------------- + */ +static herr_t +print_dset_metadata(const iter_t *iter) +{ + printf("File space information for datasets' metadata (in bytes):\n"); + + HDfprintf(stdout, "\tObject headers (total/unused): %Hu/%Hu\n", + iter->dset_ohdr_info.total_size, iter->dset_ohdr_info.free_size); + + HDfprintf(stdout, "\tIndex for Chunked datasets: %Hu\n", + iter->datasets_index_storage_size); + HDfprintf(stdout, "\tHeap: %Hu\n", iter->datasets_heap_storage_size); + + return 0; +} /* print_dset_metadata() */ + + +/*------------------------------------------------------------------------- + * Function: print_dset_dtype_meta + * + * Purpose: Prints datasets' datatype information + * + * Return: Success: 0 + * + * Failure: Never fails + * + * Modifications: + * Moved from print_dataset_info() + * + *------------------------------------------------------------------------- + */ +static herr_t +print_dset_dtype_meta(const iter_t *iter) +{ + unsigned long total; /* Total count for various statistics */ + size_t dtype_size; /* Size of encoded datatype */ + unsigned u; /* Local index variable */ + + if(iter->dset_ntypes) { + printf("Dataset datatype information:\n"); + printf("\t# of unique datatypes used by datasets: %lu\n", iter->dset_ntypes); + total = 0; + for(u = 0; u < iter->dset_ntypes; u++) { + H5Tencode(iter->dset_type_info[u].tid, NULL, &dtype_size); + printf("\tDataset datatype #%u:\n", u); + printf("\t\tCount (total/named) = (%lu/%lu)\n", + iter->dset_type_info[u].count, iter->dset_type_info[u].named); + printf("\t\tSize (desc./elmt) = (%lu/%lu)\n", (unsigned long)dtype_size, + (unsigned long)H5Tget_size(iter->dset_type_info[u].tid)); + H5Tclose(iter->dset_type_info[u].tid); + total += iter->dset_type_info[u].count; + } /* end for */ + printf("\tTotal dataset datatype count: %lu\n", total); + } + + return 0; +} /* print_dset_dtype_meta() */ + +/*------------------------------------------------------------------------- + * Function: print_attr_info + * + * Purpose: Prints information about attributes in the file + * + * Return: Success: 0 + * + * Failure: Never fails + * + * Programmer: Vailin Choi + * July 12, 2007 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +print_attr_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 # of attributes:\n"); + total = 0; + for(u = 1; u < SIZE_SMALL_ATTRS; u++) { + if(iter->num_small_attrs[u] > 0) { + printf("\t# of objects with %u attributes: %lu\n", u, iter->num_small_attrs[u]); + total += iter->num_small_attrs[u]; + } /* end if */ + } /* end for */ + printf("\tTotal # of objects with small # of attributes: %lu\n", total); + + printf("Attribute bins:\n"); + total = 0; + power = 1; + for(u = 1; u < iter->attr_nbins; u++) { + if(iter->attr_bins[u] > 0) { + printf("\t# of objects with %lu - %lu attributes: %lu\n", power, (power * 10) - 1, + iter->attr_bins[u]); + total += iter->attr_bins[u]; + } /* end if */ + power *= 10; + } /* end for */ + printf("\tTotal # of objects with attributes: %lu\n", total); + printf("\tMax. # of attributes to objects: %lu\n", (unsigned long)iter->max_attrs); + + return 0; +} /* print_attr_info() */ /*------------------------------------------------------------------------- @@ -1095,19 +1230,29 @@ print_file_statistics(const iter_t *iter) { if(display_all) { display_file = TRUE; - display_file_metadata = TRUE; display_group = TRUE; display_dset = TRUE; - display_dtype_metadata = TRUE; + display_dset_dtype_meta = TRUE; display_attr = TRUE; + + display_file_metadata = TRUE; + display_group_metadata = TRUE; + display_dset_metadata = TRUE; } if(display_file) print_file_info(iter); if(display_file_metadata) print_file_metadata(iter); + if(display_group) print_group_info(iter); + if(!display_all && display_group_metadata) print_group_metadata(iter); + if(display_dset) print_dataset_info(iter); + if(display_dset_dtype_meta) print_dset_dtype_meta(iter); + if(!display_all && display_dset_metadata) print_dset_metadata(iter); + if(display_attr) print_attr_info(iter); -} +} /* print_file_statistics() */ + /*------------------------------------------------------------------------- @@ -1130,7 +1275,7 @@ static void print_object_statistics(const char *name) { printf("Object name %s\n", name); -} +} /* print_object_statistics() */ /*------------------------------------------------------------------------- @@ -1156,15 +1301,25 @@ print_statistics(const char *name, const iter_t *iter) print_object_statistics(name); else print_file_statistics(iter); -} +} /* print_statistics() */ +/*------------------------------------------------------------------------- + * Function: main + * + * Modifications: + * 2/2010; Vailin Choi + * Get the size of user block + * + *------------------------------------------------------------------------- + */ int main(int argc, const char *argv[]) { iter_t iter; const char *fname = NULL; hid_t fid; + hid_t fcpl; /* file creation property id */ struct handler_t *hand; H5F_info_t finfo; @@ -1202,6 +1357,12 @@ main(int argc, const char *argv[]) iter.SM_heap_storage_size = finfo.sohm.msgs_info.heap_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"); + /* Walk the objects or all file */ if(display_object) { unsigned u; @@ -1230,5 +1391,5 @@ main(int argc, const char *argv[]) } leave(EXIT_SUCCESS); -} +} /* main() */ diff --git a/tools/h5stat/testfiles/h5stat_filters-F.ddl b/tools/h5stat/testfiles/h5stat_filters-F.ddl index 6bc6cc2..e20ef87 100644 --- a/tools/h5stat/testfiles/h5stat_filters-F.ddl +++ b/tools/h5stat/testfiles/h5stat_filters-F.ddl @@ -2,11 +2,13 @@ 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: +File space information for file metadata (in bytes): + 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 +16,10 @@ 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 diff --git a/tools/h5stat/testfiles/h5stat_filters-UD.ddl b/tools/h5stat/testfiles/h5stat_filters-UD.ddl new file mode 100644 index 0000000..decfb81 --- /dev/null +++ b/tools/h5stat/testfiles/h5stat_filters-UD.ddl @@ -0,0 +1,8 @@ +############################# +Expected output for 'h5stat -D h5stat_filters.h5' +############################# +Filename: h5stat_filters.h5 +File space information for datasets' metadata (in bytes): + Object headers (total/unused): 4136/1344 + Index for Chunked datasets: 31392 + Heap: 72 diff --git a/tools/h5stat/testfiles/h5stat_filters-UT.ddl b/tools/h5stat/testfiles/h5stat_filters-UT.ddl new file mode 100644 index 0000000..189eaa6 --- /dev/null +++ b/tools/h5stat/testfiles/h5stat_filters-UT.ddl @@ -0,0 +1,13 @@ +############################# +Expected output for 'h5stat -T h5stat_filters.h5' +############################# +Filename: h5stat_filters.h5 +Dataset datatype information: + # of unique datatypes used by datasets: 2 + Dataset datatype #0: + Count (total/named) = (14/0) + Size (desc./elmt) = (14/4) + Dataset datatype #1: + Count (total/named) = (1/0) + Size (desc./elmt) = (14/4) + Total dataset datatype count: 15 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..03ea440 100644 --- a/tools/h5stat/testfiles/h5stat_filters.ddl +++ b/tools/h5stat/testfiles/h5stat_filters.ddl @@ -10,11 +10,13 @@ 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: +File space information for file metadata (in bytes): + 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 +24,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 Small groups: Total # of small groups: 0 Group bins: @@ -46,7 +49,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_help1.ddl b/tools/h5stat/testfiles/h5stat_help1.ddl index 0a86b4c..9e59044 100644 --- a/tools/h5stat/testfiles/h5stat_help1.ddl +++ b/tools/h5stat/testfiles/h5stat_help1.ddl @@ -7,11 +7,11 @@ Usage: h5stat [OPTIONS] file -h, --help Print a usage message and exit -V, --version Print version number and exit -f, --file Print file information - -F, --filemetadata Print file metadata + -F, --filemetadata Print file space information for file's metadata -g, --group Print group information - -G, --groupmetadata Print group metadata + -G, --groupmetadata Print file space information for groups' metadata -d, --dset Print dataset information - -D, --dsetmetadata Print dataset metadata - -T, --dtypemetadata Print datatype metadata + -D, --dsetmetadata Print file space information for datasets' metadata + -T, --dtypemetadata Print datasets' datatype metadata -A, --attribute Print attribute information diff --git a/tools/h5stat/testfiles/h5stat_help2.ddl b/tools/h5stat/testfiles/h5stat_help2.ddl index e41eb9e..3276273 100644 --- a/tools/h5stat/testfiles/h5stat_help2.ddl +++ b/tools/h5stat/testfiles/h5stat_help2.ddl @@ -7,11 +7,11 @@ Usage: h5stat [OPTIONS] file -h, --help Print a usage message and exit -V, --version Print version number and exit -f, --file Print file information - -F, --filemetadata Print file metadata + -F, --filemetadata Print file space information for file's metadata -g, --group Print group information - -G, --groupmetadata Print group metadata + -G, --groupmetadata Print file space information for groups' metadata -d, --dset Print dataset information - -D, --dsetmetadata Print dataset metadata - -T, --dtypemetadata Print datatype metadata + -D, --dsetmetadata Print file space information for datasets' metadata + -T, --dtypemetadata Print datasets' datatype metadata -A, --attribute Print attribute information diff --git a/tools/h5stat/testfiles/h5stat_newgrat-UA.ddl b/tools/h5stat/testfiles/h5stat_newgrat-UA.ddl new file mode 100644 index 0000000..70f9a82 --- /dev/null +++ b/tools/h5stat/testfiles/h5stat_newgrat-UA.ddl @@ -0,0 +1,10 @@ +############################# +Expected output for 'h5stat -A h5stat_newgrat.h5' +############################# +Filename: h5stat_newgrat.h5 +Small # of attributes: + Total # of objects with small # of attributes: 0 +Attribute bins: + # of objects with 100 - 999 attributes: 1 + Total # of objects with attributes: 1 + Max. # of attributes to objects: 100 diff --git a/tools/h5stat/testfiles/h5stat_newgrat-UG.ddl b/tools/h5stat/testfiles/h5stat_newgrat-UG.ddl new file mode 100644 index 0000000..b300a8f --- /dev/null +++ b/tools/h5stat/testfiles/h5stat_newgrat-UG.ddl @@ -0,0 +1,8 @@ +############################# +Expected output for 'h5stat -G h5stat_newgrat.h5' +############################# +Filename: h5stat_newgrat.h5 +File space information for groups' metadata (in bytes): + Object headers (total/unused): 5145147/3220092 + B-tree/List: 470054 + Heap: 739102 diff --git a/tools/h5stat/testfiles/h5stat_newgrat.ddl b/tools/h5stat/testfiles/h5stat_newgrat.ddl index 4f9bcac..9ee3b5f 100644 --- a/tools/h5stat/testfiles/h5stat_newgrat.ddl +++ b/tools/h5stat/testfiles/h5stat_newgrat.ddl @@ -10,11 +10,13 @@ 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: +File space information for file metadata (in bytes): + Superblock extension: 0 + 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 @@ -22,12 +24,13 @@ Storage information: B-tree/List: 2598 Heap: 4442 Chunked datasets: - B-tree: 0 + Index: 0 + Datasets: + Heap: 0 Shared Messages: Header: 0 B-tree/List: 0 Heap: 0 - Superblock extension: 0 Small groups: # of groups of size 0: 35000 Total # of small groups: 35000 @@ -45,6 +48,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 diff --git a/tools/h5stat/testfiles/h5stat_tsohm.ddl b/tools/h5stat/testfiles/h5stat_tsohm.ddl index e536c33..e3b58d5 100644 --- a/tools/h5stat/testfiles/h5stat_tsohm.ddl +++ b/tools/h5stat/testfiles/h5stat_tsohm.ddl @@ -10,11 +10,13 @@ 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: +File space information for file metadata (in bytes): + 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 +24,13 @@ 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 Small groups: # of groups of size 3: 1 Total # of small groups: 1 @@ -44,6 +47,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 diff --git a/tools/h5stat/testh5stat.sh.in b/tools/h5stat/testh5stat.sh.in index e387eb1..6c0bb3e 100644 --- a/tools/h5stat/testh5stat.sh.in +++ b/tools/h5stat/testh5stat.sh.in @@ -123,11 +123,15 @@ TOOLTEST h5stat_filters-F.ddl -F h5stat_filters.h5 TOOLTEST h5stat_filters-d.ddl -d h5stat_filters.h5 TOOLTEST h5stat_filters-g.ddl -g h5stat_filters.h5 TOOLTEST h5stat_filters-dT.ddl -dT h5stat_filters.h5 +TOOLTEST h5stat_filters-UD.ddl -D h5stat_filters.h5 +TOOLTEST h5stat_filters-UT.ddl -T h5stat_filters.h5 # h5stat_tsohm.h5 is a copy of ../../../test/tsohm.h5 generated by tsohm.c # as of release 1.8.0-alpha4 TOOLTEST h5stat_tsohm.ddl h5stat_tsohm.h5 # h5stat_newgrat.h5 is generated by h5stat_gentest.c TOOLTEST h5stat_newgrat.ddl h5stat_newgrat.h5 +TOOLTEST h5stat_newgrat-UG.ddl -G h5stat_newgrat.h5 +TOOLTEST h5stat_newgrat-UA.ddl -A h5stat_newgrat.h5 if test $nerrors -eq 0 ; then |