summaryrefslogtreecommitdiffstats
path: root/src/H5.c
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-08-05 22:22:59 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-08-05 22:22:59 (GMT)
commit002b1494b79e2fd638a0676745c340a9a9e9d8e7 (patch)
tree9b98efcd614acd02fd3de309d5d9f1d12048230e /src/H5.c
parent99506091b3a72fa05f364ea5fb2c51fad3b176ec (diff)
downloadhdf5-002b1494b79e2fd638a0676745c340a9a9e9d8e7.zip
hdf5-002b1494b79e2fd638a0676745c340a9a9e9d8e7.tar.gz
hdf5-002b1494b79e2fd638a0676745c340a9a9e9d8e7.tar.bz2
[svn-r569] Changes since 19980731
---------------------- ./bin/release Added ./Makefile to the distribution again -- it got lost in the changes last week although it isn't all that important a file since it gets clobbered by configure anyway. ./bin/trace ./doc/html/Filters.html ./doc/html/H5.format.html ./doc/html/H5.user.html ./src/H5.c ./src/H5D.c ./src/H5Dprivate.h ./src/H5E.c ./src/H5Epublic.h ./src/H5Farray.c ./src/H5Fistore.c ./src/H5Fprivate.h ./src/H5O.c ./src/H5Ocomp.c ./src/H5Oprivate.h ./src/H5P.c ./src/H5Ppublic.h ./src/H5Sall.c ./src/H5Shyper.c ./src/H5Spoint.c ./src/H5Sprivate.h ./src/H5Ssimp.c ./src/H5Z.c ./src/H5Zprivate.h ./src/H5Zpublic.h ./src/hdf5.h ./test/dsets.c ./tools/h5ls.c Added the data filter pipeline, a generalization of the compression stuff which allows things like checksums, encryption, compression, performance monitoring, etc. See ./doc/html/Filters.html for details -- it replaces the Compression.html doc. ./src/H5T.c Cleaned up debugging output. ./config/linux Added checks for egcs and pgcc and changed optimization flags for the compilers. ./src/H5G.c ./tools/h5dump.c Fixed compiler warnings in these files and others. ./configure.in ./src/H5private.h ./test/mtime.c Added a check for difftime() and defined HDdifftime() to do something else on systems that don't have difftime().
Diffstat (limited to 'src/H5.c')
-rw-r--r--src/H5.c95
1 files changed, 77 insertions, 18 deletions
diff --git a/src/H5.c b/src/H5.c
index 02b8f09..84e6018 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -55,7 +55,7 @@ FILE *fdopen(int fd, const char *mode);
#include <H5Pprivate.h> /*property lists */
#include <H5Sprivate.h> /*data spaces */
#include <H5Tprivate.h> /*data types */
-#include <H5Zprivate.h> /*compression */
+#include <H5Zprivate.h> /*filters */
#define PABLO_MASK H5_mask
@@ -113,7 +113,7 @@ H5_init_library(void)
/* Turn on tracing? */
const char *s = getenv ("HDF5_TRACE");
if (s && isdigit(*s)) {
- int fd = HDstrtol (s, NULL, 0);
+ int fd = (int)HDstrtol (s, NULL, 0);
H5_trace_g = HDfdopen (fd, "w");
}
}
@@ -795,7 +795,7 @@ HDstrtoll (const char *s, const char **rest, int base)
(*s>='a' && *s<'a'+base-10) ||
(*s>='A' && *s<'A'+base-10)))) {
if (!overflow) {
- int64 digit;
+ int64 digit = 0;
if (*s>='0' && *s<='9') digit = *s - '0';
else if (*s>='a' && *s<='z') digit = *s-'a'+10;
else digit = *s-'A'+10;
@@ -925,7 +925,74 @@ H5_timer_end (H5_timer_t *sum/*in,out*/, H5_timer_t *timer/*in,out*/)
sum->etime += timer->etime;
}
}
-
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5_bandwidth
+ *
+ * Purpose: Prints the bandwidth (bytes per second) in a field 10
+ * characters wide widh four digits of precision like this:
+ *
+ * NaN If <=0 seconds
+ * 1234. TB/s
+ * 123.4 TB/s
+ * 12.34 GB/s
+ * 1.234 MB/s
+ * 4.000 kB/s
+ * 1.000 B/s
+ * 0.000 B/s If NBYTES==0
+ * 1.2345e-10 For bandwidth less than 1
+ * 6.7893e+94 For exceptionally large values
+ * 6.678e+106 For really big values
+ *
+ * Return: void
+ *
+ * Programmer: Robb Matzke
+ * Wednesday, August 5, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5_bandwidth(char *buf/*out*/, double nbytes, double nseconds)
+{
+ double bw;
+
+ if (nseconds<=0.0) {
+ strcpy(buf, " NaN");
+ } else {
+ bw = nbytes/nseconds;
+ if (bw==0.0) {
+ strcpy(buf, "0.000 B/s");
+ } else if (bw<1.0) {
+ sprintf(buf, "%10.4e", bw);
+ } else if (bw<1024.0) {
+ sprintf(buf, "%05.4f", bw);
+ strcpy(buf+5, " B/s");
+ } else if (bw<1024.0*1024.0) {
+ sprintf(buf, "%05.4f", bw/1024.0);
+ strcpy(buf+5, " kB/s");
+ } else if (bw<1024.0*1024.0*1024.0) {
+ sprintf(buf, "%05.4f", bw/(1024.0*1024.0));
+ strcpy(buf+5, " MB/s");
+ } else if (bw<1024.0*1024.0*1024.0*1024.0) {
+ sprintf(buf, "%05.4f",
+ bw/(1024.0*1024.0*1024.0));
+ strcpy(buf+5, " GB/s");
+ } else if (bw<1024.0*1024.0*1024.0*1024.0*1024.0) {
+ sprintf(buf, "%05.4f",
+ bw/(1024.0*1024.0*1024.0*1024.0));
+ strcpy(buf+5, " TB/s");
+ } else {
+ sprintf(buf, "%10.4e", bw);
+ if (strlen(buf)>10) {
+ sprintf(buf, "%10.3e", bw);
+ }
+ }
+ }
+}
+
/*-------------------------------------------------------------------------
* Function: H5_trace
@@ -989,7 +1056,7 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
for (ptr=0; '*'==*type; type++) ptr++;
if ('['==*type) {
if ('a'==type[1]) {
- asize_idx = strtol(type+2, &rest, 10);
+ asize_idx = (int)strtol(type+2, &rest, 10);
assert(']'==*rest);
type = rest+1;
} else {
@@ -1959,7 +2026,7 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
case 'Z':
switch (type[1]) {
- case 'm':
+ case 'f':
if (ptr) {
if (vp) {
fprintf (out, "0x%lx", (unsigned long)vp);
@@ -1967,19 +2034,11 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
fprintf(out, "NULL");
}
} else {
- H5Z_method_t zmeth = va_arg (ap, H5Z_method_t);
- if (zmeth<0) {
- fprintf (out, "%d (range)", (int)zmeth);
- } else if (H5Z_NONE==zmeth) {
- fprintf (out, "H5Z_NONE");
- } else if (H5Z_DEFLATE==zmeth) {
- fprintf (out, "H5Z_DEFLATE");
- } else if (zmeth<H5Z_USERDEF_MIN) {
- fprintf (out, "H5Z_RES_%d", (int)zmeth);
- } else if (zmeth<=H5Z_USERDEF_MAX) {
- fprintf (out, "%d", (int)zmeth);
+ H5Z_filter_t id = va_arg (ap, H5Z_filter_t);
+ if (H5Z_FILTER_DEFLATE==id) {
+ fprintf (out, "H5Z_FILTER_DEFLATE");
} else {
- fprintf (out, "%d (range)", (int)zmeth);
+ fprintf (out, "%ld", (long)id);
}
}
break;