Scroll to navigation

rte_pmu.h(3) Library Functions Manual rte_pmu.h(3)

NAME

rte_pmu.h

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

Performance Monitoring Unit (PMU) event tracing operations

This file defines generic API and types necessary to setup PMU and read selected counters in runtime. Exported functions are generally not MT-safe. One exception is rte_pmu_read() which can be called concurrently once everything has been setup.

In order to initialize the library, following 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.

Definition at line 48 of file rte_pmu.h.

Function Documentation

__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.

Warning

This should not be called directly.

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.

Warning

This should not be called directly.

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.

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.

__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.

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.

__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.

This is called by an lcore (EAL thread) bound exclusively to particular CPU and may not work as expected if gets migrated elsewhere. Reason being event group is pinned hence not supposed to be multiplexed with any other events. 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, stream of zeros in a trace file indicates problem with reading particular PMU event register.

Definition at line 204 of file rte_pmu.h.

Variable Documentation

struct rte_pmu rte_pmu [extern]

PMU state container.

Author

Generated automatically by Doxygen for DPDK from the source code.

Version 25.11.0 DPDK