OOFEM 3.0
Loading...
Searching...
No Matches
oofem::Timer Class Reference

#include <timer.h>

Public Member Functions

 Timer ()
void startTimer ()
void stopTimer ()
void pauseTimer ()
void resumeTimer ()
void initTimer ()
bool isRunning ()
double getUtime ()
 Returns total user time elapsed in seconds.
double getWtime ()
 Returns total elapsed wall clock time in seconds.
void toString (char *buff)
 Prints receiver state into a string.
void updateElapsedTime ()

Static Public Member Functions

static void convert2HMS (int &nhrs, int &nmin, int &nsec, double tsec)

Private Member Functions

void getUtime (std ::chrono ::duration< double > &answer)
 Platform independent wrapper for user time.
void getTime (std ::chrono ::time_point< std ::chrono ::high_resolution_clock > &answer)
 Platform independent wrapper for wall time.

Private Attributes

std ::chrono ::time_point< std ::chrono ::high_resolution_clock > start_wtime
 Wall clock time markers.
std ::chrono ::time_point< std ::chrono ::high_resolution_clock > end_wtime
std ::chrono ::duration< double > start_utime
 User time.
std ::chrono ::duration< double > end_utime
std ::chrono ::duration< double > elapsedWTime
 Accumulated wtime and utime (in seconds) from start.
std ::chrono ::duration< double > elapsedUTime
bool running
 Flag indicating whether timer is running.

Detailed Description

Class implementing single timer, providing wall clock and user time capabilities.

Definition at line 46 of file timer.h.

Constructor & Destructor Documentation

◆ Timer()

oofem::Timer::Timer ( )

Definition at line 64 of file timer.C.

References initTimer().

Member Function Documentation

◆ convert2HMS()

void oofem::Timer::convert2HMS ( int & nhrs,
int & nmin,
int & nsec,
double tsec )
static

Converts total seconds into hours, minutes and remaining seconds

Parameters
[out]nhrsNumber of hours.
[out]nminNumber of minutes.
[out]nsecNumber of seconds.
[in]tsecTotal time in seconds.

Definition at line 117 of file timer.C.

◆ getTime()

void oofem::Timer::getTime ( std ::chrono ::time_point< std ::chrono ::high_resolution_clock > & answer)
private

Platform independent wrapper for wall time.

Definition at line 59 of file timer.C.

Referenced by pauseTimer(), resumeTimer(), and startTimer().

◆ getUtime() [1/2]

◆ getUtime() [2/2]

void oofem::Timer::getUtime ( std ::chrono ::duration< double > & answer)
private

Platform independent wrapper for user time.

Definition at line 47 of file timer.C.

◆ getWtime()

double oofem::Timer::getWtime ( )

Returns total elapsed wall clock time in seconds.

Definition at line 111 of file timer.C.

References elapsedWTime, and updateElapsedTime().

Referenced by oofem::SuperLUSolver::solve(), and toString().

◆ initTimer()

void oofem::Timer::initTimer ( )

Definition at line 98 of file timer.C.

References elapsedUTime, elapsedWTime, and running.

Referenced by startTimer(), and Timer().

◆ isRunning()

bool oofem::Timer::isRunning ( )
inline

Definition at line 65 of file timer.h.

References running.

◆ pauseTimer()

void oofem::Timer::pauseTimer ( )

Definition at line 83 of file timer.C.

References end_utime, end_wtime, getTime(), getUtime(), running, and updateElapsedTime().

Referenced by stopTimer(), and updateElapsedTime().

◆ resumeTimer()

void oofem::Timer::resumeTimer ( )

Definition at line 91 of file timer.C.

References getTime(), getUtime(), running, start_utime, and start_wtime.

Referenced by updateElapsedTime().

◆ startTimer()

◆ stopTimer()

◆ toString()

void oofem::Timer::toString ( char * buff)

Prints receiver state into a string.

Definition at line 135 of file timer.C.

References getUtime(), and getWtime().

◆ updateElapsedTime()

void oofem::Timer::updateElapsedTime ( )

Member Data Documentation

◆ elapsedUTime

std :: chrono :: duration< double > oofem::Timer::elapsedUTime
private

Definition at line 53 of file timer.h.

Referenced by getUtime(), initTimer(), and updateElapsedTime().

◆ elapsedWTime

std :: chrono :: duration< double > oofem::Timer::elapsedWTime
private

Accumulated wtime and utime (in seconds) from start.

Definition at line 53 of file timer.h.

Referenced by getWtime(), initTimer(), and updateElapsedTime().

◆ end_utime

std :: chrono :: duration< double > oofem::Timer::end_utime
private

Definition at line 51 of file timer.h.

Referenced by pauseTimer(), and updateElapsedTime().

◆ end_wtime

std :: chrono :: time_point< std :: chrono :: high_resolution_clock > oofem::Timer::end_wtime
private

Definition at line 49 of file timer.h.

Referenced by pauseTimer(), and updateElapsedTime().

◆ running

bool oofem::Timer::running
private

Flag indicating whether timer is running.

Definition at line 55 of file timer.h.

Referenced by initTimer(), isRunning(), pauseTimer(), resumeTimer(), startTimer(), stopTimer(), and updateElapsedTime().

◆ start_utime

std :: chrono :: duration< double > oofem::Timer::start_utime
private

User time.

Definition at line 51 of file timer.h.

Referenced by resumeTimer(), startTimer(), and updateElapsedTime().

◆ start_wtime

std :: chrono :: time_point< std :: chrono :: high_resolution_clock > oofem::Timer::start_wtime
private

Wall clock time markers.

Definition at line 49 of file timer.h.

Referenced by resumeTimer(), startTimer(), and updateElapsedTime().


The documentation for this class was generated from the following files:

This page is part of the OOFEM-3.0 documentation. Copyright Copyright (C) 1994-2025 Borek Patzak Bořek Patzák
Project e-mail: oofem@fsv.cvut.cz
Generated at for OOFEM by doxygen 1.15.0 written by Dimitri van Heesch, © 1997-2011