Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
pmu.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2026 Advanced Micro Devices, Inc.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
11
12#ifndef ZEPHYR_INCLUDE_ZEPHYR_PMU_H_
13#define ZEPHYR_INCLUDE_ZEPHYR_PMU_H_
14
15#include <zephyr/autoconf.h>
16#include <stdint.h>
17#include <stdbool.h>
18
19#if defined(CONFIG_ARM64)
20#include <zephyr/arch/arm64/pmuv3.h>
21#else
26
34#endif
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
45
51#define PMU_MAX_COUNTERS 8
52
60
92int pmu_init(void);
93
96
104
114
121
128
133
138
147
154
160
167
172
176void pmu_start(void);
177
181void pmu_stop(void);
182
192
199
203
204#ifdef __cplusplus
205}
206#endif
207
208#endif /* ZEPHYR_INCLUDE_ZEPHYR_PMU_H_ */
void pmu_start(void)
Start counting: enable the PMU globally (implementation-defined).
void pmu_counter_enable(uint32_t counter)
Enable counting on hardware event counter counter.
void pmu_counter_clear_overflow(uint32_t counter)
Clear the overflow flag for hardware event counter counter.
int pmu_counter_config(uint32_t counter, pmu_evt_t event)
Map hardware event counter counter to architectural event event.
bool pmu_counter_overflow(uint32_t counter)
Return whether hardware event counter counter has overflowed since the flag was cleared.
void pmu_stop(void)
Stop counting: disable the PMU globally (implementation-defined).
void pmu_counter_reset(uint32_t counter)
Reset hardware event counter counter to zero.
void pmu_get_info(pmu_info_t *info)
Fill info with PMU identification for the current logical CPU.
void pmu_counter_disable_all(void)
Disable all event counters (and the cycle counter where applicable).
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).
uint32_t pmu_num_counters(void)
uint64_t pmu_cycle_count(void)
Read the architectural cycle count register (if implemented).
int pmu_init(void)
Initialize the PMU for the current logical CPU.
uint64_t pmu_counter_read(uint32_t counter)
Read the current value of hardware event counter counter.
void pmu_cycle_reset(void)
Reset the cycle count register to zero (implementation-defined).
void pmu_counter_reset_all(void)
Reset all hardware event counters to zero (implementation-defined; may include cycle counter policies...
uint32_t pmu_evt_t
Architectural / backend event selector when no arch supplement defines pmu_evt_t.
Definition pmu.h:25
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT64_TYPE__ uint64_t
Definition stdint.h:91
PMU counter configuration entry.
Definition pmu.h:54
pmu_evt_t event
Event (e.g.
Definition pmu.h:56
bool enabled
Enable this counter when configured.
Definition pmu.h:58
Placeholder pmu_info_t when no arch supplement is present.
Definition pmu.h:28
uint32_t implementer
PMU implementer identification value when reported by the backend.
Definition pmu.h:30
uint32_t idcode
PMU part number / ID code when reported by the backend.
Definition pmu.h:32