wavelength 1.0.0
Loading...
Searching...
No Matches
Timer Class Reference

Stopwatch on the EE cycle counter. More...

#include <timer.h>

Public Member Functions

 Timer ()
 Construct a stopped timer with no measurement.
void Reset ()
 Stop the timer and record the cycles measured so far in milliseconds in mLastMs.
void Pause ()
 Suspend a running timer, adding the cycles since the start to mCycles.
void Resume ()
 Continue a timer Pause() suspended from the current counter reading.
void Split ()
 Restart the measurement at the current counter reading.
void Start ()
 Raise the start count, and take the counter reading when the count leaves zero.
void Stop ()
 Lower the start count, and add the cycles since the start to mCycles when it arrives at zero.
unsigned GetCycles () const
void SetCycles (unsigned nCycles)
float GetLastMs () const
void SetLastMs (float fLastMs)
const char * GetName () const
void SetName (const char *pszName)
void SetRunning (int nRunning)
 Timer ()

Static Public Member Functions

static Timer * Find (const char *pszName)
 Find a timer of the registry of named timers.

Public Attributes

int mReserved00
int mReserved04
int mReserved08
int mReserved10

Static Public Attributes

static std::vector< Timer > sTimers
 The registry of named timers.

Detailed Description

Stopwatch on the EE cycle counter.

A named timer of the timer configuration.

The RTTI includes the class name. The class is not polymorphic, and the object is 0x14 bytes with no vptr. The system clock at 0x00491a10 is one instance, and many routines build another on the stack to time their body.

Every member routine in the image is expanded inline at its call sites.

The RTTI records the class. The object is 0x14 bytes. Only the name is read by the control; the other members are placeholders that record the layout.

Constructor & Destructor Documentation

◆ Timer() [1/2]

Timer::Timer ( )
inline

Construct a stopped timer with no measurement.

◆ Timer() [2/2]

Timer::Timer ( )
inline

Member Function Documentation

◆ Reset()

void Timer::Reset ( )
inline

Stop the timer and record the cycles measured so far in milliseconds in mLastMs.

◆ Pause()

void Timer::Pause ( )
inline

Suspend a running timer, adding the cycles since the start to mCycles.

The start count becomes negative until Resume().

◆ Resume()

void Timer::Resume ( )
inline

Continue a timer Pause() suspended from the current counter reading.

◆ Split()

void Timer::Split ( )
inline

Restart the measurement at the current counter reading.

Only a timer whose mRunning is exactly 1 is split. Any other timer is unchanged. A split timer stores the cycles since the previous reading in mCycles, replacing the earlier value.

◆ Start()

void Timer::Start ( )
inline

Raise the start count, and take the counter reading when the count leaves zero.

◆ Stop()

void Timer::Stop ( )
inline

Lower the start count, and add the cycles since the start to mCycles when it arrives at zero.

◆ Find()

Timer * Timer::Find ( const char * pszName)
static

Find a timer of the registry of named timers.

Parameters
pszNameThe name.
Returns
The timer, or null when no timer of the registry has the name.
Ghidra address:
NTSC-U/C: 0x0028d128
Ghidra address:
PAL: 0x00296b08

◆ GetCycles()

unsigned Timer::GetCycles ( ) const
inline
Returns
Cycles of the last completed measurement.

◆ SetCycles()

void Timer::SetCycles ( unsigned nCycles)
inline
Parameters
nCyclesCycles of the last completed measurement.

◆ GetLastMs()

float Timer::GetLastMs ( ) const
inline
Returns
mCycles converted to milliseconds when the timer last stopped.

◆ SetLastMs()

void Timer::SetLastMs ( float fLastMs)
inline
Parameters
fLastMsmCycles converted to milliseconds when the timer last stopped.

◆ GetName()

const char * Timer::GetName ( ) const
inline
Returns
The name Find() matches, or null for an unnamed timer.

◆ SetName()

void Timer::SetName ( const char * pszName)
inline
Parameters
pszNameThe name Find() matches, or null for an unnamed timer.

◆ SetRunning()

void Timer::SetRunning ( int nRunning)
inline
Parameters
nRunningStart count. The timer measures while the count is non-zero.

Member Data Documentation

◆ sTimers

std::vector<Timer> Timer::sTimers
static

The registry of named timers.

Ghidra address:
NTSC-U/C: 0x00491a00

◆ mReserved00

int Timer::mReserved00

◆ mReserved04

int Timer::mReserved04

◆ mReserved08

int Timer::mReserved08

◆ mReserved10

int Timer::mReserved10

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