summaryrefslogtreecommitdiffstats
path: root/tools/h5dump
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2008-05-01 16:45:32 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2008-05-01 16:45:32 (GMT)
commit7a5edc075a27c9f1cb45260f3ffc2cce8ab5531e (patch)
tree0a99b34735e97d7829d30893e13daa3a9ea7fec1 /tools/h5dump
parentaec106e324ce20e5efb725c25a6a333c7970127b (diff)
downloadhdf5-7a5edc075a27c9f1cb45260f3ffc2cce8ab5531e.zip
hdf5-7a5edc075a27c9f1cb45260f3ffc2cce8ab5531e.tar.gz
hdf5-7a5edc075a27c9f1cb45260f3ffc2cce8ab5531e.tar.bz2
[svn-r14905] Introduced a ratio formula compression ratio = uncompressed size / compressed size
in the printing of the compression with 3 digits of precision per hdf-forum NASA developers suggestion tested: windows, linux, solaris
Diffstat (limited to 'tools/h5dump')
-rw-r--r--tools/h5dump/h5dump.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index 2389ef4..694c634 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -2507,7 +2507,7 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id)
int ndims = H5Sget_simple_extent_dims( sid, dims, NULL);
hsize_t nelmts = 1;
hsize_t size;
- double per = 0;
+ double ratio = 0;
hssize_t a, b;
int ok = 0;
@@ -2539,13 +2539,13 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id)
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);
+ /* compression ratio = uncompressed size / compressed size */
+
+ if (b!=0)
+ ratio = (double) a / (double) b;
+
+ HDfprintf(stdout, "SIZE %Hu (%.3f:1 COMPRESSION)\n ", storage_size, ratio);
}
else