gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Time Class Reference

#include <time.hh>

Public Member Functions

 Time ()
 
 Time (double sec)
 
 Time (const Time &val)
 
 Time (uint64_t sec, uint64_t nsec)
 
 Time (const timeval &tv)
 
 Time (const timespec &ts)
 
time_t sec () const
 Accessors for getting and setting the current clock. More...
 
long msec () const
 
long usec () const
 
long nsec () const
 
void sec (time_t sec)
 
void msec (long msec)
 
void usec (long usec)
 
void nsec (long nsec)
 
void clear ()
 Clear the time. More...
 
void setTimer ()
 Use this to set time for the purposes of time measurement (use a monotonic clock if it is available. More...
 
void setWallclock ()
 Use this to set the time to the actual current time. More...
 
void set (time_t _sec, long _nsec)
 Set the current time. More...
 
void setTick (Tick ticks)
 Set the current time from a value measured in Ticks. More...
 
Tick getTick () const
 Get the current time from a value measured in Ticks. More...
 
const Timeoperator= (const Time &other)
 
const Timeoperator= (double new_time)
 
const Timeoperator= (const timeval &tv)
 
const Timeoperator= (const timespec &ts)
 
 operator double () const
 Get the time in floating point seconds. More...
 
 operator timespec () const
 operators for time conversion More...
 
 operator timeval () const
 
const Timeoperator+= (const Time &other)
 
const Timeoperator-= (const Time &other)
 
std::string date (const std::string &format="") const
 
std::string time () const
 
void serialize (const std::string &base, CheckpointOut &cp) const
 
void unserialize (const std::string &base, CheckpointIn &cp)
 

Static Public Attributes

static const long NSEC_PER_SEC = 1000 * 1000 * 1000
 
static const long NSEC_PER_MSEC = 1000 * 1000
 
static const long NSEC_PER_USEC = 1000
 

Protected Member Functions

void _set (bool monotonic)
 Internal time set function. More...
 

Protected Attributes

timespec _time
 

Detailed Description

Definition at line 48 of file time.hh.

Constructor & Destructor Documentation

Time::Time ( )
inlineexplicit

Definition at line 64 of file time.hh.

References clear().

Time::Time ( double  sec)
inlineexplicit

Definition at line 65 of file time.hh.

References operator=().

Time::Time ( const Time val)
inline

Definition at line 66 of file time.hh.

Time::Time ( uint64_t  sec,
uint64_t  nsec 
)
inline

Definition at line 67 of file time.hh.

References set().

Time::Time ( const timeval &  tv)
inline

Definition at line 68 of file time.hh.

References operator=().

Time::Time ( const timespec &  ts)
inline

Definition at line 69 of file time.hh.

References operator=().

Member Function Documentation

void Time::_set ( bool  monotonic)
protected

Internal time set function.

Definition at line 46 of file time.cc.

Referenced by setTimer(), and setWallclock().

void Time::clear ( )
inline

Clear the time.

Definition at line 87 of file time.hh.

References _time.

Referenced by Time().

string Time::date ( const std::string &  format = "") const

Definition at line 71 of file time.cc.

Referenced by operator<<().

Tick Time::getTick ( ) const

Get the current time from a value measured in Ticks.

Returns
Time value measured in Ticks.

Definition at line 65 of file time.cc.

References SimClock::Int::ns.

Referenced by Root::timeSyncPeriod().

long Time::msec ( ) const
inline

Definition at line 75 of file time.hh.

References _time, and NSEC_PER_MSEC.

void Time::msec ( long  msec)
inline

Definition at line 80 of file time.hh.

References _time, and NSEC_PER_MSEC.

long Time::nsec ( ) const
inline
void Time::nsec ( long  nsec)
inline

Definition at line 82 of file time.hh.

References _time, and nsec().

Referenced by nsec().

Time::operator double ( ) const
inline

Get the time in floating point seconds.

Definition at line 153 of file time.hh.

References ArmISA::e, nsec(), and sec().

Time::operator timespec ( ) const
inline

operators for time conversion

Definition at line 161 of file time.hh.

References _time.

Time::operator timeval ( ) const
inline

Definition at line 162 of file time.hh.

References sec(), and usec().

const Time& Time::operator+= ( const Time other)
inline

Definition at line 171 of file time.hh.

References _time, nsec(), NSEC_PER_SEC, and sec().

const Time& Time::operator-= ( const Time other)
inline

Definition at line 185 of file time.hh.

References _time, nsec(), NSEC_PER_SEC, and sec().

const Time& Time::operator= ( const Time other)
inline

Definition at line 118 of file time.hh.

References nsec(), and sec().

Referenced by Time().

const Time& Time::operator= ( double  new_time)
inline

Definition at line 126 of file time.hh.

References nsec(), and sec().

const Time& Time::operator= ( const timeval &  tv)
inline

Definition at line 135 of file time.hh.

References nsec(), and sec().

const Time& Time::operator= ( const timespec &  ts)
inline

Definition at line 143 of file time.hh.

References nsec(), and sec().

time_t Time::sec ( ) const
inline

Accessors for getting and setting the current clock.

Definition at line 74 of file time.hh.

References _time.

Referenced by operator double(), operator timeval(), operator!=(), operator+=(), operator-=(), operator<(), operator<=(), operator=(), operator==(), operator>(), operator>=(), and set().

void Time::sec ( time_t  sec)
inline

Definition at line 79 of file time.hh.

References _time, and sec().

Referenced by sec().

void Time::serialize ( const std::string &  base,
CheckpointOut cp 
) const

Definition at line 122 of file time.cc.

References paramOut().

void Time::set ( time_t  _sec,
long  _nsec 
)
inline

Set the current time.

Definition at line 103 of file time.hh.

References nsec(), and sec().

Referenced by Time().

void Time::setTick ( Tick  ticks)

Set the current time from a value measured in Ticks.

Parameters
ticksNumber of ticks to convert into a time.

Definition at line 58 of file time.cc.

References SimClock::Int::ns.

Referenced by Root::Root().

void Time::setTimer ( )
inline

Use this to set time for the purposes of time measurement (use a monotonic clock if it is available.

Definition at line 93 of file time.hh.

References _set().

Referenced by Stats::SimTicksReset::process(), Root::Root(), Stats::statElapsedTime(), and Root::timeSync().

void Time::setWallclock ( )
inline

Use this to set the time to the actual current time.

Definition at line 98 of file time.hh.

References _set().

string Time::time ( ) const

Definition at line 92 of file time.cc.

void Time::unserialize ( const std::string &  base,
CheckpointIn cp 
)

Definition at line 129 of file time.cc.

References paramIn().

long Time::usec ( ) const
inline

Definition at line 76 of file time.hh.

References _time, and NSEC_PER_USEC.

Referenced by operator timeval().

void Time::usec ( long  usec)
inline

Definition at line 81 of file time.hh.

References _time, and NSEC_PER_USEC.

Member Data Documentation

timespec Time::_time
protected

Definition at line 51 of file time.hh.

Referenced by clear(), msec(), nsec(), operator timespec(), operator+=(), operator-=(), sec(), and usec().

const long Time::NSEC_PER_MSEC = 1000 * 1000
static

Definition at line 60 of file time.hh.

Referenced by msec().

const long Time::NSEC_PER_SEC = 1000 * 1000 * 1000
static

Definition at line 59 of file time.hh.

Referenced by operator+=(), and operator-=().

const long Time::NSEC_PER_USEC = 1000
static

Definition at line 61 of file time.hh.

Referenced by usec().


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

Generated on Fri Jun 9 2017 13:04:21 for gem5 by doxygen 1.8.6