rte_pmu.h(3)

πŸ“¦
version 25.11 Β· 3 versions
, in centos-stream 9

✨ 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_group
  • struct 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, where PMU is 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