The Pedigree Project  0.1
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
IntervalTimer Class Reference
+ Inheritance diagram for IntervalTimer:
+ Collaboration diagram for IntervalTimer:

Public Types

enum  Mode { Hardware = 0, Virtual, Profile }
 

Public Member Functions

 IntervalTimer (PosixProcess *pProcess, Mode mode=Hardware)
 
void setInterval (Time::Timestamp interval, Time::Timestamp *prevInterval=nullptr)
 
void setTimerValue (Time::Timestamp value, Time::Timestamp *prevValue=nullptr)
 Set the current value of the timer.
 
void setIntervalAndValue (Time::Timestamp interval, Time::Timestamp value, Time::Timestamp *prevInterval=nullptr, Time::Timestamp *prevValue=nullptr)
 Set both interval and value atomically.
 
void getIntervalAndValue (Time::Timestamp &interval, Time::Timestamp &value)
 
void adjustValue (int64_t adjustment)
 Adjust the current value directly.
 
Time::Timestamp getInterval () const
 
Time::Timestamp getValue () const
 

Private Member Functions

virtual void timer (uint64_t delta, InterruptState &state)
 
void signal ()
 

Private Attributes

PosixProcessm_Process
 
Mode m_Mode
 
Time::Timestamp m_Value
 
Time::Timestamp m_Interval
 
Spinlock m_Lock
 
bool m_Armed
 

Detailed Description

Definition at line 74 of file PosixProcess.h.

Member Enumeration Documentation

Enumerator
Hardware 

Hardware-backed timer (wall time).

Virtual 

CPU time in user mode only.

Profile 

CPU time in user and system.

Definition at line 77 of file PosixProcess.h.

Constructor & Destructor Documentation

IntervalTimer::IntervalTimer ( PosixProcess pProcess,
Mode  mode = Hardware 
)

Setting hw=true will use hardware. hw=false requires adjust() to be called to be able to trigger timers.

Definition at line 232 of file PosixProcess.cc.

References Machine::getTimer(), and Hardware.

Member Function Documentation

void IntervalTimer::setInterval ( Time::Timestamp  interval,
Time::Timestamp *  prevInterval = nullptr 
)

Set the interval for the timer, which is loaded once the timer expires. Set zero to make a non-reloading timer.

Definition at line 258 of file PosixProcess.cc.

void IntervalTimer::signal ( )
private
Todo:
sanity check that this is absolutely a PosixSubsystem

Definition at line 391 of file PosixProcess.cc.

References Process::getThread(), Hardware, Profile, PosixSubsystem::sendSignal(), and Virtual.

Referenced by adjustValue(), and timer().

+ Here is the caller graph for this function:

void IntervalTimer::timer ( uint64_t  delta,
InterruptState &  state 
)
privatevirtual

Called when the handler is registered with the Timer/SchedulerTimer class and a timer event occured

Parameters
[in]deltatime elapsed since the last event, in nanoseconds
[in,out]statethe state of the processor when the event occurred.

Implements TimerHandler.

Definition at line 355 of file PosixProcess.cc.

References Hardware, and signal().


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