47 #if defined(__INTEL_COMPILER) && defined(_WIN32) 49 #define WIN32_LEAN_AND_MEAN 55 bool seconds_initialized =
false;
56 LARGE_INTEGER start_count, count_freq;
58 inline void seconds_initialize() {
59 if( seconds_initialized )
return;
60 std::cout <<
"\nCalling Win32 version of Teuchos::seconds_initialize()!\n";
62 ::QueryPerformanceFrequency( &count_freq );
65 ::SetThreadPriority( ::GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL );
67 assert( QueryPerformanceCounter( &start_count ) );
68 seconds_initialized =
true;
73 #endif // defined(__INTEL_COMPILER) && defined(_WIN32) 79 : startTime_(0), totalTime_(0), isRunning_(false), enabled_ (true), name_(name_in), numCalls_(0)
81 if(start_in) this->
start();
88 if (reset_in) totalTime_ = 0;
97 totalTime_ += (
wallTime() - startTime_ );
108 return wallTime() - startTime_ + totalTime_;
140 MPI_Initialized(&mpiInitialized);
142 if( mpiInitialized ) {
152 return( (
double)( start ) / CLOCKS_PER_SEC );
156 #elif defined(__INTEL_COMPILER) && defined(_WIN32) 158 seconds_initialize();
160 QueryPerformanceCounter( &count );
163 sec = (double)( count.QuadPart - start_count.QuadPart ) / count_freq.QuadPart;
167 #elif ICL || defined(_WIN32) 172 return( (
double)( start ) / CLOCKS_PER_SEC );
178 static long start = 0, startu;
181 gettimeofday(&tp, NULL);
186 gettimeofday(&tp, NULL);
187 return( ((
double) (tp.tv_sec - start)) + (tp.tv_usec-startu)/1000000.0 );
189 return( (
double) clock() / CLOCKS_PER_SEC );
void disable()
"Disable" this timer, so that it ignores calls to start() and stop().
Basic wall-clock timer class.
void reset()
Reset the cummulative time and call count.
void start(bool reset=false)
Start the timer, if the timer is enabled (see disable()).
double stop()
Stop the timer, if the timer is enabled (see disable()).
Time(const std::string &name, bool start=false)
Constructor.
void enable()
"Enable" this timer, so that it (again) respects calls to start() and stop().
The Teuchos namespace contains all of the classes, structs and enums used by Teuchos, as well as a number of utility routines.
double totalElapsedTime(bool readCurrentTime=false) const
The total time in seconds accumulated by this timer.
static double wallTime()
Current wall-clock time in seconds.
void incrementNumCalls()
Increment the number of times this timer has been called, if the timer is enabled (see disable())...