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

Portable CPU performance monitoring (PMU) counter API. More...

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

Go to the source code of this file.

Data Structures

struct  perf_counter_info_t
 Placeholder perf_counter_info_t when no arch supplement is present. More...
struct  perf_counter_config
 Performance counter configuration entry. More...

Typedefs

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

Functions

int perf_counter_init (void)
 Initialize the PMU for the current logical CPU.
uint32_t perf_counter_num_counters (void)
void perf_counter_get_info (perf_counter_info_t *info)
 Fill info with PMU identification 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_enable (uint32_t counter)
 Enable counting on hardware event counter counter.
void perf_counter_disable (uint32_t counter)
 Disable counting on hardware event counter counter.
void perf_counter_enable_all (void)
 Enable all implemented event counters (and the cycle counter where applicable).
void perf_counter_disable_all (void)
 Disable all event counters (and the cycle counter where applicable).
uint64_t perf_counter_read (uint32_t counter)
 Read the current value of hardware event counter counter.
void perf_counter_reset (uint32_t counter)
 Reset hardware event counter counter to zero.
void perf_counter_reset_all (void)
 Reset all hardware event counters to zero (implementation-defined; may include cycle counter policies).
uint64_t perf_counter_cycle_count (void)
 Read the architectural cycle count register (if implemented).
void perf_counter_cycle_reset (void)
 Reset the cycle count register to zero (implementation-defined).
void perf_counter_start (void)
 Start counting: enable the PMU globally (implementation-defined).
void perf_counter_stop (void)
 Stop counting: disable the PMU globally (implementation-defined).
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.

Detailed Description

Portable CPU performance monitoring (PMU) counter API.

Typedef Documentation

◆ perf_counter_evt_t

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