rte_pmu.h(3)
β¨ NAME β¨
rte_pmu.h β it's the DPDK header for the Performance Monitoring Unit (PMU) event tracing operations π (and yes bestie, it's from the DPDK manual, page rte_pmu.h(3) β here for you in the group chat π
)
π SYNOPSIS π
#include <linux/perf_event.h>
#include <rte_atomic.h>
#include <rte_branch_prediction.h>
#include <rte_common.h>
#include <rte_compat.h>
#include <rte_debug.h>
#include <rte_lcore.h>
π§ Data Structures
struct rte_pmu_event_groupstruct rte_pmu
π Macros
#define RTE_MAX_NUM_GROUP_EVENTS 8
π₯ Functions
static __rte_experimental __rte_always_inline uint64_t
__rte_pmu_read_userpage (struct perf_event_mmap_page *pc)
__rte_experimental int __rte_pmu_enable_group (struct
rte_pmu_event_group *group)
__rte_experimental int rte_pmu_init (void)
__rte_experimental void rte_pmu_fini (void)
__rte_experimental int rte_pmu_add_event (const char *name)
static __rte_experimental __rte_always_inline uint64_t rte_pmu_read
(unsigned int index)
π Variables
struct rte_pmu rte_pmu
π Detailed Description π
Okay so this whole file is about PMU event tracing β literally the Performance Monitoring Unit, the hardware's little gossip mill counting everything for you πβ¨
It defines the generic API and the types you need to set up PMU and read selected counters in runtime. Here's the tea though: the exported functions are generally not MT-safe except for one icon β rte_pmu_read() β which can be called concurrently once everything has been set up first. No cap π
To initialize the library, this exact sequence of calls, performed by the same EAL thread, is required:
rte_pmu_init() rte_pmu_add_event()
Afterwards all threads can read events by calling rte_pmu_read() π¦
Definition in file rte_pmu.h.
π Macro Definition Documentation π
π #define RTE_MAX_NUM_GROUP_EVENTS 8
Maximum number of events in a group. Eight. That's the vibe check, that's the limit periodt π±
Definition at line 48 of file rte_pmu.h.
β Function Documentation β
πΈ static __rte_experimental __rte_always_inline uint64_t __rte_pmu_read_userpage (struct perf_event_mmap_page * pc) [static]
Warning β EXPERIMENTAL: this API may change without prior notice π
Read PMU counter. Reads the counter, that's it, that's the job β¨
Warning β This should not be called directly. Bestie, please. It's not for you to call π
Parameters
pcβ Pointer to the mmapped user page.
Returns
Counter value read from hardware.
Definition at line 95 of file rte_pmu.h.
π __rte_experimental int __rte_pmu_enable_group (struct rte_pmu_event_group * group)
Warning β EXPERIMENTAL: this API may change without prior notice π
Enable group of events on the calling lcore. (The lcore wakes up and is like "we're so on" π )
Warning β This should not be called directly either π
Parameters
groupβ Pointer to the group which will be enabled.
Returns
0 in case of success, negative value otherwise.
π¦ __rte_experimental int rte_pmu_init (void)
Warning β EXPERIMENTAL: this API may change without prior notice π
Initialize PMU library. The main character of the init sequence fr fr π
Returns
0 in case of success, negative value otherwise.
π __rte_experimental void rte_pmu_fini (void)
Warning β EXPERIMENTAL: this API may change without prior notice π
Finalize PMU library. It ate and now it's leaving the party π«Ά
π __rte_experimental int rte_pmu_add_event (const char * name)
Warning β EXPERIMENTAL: this API may change without prior notice π
Add event to the group of enabled events. New event just dropped π
Parameters
nameβ Name of an event listed under/sys/bus/event_source/devices/pmu/events, wherePMUis a placeholder for an event source.
Returns
Event index in case of success, negative value otherwise.
π§ static __rte_experimental __rte_always_inline uint64_t rte_pmu_read (unsigned int index) [static]
Warning β EXPERIMENTAL: this API may change without prior notice π
Read hardware counter configured to count occurrences of an event π
So here's the important caveat, listen up: this is called by an lcore (EAL thread) bound exclusively to a particular CPU, and it may not work as expected if it gets migrated elsewhere π¬ The reason being the event group is pinned, hence it's not supposed to be multiplexed with any other events. Also β and this is the iconic part β this is the only API which can be called concurrently by different lcores π β¨
Parameters
indexβ Index of an event to be read.
Returns
Event value read from register. In case of errors or lack of support, 0 is returned. In other words, a stream of zeros in a trace file indicates a problem with reading that particular PMU event register π
Definition at line 204 of file rte_pmu.h.
π«Ά Variable Documentation π«Ά
π struct rte_pmu rte_pmu [extern]
PMU state container. The holder of the state, the keeper of the vibes π
π Author π
Generated automatically by Doxygen for DPDK from the source code. (Not a person, just a robot doing its little robot thing π€β¨)
And that's the whole page bestie, ily, go read your counters responsibly ππ
Version 25.11.0 β dated Fri Jan 30 2026, signing off with a little rte_pmu_fini() of my own ππ«Ά mwah π
π¦ where this page comes from
- centos-stream 9: dpdk-devel 2:25.11-1.el9 Β· BSD and LGPLv2 and GPLv2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms