Commit 3fa91cb7 authored by pugmire's avatar pugmire

Switch to gettimeofday() for nonWindows timing.



git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@6871 18c085ea-50e0-402c-830e-de6fd14e8384
parent e476cdea
...@@ -78,6 +78,11 @@ static struct TIMEINFO initTimeInfo; ...@@ -78,6 +78,11 @@ static struct TIMEINFO initTimeInfo;
// Programmer: Mark C. Miller // Programmer: Mark C. Miller
// Creation: April 20, 2004 // Creation: April 20, 2004
// //
// Modifications:
//
// Dave Pugmire, Wed Apr 15 08:36:39 EDT 2009
// Use gettimeofday for all non-windows.
//
// **************************************************************************** // ****************************************************************************
static void static void
...@@ -85,10 +90,8 @@ GetCurrentTimeInfo(struct TIMEINFO &timeInfo) ...@@ -85,10 +90,8 @@ GetCurrentTimeInfo(struct TIMEINFO &timeInfo)
{ {
#if defined(_WIN32) #if defined(_WIN32)
_ftime(&timeInfo); _ftime(&timeInfo);
#elif defined(__APPLE__)
gettimeofday(&timeInfo, 0);
#else #else
ftime(&timeInfo); gettimeofday(&timeInfo, 0);
#endif #endif
} }
...@@ -627,6 +630,9 @@ TimingsManager::LookupTimer(const std::string &nm) ...@@ -627,6 +630,9 @@ TimingsManager::LookupTimer(const std::string &nm)
// Mark C. Miller, Wed Aug 2 19:58:44 PDT 2006 // Mark C. Miller, Wed Aug 2 19:58:44 PDT 2006
// Added test for emtpy filename. Added missing call to close ofile // Added test for emtpy filename. Added missing call to close ofile
// //
// Dave Pugmire, Wed Apr 15 08:36:39 EDT 2009
// Force fixed mode output for floating point numbers.
//
// **************************************************************************** // ****************************************************************************
void void
...@@ -672,6 +678,7 @@ TimingsManager::DumpTimings(void) ...@@ -672,6 +678,7 @@ TimingsManager::DumpTimings(void)
} }
else else
{ {
ofile<<std::fixed;
DumpTimings(ofile); DumpTimings(ofile);
ofile.close(); ofile.close();
} }
...@@ -774,20 +781,15 @@ TimingsManager::DumpTimings(ostream &out) ...@@ -774,20 +781,15 @@ TimingsManager::DumpTimings(ostream &out)
// Mark C. Miller, Tue Apr 20 21:12:05 PDT 2004 // Mark C. Miller, Tue Apr 20 21:12:05 PDT 2004
// Relocated from PlatformStopTimer // Relocated from PlatformStopTimer
// //
// Dave Pugmire, Wed Apr 15 08:36:39 EDT 2009
// Use gettimeofday for all non-windows.
//
// **************************************************************************** // ****************************************************************************
double double
TimingsManager::DiffTime(const struct TIMEINFO &startTime, TimingsManager::DiffTime(const struct TIMEINFO &startTime,
const struct TIMEINFO &endTime) const struct TIMEINFO &endTime)
{ {
#if defined(__APPLE__) #if defined(_WIN32)
double seconds = double(endTime.tv_sec - startTime.tv_sec) +
double(endTime.tv_usec - startTime.tv_usec) / 1000000.;
return seconds;
#else
// //
// Figure out how many milliseconds between start and end times // Figure out how many milliseconds between start and end times
// //
...@@ -803,7 +805,11 @@ TimingsManager::DiffTime(const struct TIMEINFO &startTime, ...@@ -803,7 +805,11 @@ TimingsManager::DiffTime(const struct TIMEINFO &startTime,
} }
return (ms/1000.); return (ms/1000.);
#else
double seconds = double(endTime.tv_sec - startTime.tv_sec) +
double(endTime.tv_usec - startTime.tv_usec) / 1000000.;
return seconds;
#endif #endif
} }
......
...@@ -58,10 +58,8 @@ ...@@ -58,10 +58,8 @@
// useful macro for declaring time info structs // useful macro for declaring time info structs
#if defined(_WIN32) #if defined(_WIN32)
# define TIMEINFO _timeb # define TIMEINFO _timeb
#elif defined(__APPLE__)
# define TIMEINFO timeval
#else #else
# define TIMEINFO timeb # define TIMEINFO timeval
#endif #endif
// useful macro for computing time of arrival at a particular line of code // useful macro for computing time of arrival at a particular line of code
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment