Zephyr API Documentation 4.5.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
perf_counter.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_ARCH_PERF_COUNTER_H_
13#define ZEPHYR_INCLUDE_ZEPHYR_ARCH_PERF_COUNTER_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
27
35#endif
36
37#ifdef __cplusplus
38extern "C" {
39#endif
40
46
54
88
91
100
111
118
125
130
135
144
151
157
164
169
174
179
189
196
200
201#ifdef __cplusplus
202}
203#endif
204
205#endif /* ZEPHYR_INCLUDE_ZEPHYR_ARCH_PERF_COUNTER_H_ */
void perf_counter_stop(void)
Stop counting: disable the PMU globally (implementation-defined).
uint32_t perf_counter_num_counters(void)
void perf_counter_enable(uint32_t counter)
Enable counting on hardware event counter counter.
void perf_counter_reset_all(void)
Reset all hardware event counters to zero (implementation-defined; may include cycle counter policies...
int perf_counter_init(void)
Initialize the PMU for the current logical CPU.
int perf_counter_config(uint32_t counter, perf_counter_evt_t event)
Map hardware event counter counter to architectural event event.
void perf_counter_cycle_reset(void)
Reset the cycle count register to zero (implementation-defined).
uint64_t perf_counter_read(uint32_t counter)
Read the current value of hardware event counter counter.
void perf_counter_get_info(perf_counter_info_t *info)
Fill info with PMU identification for the current logical CPU.
uint64_t perf_counter_cycle_count(void)
Read the architectural cycle count register (if implemented).
bool perf_counter_overflow(uint32_t counter)
Return whether hardware event counter counter has overflowed since the flag was cleared.
void perf_counter_clear_overflow(uint32_t counter)
Clear the overflow flag for hardware event counter counter.
void perf_counter_disable_all(void)
Disable all event counters (and the cycle counter where applicable).
void perf_counter_disable(uint32_t counter)
Disable counting on hardware event counter counter.
void perf_counter_start(void)
Start counting: enable the PMU globally (implementation-defined).
void perf_counter_reset(uint32_t counter)
Reset hardware event counter counter to zero.
void perf_counter_enable_all(void)
Enable all implemented event counters (and the cycle counter where applicable).
uint32_t perf_counter_evt_t
Architectural / backend event selector when no arch supplement defines perf_counter_evt_t.
Definition perf_counter.h:26
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT64_TYPE__ uint64_t
Definition stdint.h:91
Performance counter configuration entry.
Definition perf_counter.h:48
bool enabled
Enable this counter when configured.
Definition perf_counter.h:52
perf_counter_evt_t event
Event (e.g.
Definition perf_counter.h:50
Placeholder perf_counter_info_t when no arch supplement is present.
Definition perf_counter.h:29
uint32_t implementer
PMU implementer identification value when reported by the backend.
Definition perf_counter.h:31
uint32_t idcode
PMU part number / ID code when reported by the backend.
Definition perf_counter.h:33