TexGen
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
TexGen::CTimer Class Reference

Class used to meaure the amount of time it takes to perform a certain task. More...

#include <Timer.h>

Public Member Functions

 CTimer ()
 
void start (const char *msg=0)
 
void restart (const char *msg=0)
 Turn the timer off and start it again from 0. Print an optional message. More...
 
void stop (const char *msg=0)
 Stop the timer and print an optional message. More...
 
void check (const char *msg=0)
 

Private Member Functions

double elapsed_time ()
 

Private Attributes

bool running
 
clock_t start_clock
 
time_t start_time
 
double acc_time
 

Friends

std::ostream & operator<< (std::ostream &os, CTimer &t)
 

Detailed Description

Class used to meaure the amount of time it takes to perform a certain task.

Definition at line 11 of file Timer.h.

Constructor & Destructor Documentation

◆ CTimer()

TexGen::CTimer::CTimer ( )
inline

Definition at line 30 of file Timer.h.

Member Function Documentation

◆ check()

void TexGen::CTimer::check ( const char *  msg = 0)
inline

Allow timers to be printed to ostreams using the syntax 'os << t' for an ostream 'os' and a timer 't'. For example, "cout << t" will print out the total amount of time 't' has been "running".

Definition at line 96 of file Timer.h.

References acc_time, elapsed_time(), running, and TGLOG.

Referenced by TexGen::COctreeVoxelMesh::ConvertHexToTets(), TexGen::COctreeVoxelMesh::OutputHexElements(), TexGen::CShearedTextileWeave2D::Refine(), TexGen::CTextileWeave2D::Refine(), TexGen::CVoxelMesh::SaveVoxelMesh(), and TexGen::COctreeVoxelMesh::SaveVoxelMesh().

◆ elapsed_time()

double TexGen::CTimer::elapsed_time ( )
inlineprivate

Return the total time that the timer has been in the "running" state since it was first "started" or last "restarted". For "short" time periods (less than an hour), the actual cpu time used is reported instead of the elapsed time.

Definition at line 47 of file Timer.h.

References start_clock, and start_time.

Referenced by check(), and stop().

◆ restart()

void TexGen::CTimer::restart ( const char *  msg = 0)
inline

Turn the timer off and start it again from 0. Print an optional message.

Definition at line 73 of file Timer.h.

References acc_time, running, start_clock, start_time, and TGLOG.

◆ start()

void TexGen::CTimer::start ( const char *  msg = 0)
inline

◆ stop()

void TexGen::CTimer::stop ( const char *  msg = 0)
inline

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
CTimer t 
)
friend

Definition at line 110 of file Timer.h.

Member Data Documentation

◆ acc_time

double TexGen::CTimer::acc_time
private

Definition at line 19 of file Timer.h.

Referenced by check(), restart(), and stop().

◆ running

bool TexGen::CTimer::running
private

Definition at line 16 of file Timer.h.

Referenced by check(), restart(), start(), and stop().

◆ start_clock

clock_t TexGen::CTimer::start_clock
private

Definition at line 17 of file Timer.h.

Referenced by elapsed_time(), restart(), and start().

◆ start_time

time_t TexGen::CTimer::start_time
private

Definition at line 18 of file Timer.h.

Referenced by elapsed_time(), restart(), and start().


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