The Pedigree Project 0.1
Public Member Functions | Protected Member Functions | Private Member Functions | List of all members
Timer Class Referenceabstract

#include <Timer.h>

+ Inheritance diagram for Timer:
+ Collaboration diagram for Timer:

Public Member Functions

virtual size_t getYear ()=0
 
virtual uint8_t getMonth ()=0
 
virtual uint8_t getDayOfMonth ()=0
 
virtual uint8_t getDayOfWeek ()=0
 
virtual uint8_t getHour ()=0
 
virtual uint8_t getMinute ()=0
 
virtual uint8_t getSecond ()=0
 
virtual uint64_t getNanosecond ()=0
 
virtual uint64_t getTickCount ()=0
 
virtual uint64_t getTickCountNano ()
 
virtual uint64_t getTickCountNanoFast ()
 
virtual Time::CpuTimeSample sampleCpuTime ()
 
virtual Time::Timestamp getUnixTimestamp ()
 
virtual bool registerHandler (TimerHandler *handler)=0
 
virtual bool unregisterHandler (TimerHandler *handler)=0
 
virtual bool armHandler (TimerHandler *, uint64_t)
 
virtual bool supportsDeadlines () const
 
virtual void deadlineInterrupt ()
 
virtual void addAlarm (class Event *pEvent, size_t alarmSecs, size_t alarmUsecs=0)=0
 
virtual void removeAlarm (class Event *pEvent)=0
 
virtual size_t removeAlarm (class Event *pEvent, bool bRetZero)=0
 
virtual void synchronise (bool tohw=false)
 Synchronises the timer with the hardware. Useful for updating the fields returned by get*, especially if IRQs are not enabled.
 

Protected Member Functions

 Timer ()
 
virtual ~Timer ()
 

Private Member Functions

 Timer (const Timer &)
 
Timer & operator= (const Timer &)
 

Detailed Description

Timer for the time-keeping

Definition at line 32 of file include/pedigree/kernel/machine/Timer.h.

Constructor & Destructor Documentation

◆ Timer() [1/2]

Timer::Timer ( )
inlineprotected

The default constructor

Definition at line 125 of file include/pedigree/kernel/machine/Timer.h.

◆ ~Timer()

virtual Timer::~Timer ( )
inlineprotectedvirtual

The destructor

Definition at line 127 of file include/pedigree/kernel/machine/Timer.h.

◆ Timer() [2/2]

Timer::Timer ( const Timer &  )
private

The copy-constructor

Note
NOT implemented

Member Function Documentation

◆ addAlarm()

virtual void Timer::addAlarm ( class Event *  pEvent,
size_t  alarmSecs,
size_t  alarmUsecs = 0 
)
pure virtual

Dispatches the Event pEvent to the current thread in alarmSecs time.

Parameters
pEventEvent to dispatch.
alarmSecsNumber of seconds to wait.

Implemented in HostedTimer, Rtc, and VirtTimer.

◆ armHandler()

virtual bool Timer::armHandler ( TimerHandler *  ,
uint64_t   
)
inlinevirtual

Arms a registered handler for one callback at an absolute monotonic nanosecond deadline. A zero deadline disarms it. The handler may rearm itself from its callback.

Reimplemented in Rtc.

Definition at line 86 of file include/pedigree/kernel/machine/Timer.h.

Referenced by CacheManager::initialise(), RequestQueue::resume(), Uhci::timer(), Ib700Watchdog::timer(), CacheManager::timer(), and RequestQueue::RequestQueueOverrunChecker::timer().

+ Here is the caller graph for this function:

◆ deadlineInterrupt()

virtual void Timer::deadlineInterrupt ( )
inlinevirtual

Notifies the timekeeper of a clockevent from hard interrupt context.

Reimplemented in Rtc.

Definition at line 96 of file include/pedigree/kernel/machine/Timer.h.

Referenced by PerProcessorScheduler::timer().

+ Here is the caller graph for this function:

◆ getDayOfMonth()

virtual uint8_t Timer::getDayOfMonth ( )
pure virtual

Get the current day of month

Returns
the current day of month

Implemented in HostedTimer, Rtc, and VirtTimer.

Referenced by getUnixTimestamp().

+ Here is the caller graph for this function:

◆ getDayOfWeek()

virtual uint8_t Timer::getDayOfWeek ( )
pure virtual

Get the current day of week

Returns
the current day of week

Implemented in HostedTimer, Rtc, and VirtTimer.

◆ getHour()

virtual uint8_t Timer::getHour ( )
pure virtual

Get the current hour

Returns
the current hour

Implemented in HostedTimer, Rtc, and VirtTimer.

Referenced by getUnixTimestamp().

+ Here is the caller graph for this function:

◆ getMinute()

virtual uint8_t Timer::getMinute ( )
pure virtual

Get the current minute

Returns
the current minute

Implemented in HostedTimer, Rtc, and VirtTimer.

Referenced by getUnixTimestamp().

+ Here is the caller graph for this function:

◆ getMonth()

virtual uint8_t Timer::getMonth ( )
pure virtual

Get the current month

Returns
the current month

Implemented in HostedTimer, Rtc, and VirtTimer.

Referenced by getUnixTimestamp().

+ Here is the caller graph for this function:

◆ getNanosecond()

virtual uint64_t Timer::getNanosecond ( )
pure virtual

Get the current nanosecond

Returns
the current nanosecond

Implemented in HostedTimer, Rtc, and VirtTimer.

◆ getSecond()

virtual uint8_t Timer::getSecond ( )
pure virtual

Get the current second

Returns
the current second

Implemented in HostedTimer, Rtc, and VirtTimer.

Referenced by getUnixTimestamp().

+ Here is the caller graph for this function:

◆ getTickCount()

virtual uint64_t Timer::getTickCount ( )
pure virtual

Get the Tick count (time elapsed since system bootup)

Returns
the tick count in milliseconds

Implemented in HostedTimer, Rtc, and VirtTimer.

Referenced by getTickCountNano(), and Log::LogEntry::operator<<().

+ Here is the caller graph for this function:

◆ getTickCountNano()

virtual uint64_t Timer::getTickCountNano ( )
inlinevirtual

Get the Tick count (time elapsed since system bootup) in nanosconds.

Returns
the tick count in nanoseconds

Reimplemented in HostedTimer, Rtc, and VirtTimer.

Definition at line 64 of file include/pedigree/kernel/machine/Timer.h.

References getTickCount().

Referenced by getTickCountNanoFast().

+ Here is the caller graph for this function:

◆ getTickCountNanoFast()

virtual uint64_t Timer::getTickCountNanoFast ( )
inlinevirtual

Get the tick count while the caller already owns the IRQ-disabled window.

Reimplemented in Rtc, and VirtTimer.

Definition at line 68 of file include/pedigree/kernel/machine/Timer.h.

References getTickCountNano().

Referenced by sampleCpuTime().

+ Here is the caller graph for this function:

◆ getUnixTimestamp()

Time::Timestamp Timer::getUnixTimestamp ( )
virtual

Get the time in UNIX timestamp form (seconds since Jan 1st, 1970).

Reimplemented in Rtc, and VirtTimer.

Definition at line 29 of file Timer.cc.

References getDayOfMonth(), getHour(), getMinute(), getMonth(), getSecond(), and getYear().

Referenced by Rtc::getUnixTimestamp().

+ Here is the caller graph for this function:

◆ getYear()

virtual size_t Timer::getYear ( )
pure virtual

Get the current year

Returns
the current year

Implemented in HostedTimer, Rtc, and VirtTimer.

Referenced by getUnixTimestamp().

+ Here is the caller graph for this function:

◆ operator=()

Timer & Timer::operator= ( const Timer &  )
private

The assignment operator

Note
NOT implemented

◆ removeAlarm() [1/2]

virtual void Timer::removeAlarm ( class Event *  pEvent)
pure virtual

Removes the event pEvent from the alarm queue. Once this returns, the timer will not begin another delivery of this event.

Parameters
pEventEvent to remove alarm for.

Implemented in HostedTimer, Rtc, and VirtTimer.

◆ removeAlarm() [2/2]

virtual size_t Timer::removeAlarm ( class Event *  pEvent,
bool  bRetZero 
)
pure virtual

Removes the event pEvent from the alarm queue. Once this returns, the timer will not begin another delivery of this event.

Parameters
pEventEvent to remove alarm for.
bRetZeroIf true, returns zero rather the time until firing
Returns
The number of seconds before the event would have fired, or zero if bRetZero is true.

Implemented in HostedTimer, Rtc, and VirtTimer.

◆ sampleCpuTime()

Time::CpuTimeSample Timer::sampleCpuTime ( )
virtual

Samples nanoseconds and CPU identity while the caller keeps interrupts disabled.

Reimplemented in Rtc.

Definition at line 24 of file Timer.cc.

References getTickCountNanoFast(), and ProcessorBase::index().

◆ supportsDeadlines()

virtual bool Timer::supportsDeadlines ( ) const
inlinevirtual

Whether absolute handler deadlines are available on this timer.

Reimplemented in Rtc.

Definition at line 91 of file include/pedigree/kernel/machine/Timer.h.

Referenced by CacheManager::initialise(), RequestQueue::resume(), Uhci::timer(), Ib700Watchdog::timer(), HidInputManager::timer(), CacheManager::timer(), and RequestQueue::RequestQueueOverrunChecker::timer().

+ Here is the caller graph for this function:

◆ synchronise()

virtual void Timer::synchronise ( bool  tohw = false)
inlinevirtual

Synchronises the timer with the hardware. Useful for updating the fields returned by get*, especially if IRQs are not enabled.

Parameters
tohwIf true, syncs back to the hardware, instead of from it.

Reimplemented in HostedTimer, Rtc, and VirtTimer.

Definition at line 121 of file include/pedigree/kernel/machine/Timer.h.


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