Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
pmu.h File Reference

Hardware Performance Monitoring Unit (PMU) API. More...

#include <zephyr/autoconf.h>
#include <stdint.h>
#include <stdbool.h>

Go to the source code of this file.

Data Structures

struct  pmu_info_t
 Placeholder pmu_info_t when no arch supplement is present. More...
struct  pmu_counter_config
 PMU counter configuration entry. More...

Macros

#define PMU_MAX_COUNTERS   8
 Maximum number of logical event counters this API can describe.

Typedefs

typedef uint32_t pmu_evt_t
 Architectural / backend event selector when no arch supplement defines pmu_evt_t.

Functions

int pmu_init (void)
 Initialize the PMU for the current logical CPU.
uint32_t pmu_num_counters (void)
void pmu_get_info (pmu_info_t *info)
 Fill info with PMU identification for the current logical CPU.
int pmu_counter_config (uint32_t counter, pmu_evt_t event)
 Map hardware event counter counter to architectural event event.
void pmu_counter_enable (uint32_t counter)
 Enable counting on hardware event counter counter.
void pmu_counter_disable (uint32_t counter)
 Disable counting on hardware event counter counter.
void pmu_counter_enable_all (void)
 Enable all implemented event counters (and the cycle counter where applicable).
void pmu_counter_disable_all (void)
 Disable all event counters (and the cycle counter where applicable).
uint64_t pmu_counter_read (uint32_t counter)
 Read the current value of hardware event counter counter.
void pmu_counter_reset (uint32_t counter)
 Reset hardware event counter counter to zero.
void pmu_counter_reset_all (void)
 Reset all hardware event counters to zero (implementation-defined; may include cycle counter policies).
uint64_t pmu_cycle_count (void)
 Read the architectural cycle count register (if implemented).
void pmu_cycle_reset (void)
 Reset the cycle count register to zero (implementation-defined).
void pmu_start (void)
 Start counting: enable the PMU globally (implementation-defined).
void pmu_stop (void)
 Stop counting: disable the PMU globally (implementation-defined).
bool pmu_counter_overflow (uint32_t counter)
 Return whether hardware event counter counter has overflowed since the flag was cleared.
void pmu_counter_clear_overflow (uint32_t counter)
 Clear the overflow flag for hardware event counter counter.

Detailed Description

Hardware Performance Monitoring Unit (PMU) API.

Typedef Documentation

◆ pmu_evt_t

Architectural / backend event selector when no arch supplement defines pmu_evt_t.