From f7cd022ac47731c1781dfc408a729e00bf15d338 Mon Sep 17 00:00:00 2001 From: Patrick Lu Date: Mon, 25 Jan 1999 12:40:54 -0500 Subject: [svn-r1033] added some calls to get the time elapsed on WIN NT --- test/iopipe.c | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 105 insertions(+), 2 deletions(-) diff --git a/test/iopipe.c b/test/iopipe.c index 0e1fb12..d53537d 100644 --- a/test/iopipe.c +++ b/test/iopipe.c @@ -40,6 +40,11 @@ #include #endif +#ifdef HAVE_SYS_TIMEB +#include +#endif + + #define RAW_FILE_NAME "iopipe.raw" #define HDF5_FILE_NAME "iopipe.h5" #define HEADING "%-16s" @@ -94,12 +99,17 @@ print_stats (const char *prefix, ((double)(r_start->ru_stime.tv_sec)+ (double)(r_start->ru_stime.tv_usec)/1000000.0); #endif - +#ifndef HAVE_SYS_TIMEB e_time = ((double)(t_stop->tv_sec)+ (double)(t_stop->tv_usec)/1000000.0) - ((double)(t_start->tv_sec)+ (double)(t_start->tv_usec)/1000000.0); - +#else + e_time = ((double)(t_stop->tv_sec)+ + (double)(t_stop->tv_usec)/1000.0) - + ((double)(t_start->tv_sec)+ + (double)(t_start->tv_usec)/1000.0); +#endif bw = (double)nbytes / e_time; #ifdef HAVE_GETRUSAGE @@ -131,8 +141,12 @@ static void synchronize (void) { #ifdef HAVE_SYSTEM +#ifdef WIN32 + _flushall(); +#else system ("sync"); system ("df >/dev/null"); +#endif #if 0 /* * This works well on Linux to get rid of all cached disk buffers. The @@ -182,6 +196,11 @@ main (void) hssize_t start[2]; hsize_t count[2]; + +#ifdef HAVE_SYS_TIMEB + struct _timeb *tbstart = malloc(sizeof(struct _timeb)); + struct _timeb *tbstop = malloc(sizeof(struct _timeb)); +#endif /* * The extra cast in the following statement is a bug workaround for the * Win32 version 5.0 compiler. @@ -212,6 +231,10 @@ main (void) #endif #ifdef HAVE_GETTIMEOFDAY gettimeofday (&t_start, NULL); +#else +#ifdef HAVE_SYS_TIMEB + _ftime(tbstart); +#endif #endif fprintf (stderr, HEADING, "fill raw"); for (i=0; itime; + t_start.tv_usec = tbstart->millitm; + t_stop.tv_sec = tbstop->time; + t_stop.tv_usec = tbstop->millitm; +#endif #endif putc ('\n', stderr); print_stats ("fill raw", @@ -238,6 +269,10 @@ main (void) #endif #ifdef HAVE_GETTIMEOFDAY gettimeofday (&t_start, NULL); +#else +#ifdef HAVE_SYS_TIMEB + _ftime(tbstart); +#endif #endif fprintf (stderr, HEADING, "fill hdf5"); for (i=0; itime; + t_start.tv_usec = tbstart->millitm; + t_stop.tv_sec = tbstop->time; + t_stop.tv_usec = tbstop->millitm; +#endif #endif putc ('\n', stderr); print_stats ("fill hdf5", @@ -265,6 +308,10 @@ main (void) #endif #ifdef HAVE_GETTIMEOFDAY gettimeofday (&t_start, NULL); +#else +#ifdef HAVE_SYS_TIMEB + _ftime(tbstart); +#endif #endif fprintf (stderr, HEADING, "out raw"); for (i=0; itime; + t_start.tv_usec = tbstart->millitm; + t_stop.tv_sec = tbstop->time; + t_stop.tv_usec = tbstop->millitm; +#endif #endif putc ('\n', stderr); print_stats ("out raw", @@ -293,6 +348,10 @@ main (void) #endif #ifdef HAVE_GETTIMEOFDAY gettimeofday (&t_start, NULL); +#else +#ifdef HAVE_SYS_TIMEB + _ftime(tbstart); +#endif #endif fprintf (stderr, HEADING, "out hdf5"); for (i=0; itime; + t_start.tv_usec = tbstart->millitm; + t_stop.tv_sec = tbstop->time; + t_stop.tv_usec = tbstop->millitm; +#endif #endif putc ('\n', stderr); print_stats ("out hdf5", @@ -320,6 +387,10 @@ main (void) #endif #ifdef HAVE_GETTIMEOFDAY gettimeofday (&t_start, NULL); +#else +#ifdef HAVE_SYS_TIMEB + _ftime(tbstart); +#endif #endif fprintf (stderr, HEADING, "in raw"); for (i=0; itime; + t_start.tv_usec = tbstart->millitm; + t_stop.tv_sec = tbstop->time; + t_stop.tv_usec = tbstop->millitm; +#endif #endif putc ('\n', stderr); print_stats ("in raw", @@ -349,6 +428,10 @@ main (void) #endif #ifdef HAVE_GETTIMEOFDAY gettimeofday (&t_start, NULL); +#else +#ifdef HAVE_SYS_TIMEB + _ftime(tbstart); +#endif #endif fprintf (stderr, HEADING, "in hdf5"); for (i=0; itime; + t_start.tv_usec = tbstart->millitm; + t_stop.tv_sec = tbstop->time; + t_stop.tv_usec = tbstop->millitm; +#endif #endif putc ('\n', stderr); print_stats ("in hdf5", @@ -381,6 +472,10 @@ main (void) #endif #ifdef HAVE_GETTIMEOFDAY gettimeofday (&t_start, NULL); +#else +#ifdef HAVE_SYS_TIMEB + _ftime(tbstart); +#endif #endif fprintf (stderr, HEADING, "in hdf5 partial"); for (i=0; itime; + t_start.tv_usec = tbstart->millitm; + t_stop.tv_sec = tbstop->time; + t_stop.tv_usec = tbstop->millitm; +#endif #endif putc ('\n', stderr); print_stats ("in hdf5 partial", -- cgit v0.12