15#if defined(__INTEL_COMPILER) && defined(_WIN32)
17#define WIN32_LEAN_AND_MEAN
23bool seconds_initialized =
false;
24LARGE_INTEGER start_count, count_freq;
26inline void seconds_initialize() {
27 if( seconds_initialized )
return;
28 std::cout <<
"\nCalling Win32 version of Teuchos::seconds_initialize()!\n";
30 ::QueryPerformanceFrequency( &count_freq );
33 ::SetThreadPriority( ::GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL );
35 assert( QueryPerformanceCounter( &start_count ) );
36 seconds_initialized =
true;
43#ifdef HAVE_TEUCHOS_TIME_MASSIF_SNAPSHOTS
49#if defined(HAVE_TEUCHOS_KOKKOS_PROFILING) && defined(HAVE_TEUCHOSCORE_KOKKOS)
52extern void pushRegion (
const std::string&);
53extern void popRegion ();
58#ifdef HAVE_TEUCHOS_TIMER_KOKKOS_FENCE
59#include "Kokkos_Core.hpp"
64#ifdef HAVE_TEUCHOS_TIME_MASSIF_SNAPSHOTS
65 void removeIllegalChars(std::string& s){
66 std::string illegalChars =
"\\/:?\"<>|";
67 for (
auto it = s.begin() ; it < s.end() ; ++it){
68 bool found = illegalChars.find(*it) != std::string::npos;
77 : startTime_(0), totalTime_(0), isRunning_(
false), enabled_ (
true), name_(
name_in), numCalls_(0)
80#ifdef HAVE_TEUCHOS_TIME_MASSIF_SNAPSHOTS
90#ifdef HAVE_TEUCHOS_TIME_MASSIF_SNAPSHOTS
100#ifdef HAVE_TEUCHOS_TIMER_KOKKOS_FENCE
103#if defined(HAVE_TEUCHOS_KOKKOS_PROFILING) && defined(HAVE_TEUCHOSCORE_KOKKOS)
104 ::Kokkos::Tools::pushRegion (name_);
113 totalTime_ += (
wallTime() - startTime_ );
116#ifdef HAVE_TEUCHOS_TIME_MASSIF_SNAPSHOTS
126#ifdef HAVE_TEUCHOS_TIMER_KOKKOS_FENCE
129#if defined(HAVE_TEUCHOS_KOKKOS_PROFILING) && defined(HAVE_TEUCHOSCORE_KOKKOS)
130 ::Kokkos::Tools::popRegion ();
140 return wallTime() - startTime_ + totalTime_;
188#elif defined(__INTEL_COMPILER) && defined(_WIN32)
199#elif ICL || defined(_WIN32)
219 return( ((
double) (
tp.tv_sec -
start)) + (
tp.tv_usec-
startu)/1000000.0 );
Basic wall-clock timer class.
Smart reference counting pointer class for automatic garbage collection.
void enable()
"Enable" this timer, so that it (again) respects calls to start() and stop().
void incrementNumCalls()
Increment the number of times this timer has been called, if the timer is enabled (see disable()).
double totalElapsedTime(bool readCurrentTime=false) const
The total time in seconds accumulated by this timer.
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()).
void disable()
"Disable" this timer, so that it ignores calls to start() and stop().
Time(const std::string &name, bool start=false)
Constructor.
static double wallTime()
Current wall-clock time in seconds.
The Teuchos namespace contains all of the classes, structs and enums used by Teuchos,...