Text archives Help
- From: thiago@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [Manta] r1744 - trunk/Core/Util
- Date: Fri, 28 Sep 2007 14:41:18 -0600 (MDT)
Author: thiago
Date: Fri Sep 28 14:41:18 2007
New Revision: 1744
Modified:
trunk/Core/Util/CPUTime.cc
Log:
ia64 timer should be fast now.
Modified: trunk/Core/Util/CPUTime.cc
==============================================================================
--- trunk/Core/Util/CPUTime.cc (original)
+++ trunk/Core/Util/CPUTime.cc Fri Sep 28 14:41:18 2007
@@ -11,6 +11,10 @@
#include <sys/time.h>
#endif
+#ifdef __ia64__
+# include <SCIRun/Core/Thread/Time.h>
+#endif
+
using namespace Manta;
static bool initialized=false;
@@ -33,6 +37,8 @@
static_cast<double>(time_info.denom);
#elif defined(_WIN32)
secondsPerTick_val = 1.0/static_cast<double>(CLOCKS_PER_SEC);
+#elif defined(__ia64__)
+ secondsPerTick_val = SCIRun::Time::secondsPerTick();
#else
FILE *fp = fopen("/proc/cpuinfo","r");
char input[255];
@@ -82,13 +88,7 @@
#elif defined(__ia64__)
CPUTime::SysClock CPUTime::currentTicks()
{
- if (!initialized) initialize();
-
- struct timeval tp;
- if(gettimeofday(&tp, NULL) != 0){
- return 0; //oops, something went wrong.
- }
- return (double(tp.tv_sec)+double(tp.tv_usec)/1000000)*ticksPerSecond();
+ return SCIRun::Time::currentTicks();
}
#else
@@ -110,10 +110,17 @@
// Return the current CPU time, in terms of seconds.
// This is slower than currentTicks(). Time zero is at
// some arbitrary point in the past.
+#ifdef __ia64__
+double CPUTime::currentSeconds()
+{
+ return SCIRun::Time::currentSeconds();
+}
+#else
double CPUTime::currentSeconds()
{
return currentTicks()*secondsPerTick_val;
}
+#endif
//////////
// Return the conversion from seconds to ticks.
- [Manta] r1744 - trunk/Core/Util, thiago, 09/28/2007
Archive powered by MHonArc 2.6.16.