KallistiOS git master
Independent SDK for the Sega Dreamcast
|
SH4 CPU Performance Counter Driver More...
Topics | |
Timer | |
High-resolution performance counter-based timer API | |
Files | |
file | perfctr.h |
Low-level performance counter API. | |
Functions | |
bool | perf_cntr_config (perf_cntr_t counter, perf_cntr_event_t *event_mode, perf_cntr_clock_t *clock_type) |
Get a performance counter's settings. | |
void | perf_cntr_start (perf_cntr_t counter, perf_cntr_event_t event_mode, perf_cntr_clock_t clock_type) |
Start a performance counter. | |
void | perf_cntr_stop (perf_cntr_t counter) |
Stop a performance counter. | |
void | perf_cntr_resume (perf_cntr_t counter) |
Resume a performance counter. | |
void | perf_cntr_clear (perf_cntr_t counter) |
Clear a performance counter. | |
uint64_t | perf_cntr_count (perf_cntr_t counter) |
Obtain the count of a performance counter. | |
SH4 CPU Performance Counter Driver
The performance counter API exposes the SH4's hardware profiling registers, which consist of two different sets of independently operable 48-bit counters.
enum perf_cntr_clock_t |
Count clock types for the SH4 performance counters.
enum perf_cntr_event_t |
Performance Counter Event Modes.
This is the list of modes that are allowed to be passed into the perf_cntr_start() function, representing different events you want to count.
enum perf_cntr_t |
Identifiers for the two SH4 performance counters.
Enumerator | |
---|---|
PRFC0 | SH4 Performance Counter 0. The first performance counter ID. This counter is used by KOS by default to implement the Timer API. Reference it for details on how to reconfigure it if necessary. |
PRFC1 | SH4 Performance Counter 1. The second performance counter ID. This counter is not used anywhere internally by KOS. |
void perf_cntr_clear | ( | perf_cntr_t | counter | ) |
Clear a performance counter.
This function clears a performance counter. It resets its count to zero. This function stops the counter before clearing it because you cant clear a running counter.
counter | The counter to clear (i.e, PRFC0 or PRFC1). |
bool perf_cntr_config | ( | perf_cntr_t | counter, |
perf_cntr_event_t * | event_mode, | ||
perf_cntr_clock_t * | clock_type ) |
Get a performance counter's settings.
This function returns a performance counter's settings.
counter | The performance counter (i.e, PRFC0 or PRFC1). |
event_mode | Pointer to fill in with the counter's event mode |
clock_type | Pointer to fill in with the counter's clock type |
true | The performance counter is running |
false | the performance counter is stopped |
uint64_t perf_cntr_count | ( | perf_cntr_t | counter | ) |
Obtain the count of a performance counter.
This function simply returns the count of the counter.
counter | The counter to read (i.e, PRFC0 or PRFC1). |
void perf_cntr_resume | ( | perf_cntr_t | counter | ) |
Resume a performance counter.
This function resumes a stopped performance counter.
counter | The counter to resume (i.e. PRFC0 or PRFC1). |
void perf_cntr_start | ( | perf_cntr_t | counter, |
perf_cntr_event_t | event_mode, | ||
perf_cntr_clock_t | clock_type ) |
Start a performance counter.
This function starts a performance counter.
counter | The counter to start (i.e, PRFC0 or PRFC1). |
event_mode | Use one of the 33 event modes (pef_cntr_event_t). |
clock_type | PMCR_COUNT_CPU_CYCLES or PMCR_COUNT_RATIO_CYCLES. |
void perf_cntr_stop | ( | perf_cntr_t | counter | ) |
Stop a performance counter.
This function stops a performance counter that was started with perf_cntr_start(). Stopping a counter retains its count. To clear the count use perf_cntr_clear().
counter | The counter to stop (i.e, PRFC0 or PRFC1). |