summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2008-06-18 19:55:47 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2008-06-18 19:55:47 (GMT)
commitf1566336ae8a19e34d23e9fc7fa4a9844a6fa26a (patch)
tree72ddbeae8bd36de5762dc45f867672a93d1c37aa /tools
parent8a75f17670000b64440890e710b2f9053d2ae31e (diff)
downloadhdf5-f1566336ae8a19e34d23e9fc7fa4a9844a6fa26a.zip
hdf5-f1566336ae8a19e34d23e9fc7fa4a9844a6fa26a.tar.gz
hdf5-f1566336ae8a19e34d23e9fc7fa4a9844a6fa26a.tar.bz2
[svn-r15234] Description:
Bring revisions 14800:14900 from trunk into metadata journaling branch Tested on: FreeBSD/32 6.2 (duty) in debug mode FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Mac OS X/32 10.5.2 (amazon) in debug mode Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
Diffstat (limited to 'tools')
-rw-r--r--tools/h5dump/h5dump.c83
-rw-r--r--tools/h5recover/Makefile.in2
-rw-r--r--tools/testfiles/tallfilters.ddl2
-rw-r--r--tools/testfiles/tdeflate.ddl2
-rw-r--r--tools/testfiles/tnbit.ddl2
-rw-r--r--tools/testfiles/tscaleoffset.ddl2
-rw-r--r--tools/testfiles/tszip.ddl2
7 files changed, 83 insertions, 12 deletions
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index 70d889f..2389ef4 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -2440,6 +2440,9 @@ static void dump_fill_value(hid_t dcpl,hid_t type_id, hid_t obj_id)
*
* Programmer: pvn
*
+ * Modifications: pvn, March 28, 2008
+ * Add a COMPRESSION ratio information for cases when filters are present
+ *
*-------------------------------------------------------------------------
*/
static void
@@ -2455,7 +2458,7 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id)
unsigned szip_pixels_per_block;
hsize_t chsize[64]; /* chunk size in elements */
int rank; /* rank */
- char name[256]; /* external file name */
+ char name[256]; /* external file name */
off_t offset; /* offset of external file */
hsize_t size; /* size of external file */
H5D_fill_value_t fvstatus;
@@ -2467,11 +2470,12 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id)
unsigned j;
storage_size=H5Dget_storage_size(obj_id);
+ nfilters = H5Pget_nfilters(dcpl_id);
ioffset=H5Dget_offset(obj_id);
next=H5Pget_external_count(dcpl_id);
strcpy(f_name,"\0");
- /*-------------------------------------------------------------------------
+ /*-------------------------------------------------------------------------
* STORAGE_LAYOUT
*-------------------------------------------------------------------------
*/
@@ -2490,7 +2494,72 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id)
HDfprintf(stdout, ", %Hu", chsize[i]);
printf(" %s\n", dump_header_format->dataspacedimend);
indentation(indent + COL);
- HDfprintf(stdout, "SIZE %Hu\n ", storage_size);
+
+
+ /* if there are filters, print a compression ratio */
+ if ( nfilters )
+ {
+
+ hid_t sid = H5Dget_space( obj_id );
+ hid_t tid = H5Dget_type( obj_id );
+ size_t datum_size = H5Tget_size( tid );
+ hsize_t dims[H5S_MAX_RANK];
+ int ndims = H5Sget_simple_extent_dims( sid, dims, NULL);
+ hsize_t nelmts = 1;
+ hsize_t size;
+ double per = 0;
+ hssize_t a, b;
+ int ok = 0;
+
+ /* only print the compression ratio for these filters */
+ for ( i = 0; i < nfilters; i++)
+ {
+ cd_nelmts = NELMTS(cd_values);
+ filtn = H5Pget_filter2(dcpl_id, (unsigned)i, &filt_flags, &cd_nelmts,
+ cd_values, sizeof(f_name), f_name, NULL);
+
+ switch (filtn)
+ {
+ case H5Z_FILTER_DEFLATE:
+ case H5Z_FILTER_SZIP:
+ case H5Z_FILTER_NBIT:
+ case H5Z_FILTER_SCALEOFFSET:
+ ok = 1;
+ break;
+ }
+ }
+
+ if (ndims && ok )
+ {
+
+ for (i = 0; i < ndims; i++)
+ {
+ nelmts *= dims[i];
+ }
+ size = nelmts * datum_size;
+
+ a = size; b = storage_size;
+ if (a!=0)
+ per = (double) (b-a)/a;
+
+ per = -per;
+ per *=100;
+
+ HDfprintf(stdout, "SIZE %Hu (%.1f%%COMPRESSION)\n ", storage_size, per);
+
+ }
+ else
+ HDfprintf(stdout, "SIZE %Hu\n ", storage_size);
+
+
+ H5Sclose(sid);
+ H5Tclose(tid);
+
+ }
+ else
+ {
+ HDfprintf(stdout, "SIZE %Hu\n ", storage_size);
+ }
/*end indent */
indent -= COL;
@@ -2563,14 +2632,16 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id)
* FILTERS
*-------------------------------------------------------------------------
*/
- nfilters = H5Pget_nfilters(dcpl_id);
+
indentation(indent + COL);
printf("%s %s\n", FILTERS, BEGIN);
indent += COL;
- if (nfilters) {
- for (i=0; i<nfilters; i++) {
+ if (nfilters)
+ {
+ for (i=0; i<nfilters; i++)
+ {
cd_nelmts = NELMTS(cd_values);
filtn = H5Pget_filter2(dcpl_id, (unsigned)i, &filt_flags, &cd_nelmts,
cd_values, sizeof(f_name), f_name, NULL);
diff --git a/tools/h5recover/Makefile.in b/tools/h5recover/Makefile.in
index 74ce765..5bb3bbb 100644
--- a/tools/h5recover/Makefile.in
+++ b/tools/h5recover/Makefile.in
@@ -49,7 +49,7 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/testh5recover.sh.in $(top_srcdir)/config/commence.am \
$(top_srcdir)/config/conclude.am
check_PROGRAMS = $(am__EXEEXT_1)
diff --git a/tools/testfiles/tallfilters.ddl b/tools/testfiles/tallfilters.ddl
index 282c085..43c27a9 100644
--- a/tools/testfiles/tallfilters.ddl
+++ b/tools/testfiles/tallfilters.ddl
@@ -7,7 +7,7 @@ DATASET "all" {
DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) }
STORAGE_LAYOUT {
CHUNKED ( 10, 5 )
- SIZE 458
+ SIZE 458 (42.8%COMPRESSION)
}
FILTERS {
PREPROCESSING SHUFFLE
diff --git a/tools/testfiles/tdeflate.ddl b/tools/testfiles/tdeflate.ddl
index fc98432..cc5b49b 100644
--- a/tools/testfiles/tdeflate.ddl
+++ b/tools/testfiles/tdeflate.ddl
@@ -7,7 +7,7 @@ DATASET "deflate" {
DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) }
STORAGE_LAYOUT {
CHUNKED ( 10, 5 )
- SIZE 385
+ SIZE 385 (51.9%COMPRESSION)
}
FILTERS {
COMPRESSION DEFLATE { LEVEL 9 }
diff --git a/tools/testfiles/tnbit.ddl b/tools/testfiles/tnbit.ddl
index a8bf549..2f932b5 100644
--- a/tools/testfiles/tnbit.ddl
+++ b/tools/testfiles/tnbit.ddl
@@ -7,7 +7,7 @@ DATASET "nbit" {
DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) }
STORAGE_LAYOUT {
CHUNKED ( 10, 5 )
- SIZE 76
+ SIZE 76 (90.5%COMPRESSION)
}
FILTERS {
COMPRESSION NBIT
diff --git a/tools/testfiles/tscaleoffset.ddl b/tools/testfiles/tscaleoffset.ddl
index 6693f92..c9a46f4 100644
--- a/tools/testfiles/tscaleoffset.ddl
+++ b/tools/testfiles/tscaleoffset.ddl
@@ -7,7 +7,7 @@ DATASET "scaleoffset" {
DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) }
STORAGE_LAYOUT {
CHUNKED ( 10, 5 )
- SIZE 152
+ SIZE 152 (81.0%COMPRESSION)
}
FILTERS {
COMPRESSION SCALEOFFSET { MIN BITS 4 }
diff --git a/tools/testfiles/tszip.ddl b/tools/testfiles/tszip.ddl
index 4c6af47..6411bc3 100644
--- a/tools/testfiles/tszip.ddl
+++ b/tools/testfiles/tszip.ddl
@@ -7,7 +7,7 @@ DATASET "szip" {
DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) }
STORAGE_LAYOUT {
CHUNKED ( 10, 5 )
- SIZE 372
+ SIZE 372 (53.5%COMPRESSION)
}
FILTERS {
COMPRESSION SZIP {