summaryrefslogtreecommitdiffstats
path: root/src/H5timer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5timer.c')
-rw-r--r--src/H5timer.c89
1 files changed, 40 insertions, 49 deletions
diff --git a/src/H5timer.c b/src/H5timer.c
index 301d98b..94f2883 100644
--- a/src/H5timer.c
+++ b/src/H5timer.c
@@ -90,8 +90,6 @@
* Programmer: Robb Matzke
* Thursday, April 16, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void
@@ -112,8 +110,6 @@ H5_timer_reset (H5_timer_t *timer)
* Programmer: Robb Matzke
* Thursday, April 16, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void
@@ -131,18 +127,18 @@ 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 / 1e6F);
timer->stime = (double)rusage.ru_stime.tv_sec +
- ((double)rusage.ru_stime.tv_usec / 1e6);
+ ((double)rusage.ru_stime.tv_usec / 1e6F);
#else
- timer->utime = 0.0;
- timer->stime = 0.0;
+ timer->utime = 0.0F;
+ timer->stime = 0.0F;
#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 / 1e6F);
#else
- timer->etime = 0.0;
+ timer->etime = 0.0F;
#endif
} /* end H5_timer_begin() */
@@ -160,8 +156,6 @@ H5_timer_begin (H5_timer_t *timer)
* Programmer: Robb Matzke
* Thursday, April 16, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void
@@ -170,16 +164,16 @@ H5_timer_end (H5_timer_t *sum/*in,out*/, H5_timer_t *timer/*in,out*/)
H5_timer_t now;
HDassert(timer);
- H5_timer_begin (&now);
+ H5_timer_begin(&now);
- timer->utime = MAX(0.0, now.utime - timer->utime);
- timer->stime = MAX(0.0, now.stime - timer->stime);
- timer->etime = MAX(0.0, now.etime - timer->etime);
+ timer->utime = MAX(0.0F, now.utime - timer->utime);
+ timer->stime = MAX(0.0F, now.stime - timer->stime);
+ timer->etime = MAX(0.0F, now.etime - timer->etime);
if (sum) {
- sum->utime += timer->utime;
- sum->stime += timer->stime;
- sum->etime += timer->etime;
+ sum->utime += timer->utime;
+ sum->stime += timer->stime;
+ sum->etime += timer->etime;
}
} /* end H5_timer_end() */
@@ -207,8 +201,6 @@ H5_timer_end (H5_timer_t *sum/*in,out*/, H5_timer_t *timer/*in,out*/)
* Programmer: Robb Matzke
* Wednesday, August 5, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void
@@ -216,35 +208,34 @@ H5_bandwidth(char *buf/*out*/, double nbytes, double nseconds)
{
double bw;
- if(nseconds <= 0.0)
- HDstrcpy(buf, " NaN");
+ if(nseconds <= 0.0F)
+ HDstrcpy(buf, " NaN");
else {
- bw = nbytes/nseconds;
- if(HDfabs(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)
- sprintf(buf, "%10.4e", bw);
- 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);
- HDstrcpy(buf+5, " kB/s");
- } 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));
- 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));
- HDstrcpy(buf+5, " TB/s");
- } else {
- sprintf(buf, "%10.4e", bw);
- if(HDstrlen(buf) > 10)
- sprintf(buf, "%10.3e", bw);
- }
+ bw = nbytes/nseconds;
+ if(H5_DBL_ABS_EQUAL(bw, 0.0F))
+ HDstrcpy(buf, "0.000 B/s");
+ else if(bw < 1.0F)
+ sprintf(buf, "%10.4e", bw);
+ else if(bw < H5_KB) {
+ sprintf(buf, "%05.4f", bw);
+ HDstrcpy(buf+5, " B/s");
+ } else if(bw < H5_MB) {
+ sprintf(buf, "%05.4f", bw / H5_KB);
+ HDstrcpy(buf+5, " kB/s");
+ } else if(bw < H5_GB) {
+ sprintf(buf, "%05.4f", bw / H5_MB);
+ HDstrcpy(buf+5, " MB/s");
+ } else if(bw < H5_TB) {
+ sprintf(buf, "%05.4f", bw / H5_GB);
+ HDstrcpy(buf+5, " GB/s");
+ } else if(bw < H5_EB) {
+ sprintf(buf, "%05.4f", bw / H5_TB);
+ HDstrcpy(buf+5, " TB/s");
+ } else {
+ sprintf(buf, "%10.4e", bw);
+ if(HDstrlen(buf) > 10)
+ sprintf(buf, "%10.3e", bw);
+ }
}
} /* end H5_bandwidth() */