wavelength 1.0.0
Loading...
Searching...
No Matches
cycles.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

unsigned ReadCycleCount ()
 Read the free-running cycle counter.
int GetMillisecondsPerSecond ()
 Report how many milliseconds one second has.

Variables

constexpr unsigned kCyclesPerMillisecond = 294912
 EE clock in cycles per millisecond, which is the divisor the elapsed time is computed with.
constexpr int kMillisecondsPerSecond = 1000
 Milliseconds in one second, the rate GetMillisecondsPerSecond() reports.
float gSystemCycles2Ms
 Milliseconds per EE cycle.

Function Documentation

◆ ReadCycleCount()

unsigned ReadCycleCount ( )

Read the free-running cycle counter.

Every caller in the image inlines the read, so the image has no out-of-line copy and there is no address to record. On the shipped target the read is the EE Count coprocessor register, which is the one genuinely machine-specific part of the timing instrumentation, so a port supplies its own implementation file for this declaration.

Returns
The counter, which wraps.

◆ GetMillisecondsPerSecond()

int GetMillisecondsPerSecond ( )
inline

Report how many milliseconds one second has.

The body is here rather than in a source file because callers expand it inline. Its one out-of-line copy is in the unit whose static initialiser is at 0x004662d0 and which also defines ShowReportedMessage(). HudScreenFlash's constructor calls that copy, and Sch::SystemTime divides its scale by the result.

The name is inferred from the value. Nothing in the image attests it.

Returns
1000.

Variable Documentation

◆ kCyclesPerMillisecond

unsigned kCyclesPerMillisecond = 294912
constexpr

EE clock in cycles per millisecond, which is the divisor the elapsed time is computed with.

◆ kMillisecondsPerSecond

int kMillisecondsPerSecond = 1000
constexpr

Milliseconds in one second, the rate GetMillisecondsPerSecond() reports.

◆ gSystemCycles2Ms

float gSystemCycles2Ms
extern

Milliseconds per EE cycle.

Ghidra address:
NTSC-U/C: 0x003b2258
Ghidra address:
PAL: 0x00431138