pub enum PerfEventType {
Hardware(HardwareEventId, PmuTypeId),
Software(SoftwareCounterType),
Tracepoint(u64),
HwCache(HardwareCacheId, HardwareCacheOp, HardwareCacheOpResult, PmuTypeId),
Breakpoint(HwBreakpointType, HwBreakpointAddr, HwBreakpointLen),
DynamicPmu(u32, u64, u64, u64),
}
Expand description
The type of perf event
Variants§
Hardware(HardwareEventId, PmuTypeId)
A hardware perf event. (PERF_TYPE_HARDWARE
)
Software(SoftwareCounterType)
A software perf event. (PERF_TYPE_SOFTWARE
)
Special “software” events provided by the kernel, even if the hardware does not support performance events. These events measure various physical and sw events of the kernel (and allow the profiling of them as well).
Tracepoint(u64)
A tracepoint perf event. (PERF_TYPE_TRACEPOINT
)
HwCache(HardwareCacheId, HardwareCacheOp, HardwareCacheOpResult, PmuTypeId)
A hardware cache perf event. (PERF_TYPE_HW_CACHE
)
Selects a certain combination of CacheId, CacheOp, CacheOpResult, PMU type ID.
{ L1-D, L1-I, LLC, ITLB, DTLB, BPU, NODE } x
{ read, write, prefetch } x
{ accesses, misses }
Breakpoint(HwBreakpointType, HwBreakpointAddr, HwBreakpointLen)
A hardware breakpoint perf event. (PERF_TYPE_BREAKPOINT
)
Breakpoints can be read/write accesses to an address as well as execution of an instruction address.
DynamicPmu(u32, u64, u64, u64)
Dynamic PMU
(pmu, config, config1, config2)
Acceptable values for each of config
, config1
and config2
parameters are defined by corresponding entries in
/sys/bus/event_source/devices/<pmu>/format/*
.
From the perf_event_open
man page:
Since Linux 2.6.38, perf_event_open() can support multiple PMUs. To enable this, a value exported by the kernel can be used in the type field to indicate which PMU to use. The value to use can be found in the sysfs filesystem: there is a subdirectory per PMU instance under /sys/bus/event_source/devices. In each subdirectory there is a type file whose content is an integer that can be used in the type field. For instance, /sys/bus/event_source/devices/cpu/type contains the value for the core CPU PMU, which is usually 4.
(I don’t fully understand this - the value 4 also means PERF_TYPE_RAW
.
Maybe the type Raw
is just one of those dynamic PMUs, usually “core”?)
Among the “dynamic PMU” values, there are two special values for kprobes and uprobes:
kprobe and uprobe (since Linux 4.17) These two dynamic PMUs create a kprobe/uprobe and attach it to the file descriptor generated by perf_event_open. The kprobe/uprobe will be destroyed on the destruction of the file descriptor. See fields kprobe_func, uprobe_path, kprobe_addr, and probe_offset for more details.
union {
__u64 kprobe_func; /* for perf_kprobe */
__u64 uprobe_path; /* for perf_uprobe */
__u64 config1; /* extension of config */
};
union {
__u64 kprobe_addr; /* when kprobe_func == NULL */
__u64 probe_offset; /* for perf_[k,u]probe */
__u64 config2; /* extension of config1 */
};
Implementations§
Trait Implementations§
Source§impl Clone for PerfEventType
impl Clone for PerfEventType
Source§fn clone(&self) -> PerfEventType
fn clone(&self) -> PerfEventType
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read more