SoPlex
Loading...
Searching...
No Matches
UserTimer Class Reference

#include <usertimer.h>

Inheritance diagram for UserTimer:
Timer

Public Member Functions

Construction / destruction
 UserTimer ()
 default constructor
 UserTimer (const UserTimer &old)
 copy constructor
UserTimeroperator= (const UserTimer &old)
 assignment operator
virtual ~UserTimer ()
Control
virtual void reset ()
 initialize timer, set timing accounts to zero.
virtual void start ()
 start timer, resume accounting user, system and real time.
virtual Real stop ()
 stop timer, return accounted user time.
virtual TYPE type ()
 return type of timer
Access
virtual Real time () const
virtual Real lastTime () const
Public Member Functions inherited from Timer
 Timer ()
 default constructor
 Timer (const Timer &old)
 copy constructor
Timeroperator= (const Timer &old)
 assignment operator
virtual ~Timer ()
void getLastTimes (Real *userTime, Real *systemTime, Real *realTime) const
 return accounted time. get accounted user, system, or real time when ticks were updated last
Real realTimeLast () const
 return accounted real time without rechecking the clock

Private Member Functions

Internal helpers
Real ticks2sec (clock_t ticks) const
 convert ticks to secounds.
void updateTicks () const
 get actual user ticks from the system.

Private Attributes

Data
clock_t uAccount
 user time
clock_t uTicks
 user ticks
Real lasttime

Static Private Attributes

number of ticks per second
static const long ticks_per_sec = long(TIMES_TICKS_PER_SEC)
 ticks per secound, should be constant

Additional Inherited Members

Public Types inherited from Timer
enum  TYPE { OFF = 0 , USER_TIME = 1 , WALLCLOCK_TIME = 2 }
 types of timers More...
Protected Types inherited from Timer
enum  { RESET , STOPPED , RUNNING }
 status of the timer More...
enum soplex::Timer:: { ... }  status
 status of the timer

Detailed Description

Definition at line 38 of file usertimer.h.

Constructor & Destructor Documentation

◆ UserTimer() [1/2]

UserTimer ( )

default constructor

Definition at line 77 of file usertimer.h.

References lasttime, ticks_per_sec, Timer::Timer(), uAccount, and uTicks.

Referenced by operator=(), and UserTimer().

◆ UserTimer() [2/2]

UserTimer ( const UserTimer & old)

copy constructor

Definition at line 83 of file usertimer.h.

References lasttime, ticks_per_sec, Timer::Timer(), uAccount, UserTimer(), and uTicks.

◆ ~UserTimer()

virtual ~UserTimer ( )
virtual

Definition at line 98 of file usertimer.h.

Member Function Documentation

◆ lastTime()

Real lastTime ( ) const
virtual

Implements Timer.

Definition at line 126 of file usertimer.cpp.

References lasttime.

◆ operator=()

UserTimer & operator= ( const UserTimer & old)

assignment operator

Definition at line 89 of file usertimer.h.

References lasttime, ticks_per_sec, uAccount, UserTimer(), and uTicks.

◆ reset()

virtual void reset ( )
virtual

initialize timer, set timing accounts to zero.

Implements Timer.

Definition at line 106 of file usertimer.h.

References lasttime, Timer::RESET, Timer::status, and uAccount.

◆ start()

void start ( )
virtual

start timer, resume accounting user, system and real time.

Implements Timer.

Definition at line 81 of file usertimer.cpp.

References lasttime, Timer::RUNNING, Timer::status, uAccount, updateTicks(), and uTicks.

◆ stop()

Real stop ( )
virtual

stop timer, return accounted user time.

Implements Timer.

Definition at line 96 of file usertimer.cpp.

References Timer::RUNNING, Timer::status, Timer::STOPPED, ticks2sec(), uAccount, updateTicks(), and uTicks.

◆ ticks2sec()

Real ticks2sec ( clock_t ticks) const
private

convert ticks to secounds.

Definition at line 61 of file usertimer.h.

References ticks_per_sec.

Referenced by stop(), and time().

◆ time()

Real time ( ) const
virtual

Implements Timer.

Definition at line 111 of file usertimer.cpp.

References lasttime, Timer::RUNNING, Timer::status, ticks2sec(), uAccount, updateTicks(), and uTicks.

◆ type()

virtual TYPE type ( )
virtual

return type of timer

Implements Timer.

Definition at line 120 of file usertimer.h.

References Timer::USER_TIME.

◆ updateTicks()

void updateTicks ( ) const
private

get actual user ticks from the system.

Definition at line 61 of file usertimer.cpp.

References uTicks.

Referenced by start(), stop(), and time().

Member Data Documentation

◆ lasttime

Real lasttime
mutableprivate

Definition at line 54 of file usertimer.h.

Referenced by lastTime(), operator=(), reset(), start(), time(), UserTimer(), and UserTimer().

◆ ticks_per_sec

const long ticks_per_sec = long(TIMES_TICKS_PER_SEC)
staticprivate

ticks per secound, should be constant

Definition at line 45 of file usertimer.h.

Referenced by operator=(), ticks2sec(), UserTimer(), and UserTimer().

◆ uAccount

clock_t uAccount
mutableprivate

user time

Definition at line 51 of file usertimer.h.

Referenced by operator=(), reset(), start(), stop(), time(), UserTimer(), and UserTimer().

◆ uTicks

clock_t uTicks
mutableprivate

user ticks

Definition at line 52 of file usertimer.h.

Referenced by operator=(), start(), stop(), time(), updateTicks(), UserTimer(), and UserTimer().