pub struct CtxSwitch {
pub record_id: Option<RecordId>,
pub info: Switch,
}
Expand description
Process context switched.
§Examples
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::sw::Software;
let event = Software::Dummy;
let target = (Proc::CURRENT, Cpu::ALL);
let mut opts = Opts::default();
opts.extra_record.ctx_switch = true;
let counter = Counter::new(event, target, opts).unwrap();
let sampler = counter.sampler(5).unwrap();
counter.enable().unwrap();
// Triggers a context switch.
thread::sleep(Duration::from_millis(1));
for it in sampler.iter() {
println!("{:-?}", it);
}
Since linux-4.3
: https://github.com/torvalds/linux/commit/45ac1403f564f411c6a383a2448688ba8dd705a4
Fields§
§record_id: Option<RecordId>
Record IDs.
info: Switch
Context switch info.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CtxSwitch
impl RefUnwindSafe for CtxSwitch
impl Send for CtxSwitch
impl Sync for CtxSwitch
impl Unpin for CtxSwitch
impl UnwindSafe for CtxSwitch
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