pub struct LostRecords {
pub record_id: Option<RecordId>,
pub id: u64,
pub lost_records: u64,
}
Expand description
Some records have been lost.
§Examples
use std::thread;
use std::time::Duration;
use perf_event_open::config::{Cpu, Opts, Proc, SampleOn, WakeUpOn};
use perf_event_open::count::Counter;
use perf_event_open::event::sw::Software;
use perf_event_open::sample::record::Record;
let event = Software::TaskClock;
let target = (Proc::ALL, Cpu(0));
let mut opts = Opts::default();
opts.stat_format.lost_records = true;
opts.wake_up.on = WakeUpOn::Samples(1);
opts.sample_on = SampleOn::Count(1_000_000); // 1ms
let counter = Counter::new(event, target, opts).unwrap();
let sampler = counter.sampler(5).unwrap();
counter.enable().unwrap();
// Pause the ring-buffer output, discarded samples are considered lost.
sampler.pause().unwrap();
thread::sleep(Duration::from_millis(10));
sampler.resume().unwrap();
let mut iter = sampler.iter().into_async().unwrap();
while let Some((_, r)) = iter.next().await {
if let Record::LostRecords(l) = r {
println!("{:-?}", l);
break;
}
}
Fields§
§record_id: Option<RecordId>
Record IDs.
id: u64
Event ID.
lost_records: u64
The number of lost records.
Trait Implementations§
Source§impl Clone for LostRecords
impl Clone for LostRecords
Source§fn clone(&self) -> LostRecords
fn clone(&self) -> LostRecords
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for LostRecords
impl RefUnwindSafe for LostRecords
impl Send for LostRecords
impl Sync for LostRecords
impl Unpin for LostRecords
impl UnwindSafe for LostRecords
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