#[non_exhaustive]pub struct Raw {
pub config: u64,
pub config1: u64,
pub config2: u64,
}Expand description
A raw perf counter for the current CPU.
Most CPUs have additional counters beyond those provided by the kernel.
Raw events allow you to access those events. Note that the values needed
to configure raw events a liable to change between CPU vendors and even
different hardware revisions of the same platform.
The event can be chosen by setting the config field. Most events will
only need that, but others may require setting the config1 or config2
fields as well.
To find the config values required for counters consult your CPU manual.
- For Intel CPUs, see the Intel Software Developer Manual, volume 3B.
- For AMD, see the AMD BIOS and Kernel Developer Guide.
- Other vendors should have equivalent documentation.
Example:
use perf_event::events::Raw;
use perf_event::{Builder, Group};
// Raw config values for an ARMv8 PMU.
let INSNS_RETIRED: Raw = Raw::new(0x08);
let CPU_CYCLES: Raw = Raw::new(0x11);
let mut group = Group::new()?;
let raw_insns_retired = group.add(&Builder::new(INSNS_RETIRED).include_kernel())?;
let raw_cpu_cycles = group.add(&Builder::new(CPU_CYCLES).include_kernel())?;Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.config: u64Raw config of the event
config1: u64Raw config1 of the event
config2: u64Raw config2 of the event
Implementations§
Trait Implementations§
impl Copy for Raw
impl Eq for Raw
Source§impl Event for Raw
impl Event for Raw
Source§fn update_attrs(self, attr: &mut perf_event_attr)
fn update_attrs(self, attr: &mut perf_event_attr)
Update the
perf_event_attr struct so that it will record the
requested event. Read moreSource§fn update_attrs_with_data(
self,
attr: &mut perf_event_attr,
) -> Option<Arc<dyn EventData>>
fn update_attrs_with_data( self, attr: &mut perf_event_attr, ) -> Option<Arc<dyn EventData>>
Update the
perf_event_attr struct so that it will record the
requested event. Read moreimpl StructuralPartialEq for Raw
Auto Trait Implementations§
impl Freeze for Raw
impl RefUnwindSafe for Raw
impl Send for Raw
impl Sync for Raw
impl Unpin for Raw
impl UnsafeUnpin for Raw
impl UnwindSafe for Raw
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more