diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2010-04-22 22:57:20 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2010-04-22 22:57:20 (GMT) |
commit | 954c91c5517020bee4c09d3012544e70c7182529 (patch) | |
tree | 5cd31e5d243fc13f04e6f4751f9c944b164575b3 /src/H5timer.c | |
parent | 8a27e4f4a6a624931ba0b86444e8f21e8d735888 (diff) | |
download | hdf5-954c91c5517020bee4c09d3012544e70c7182529.zip hdf5-954c91c5517020bee4c09d3012544e70c7182529.tar.gz hdf5-954c91c5517020bee4c09d3012544e70c7182529.tar.bz2 |
[svn-r18620] Description:
Bring r18600:18619 from trunk to revise_chunks branch
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Mac OS X/32 10.6.3 (amazon) in debug mode
Mac OS X/32 10.6.3 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
Diffstat (limited to 'src/H5timer.c')
-rw-r--r-- | src/H5timer.c | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/src/H5timer.c b/src/H5timer.c index e417f8b..8334402 100644 --- a/src/H5timer.c +++ b/src/H5timer.c @@ -131,16 +131,16 @@ H5_timer_begin (H5_timer_t *timer) #ifdef H5_HAVE_GETRUSAGE HDgetrusage (RUSAGE_SELF, &rusage); timer->utime = (double)rusage.ru_utime.tv_sec + - ((double)rusage.ru_utime.tv_usec/1e6); + ((double)rusage.ru_utime.tv_usec / 1e6); timer->stime = (double)rusage.ru_stime.tv_sec + - ((double)rusage.ru_stime.tv_usec/1e6); + ((double)rusage.ru_stime.tv_usec / 1e6); #else timer->utime = 0.0; timer->stime = 0.0; #endif #ifdef H5_HAVE_GETTIMEOFDAY HDgettimeofday (&etime, NULL); - timer->etime = (double)etime.tv_sec + ((double)etime.tv_usec/1e6); + timer->etime = (double)etime.tv_sec + ((double)etime.tv_usec / 1e6); #else timer->etime = 0.0; #endif @@ -216,37 +216,34 @@ H5_bandwidth(char *buf/*out*/, double nbytes, double nseconds) { double bw; - if (nseconds<=0.0) { + if(nseconds <= 0.0) HDstrcpy(buf, " NaN"); - } else { + else { bw = nbytes/nseconds; - if (fabs(bw) < 0.0000000001) { + if(fabs(bw) < 0.0000000001) /* That is == 0.0, but direct comparison between floats is bad */ HDstrcpy(buf, "0.000 B/s"); - } else if (bw<1.0) { + else if(bw < 1.0) sprintf(buf, "%10.4e", bw); - } else if (bw<1024.0) { + else if(bw < 1024.0) { sprintf(buf, "%05.4f", bw); HDstrcpy(buf+5, " B/s"); - } else if (bw<1024.0*1024.0) { - sprintf(buf, "%05.4f", bw/1024.0); + } else if(bw < (1024.0 * 1024.0)) { + sprintf(buf, "%05.4f", bw / 1024.0); HDstrcpy(buf+5, " kB/s"); - } else if (bw<1024.0*1024.0*1024.0) { - sprintf(buf, "%05.4f", bw/(1024.0*1024.0)); + } else if(bw < (1024.0 * 1024.0 * 1024.0)) { + sprintf(buf, "%05.4f", bw / (1024.0 * 1024.0)); HDstrcpy(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)); + } else if(bw < (1024.0 * 1024.0 * 1024.0 * 1024.0)) { + sprintf(buf, "%05.4f", bw / (1024.0 * 1024.0 * 1024.0)); HDstrcpy(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)); + } 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)); HDstrcpy(buf+5, " TB/s"); } else { sprintf(buf, "%10.4e", bw); - if (HDstrlen(buf)>10) { + if(HDstrlen(buf) > 10) sprintf(buf, "%10.3e", bw); - } } } } /* end H5_bandwidth() */ |