39 #ifndef _WIN32 //_MSC_VER and __MINGW32__ included 41 #include <sys/resource.h> 49 #ifdef _WIN32 //_MSC_VER and __MINGW32__ included 50 clock_t utime = clock();
51 answer = std :: chrono :: seconds(utime / CLOCKS_PER_SEC);
54 getrusage(RUSAGE_SELF, & rsg);
55 answer = std :: chrono :: seconds(rsg.ru_utime.tv_sec) + std :: chrono :: microseconds(rsg.ru_utime.tv_usec);
59 void Timer :: getTime(std :: chrono :: time_point< std :: chrono :: high_resolution_clock > &answer)
61 answer = std :: chrono :: high_resolution_clock :: now();
119 long int _nsec = (
long int ) tsec;
156 return timers [ t ].getUtime();
161 return timers [ t ].getWtime();
171 return timers [ t ].toString(buff);
std::chrono::duration< double > elapsedWTime
Accumulated wtime and utime (in seconds) from start.
std::chrono::duration< double > elapsedUTime
std::chrono::time_point< std::chrono::high_resolution_clock > end_wtime
std::chrono::duration< double > end_utime
std::chrono::time_point< std::chrono::high_resolution_clock > start_wtime
Wall clock time markers.
EngngModelTimerType
Enumeration to distinguish different type of timers.
void getTime(std::chrono::time_point< std::chrono::high_resolution_clock > &answer)
Platform independent wrapper for wall time.
double getWtime(EngngModelTimerType t)
Returns elapsed wall clock time.
std::chrono::duration< double > start_utime
User time.
static void convert2HMS(int &nhrs, int &nmin, int &nsec, double tsec)
Converts total seconds into hours, mins, and seconds.
void toString(char *buff)
Prints receiver state into a string.
void toString(EngngModelTimerType t, char *buff)
Printing & formatting.
static void convert2HMS(int &nhrs, int &nmin, int &nsec, double tsec)
Converts total seconds into hours, minutes and remaining seconds.
double getWtime()
Returns total elapsed wall clock time in seconds.
the oofem namespace is to define a context or scope in which all oofem names are defined.
double getUtime(EngngModelTimerType t)
Returns total user time elapsed.
double getUtime()
Returns total user time elapsed in seconds.
bool running
Flag indicating whether timer is running.