pub struct Aux {
pub record_id: Option<RecordId>,
pub offset: u64,
pub size: u64,
pub truncated: bool,
pub overwrite: bool,
pub partial: bool,
pub collision: bool,
pub pmu_format_type: u8,
}
Expand description
New data is available in the AUX area.
§Examples
use std::fs::read_to_string;
use std::sync::mpsc::channel;
use std::thread;
use std::time::Duration;
use perf_event_open::config::{Cpu, Opts, Proc};
use perf_event_open::count::Counter;
use perf_event_open::event::dp::DynamicPmu;
let (tid_tx, tid_rx) = channel();
thread::spawn(move || {
tid_tx.send(unsafe { libc::gettid() }).unwrap();
loop {
std::hint::spin_loop();
}
});
// Intel PT
let ty = read_to_string("/sys/bus/event_source/devices/intel_pt/type");
let event = DynamicPmu {
ty: ty.unwrap().lines().next().unwrap().parse().unwrap(),
config: 0,
config1: 0,
config2: 0,
config3: 0,
};
let target = (Proc(tid_rx.recv().unwrap() as _), Cpu::ALL);
let opts = Opts::default();
let counter = Counter::new(event, target, opts).unwrap();
let sampler = counter.sampler(10).unwrap();
let aux = sampler.aux_tracer(10).unwrap();
counter.enable().unwrap();
thread::sleep(Duration::from_millis(1));
counter.disable().unwrap();
for it in sampler.iter() {
println!("{:-?}", it);
}
while let Some(it) = aux.iter().next(None) {
let bytes = it.len();
println!("{:.2} KB", bytes as f64 / 1000.0);
}
Since linux-4.1
: https://github.com/torvalds/linux/commit/68db7e98c3a6ebe7284b6cf14906ed7c55f3f7f0
Fields§
§record_id: Option<RecordId>
Record IDs.
offset: u64
Data offset in the AUX area.
size: u64
Data size.
truncated: bool
Record was truncated to fit.
overwrite: bool
Snapshot from overwrite mode.
partial: bool
Record contains gaps.
Since linux-4.12
: https://github.com/torvalds/linux/commit/ae0c2d995d648d5165545d5e05e2869642009b38
collision: bool
Sample collided with another.
Since linux-4.15
: https://github.com/torvalds/linux/commit/085b30625e39df67d7320f22269796276c6b0c11
pmu_format_type: u8
PMU specific trace format type.
Since linux-5.13
: https://github.com/torvalds/linux/commit/547b60988e631f74ed025cf1ec50cfc17f49fd13
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Aux
impl RefUnwindSafe for Aux
impl Send for Aux
impl Sync for Aux
impl Unpin for Aux
impl UnwindSafe for Aux
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