|
|
@ -282,21 +282,6 @@ impl Drop for PerfBuffer {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
|
|
|
|
#[repr(C)]
|
|
|
|
|
|
|
|
struct Sample {
|
|
|
|
|
|
|
|
header: perf_event_header,
|
|
|
|
|
|
|
|
size: u32,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[repr(C)]
|
|
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
|
|
|
|
struct LostSamples {
|
|
|
|
|
|
|
|
header: perf_event_header,
|
|
|
|
|
|
|
|
id: u64,
|
|
|
|
|
|
|
|
count: u64,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[cfg(test)]
|
|
|
|
#[cfg(test)]
|
|
|
|
mod tests {
|
|
|
|
mod tests {
|
|
|
|
use std::{fmt::Debug, mem};
|
|
|
|
use std::{fmt::Debug, mem};
|
|
|
@ -309,6 +294,13 @@ mod tests {
|
|
|
|
sys::{override_syscall, Syscall, TEST_MMAP_RET},
|
|
|
|
sys::{override_syscall, Syscall, TEST_MMAP_RET},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[repr(C)]
|
|
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
|
|
|
|
struct Sample {
|
|
|
|
|
|
|
|
header: perf_event_header,
|
|
|
|
|
|
|
|
size: u32,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const PAGE_SIZE: usize = 4096;
|
|
|
|
const PAGE_SIZE: usize = 4096;
|
|
|
|
union MMappedBuf {
|
|
|
|
union MMappedBuf {
|
|
|
|
mmap_page: perf_event_mmap_page,
|
|
|
|
mmap_page: perf_event_mmap_page,
|
|
|
@ -375,6 +367,14 @@ mod tests {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
fake_mmap(&mmapped_buf);
|
|
|
|
fake_mmap(&mmapped_buf);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[repr(C)]
|
|
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
|
|
|
|
struct LostSamples {
|
|
|
|
|
|
|
|
header: perf_event_header,
|
|
|
|
|
|
|
|
id: u64,
|
|
|
|
|
|
|
|
count: u64,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let evt = LostSamples {
|
|
|
|
let evt = LostSamples {
|
|
|
|
header: perf_event_header {
|
|
|
|
header: perf_event_header {
|
|
|
|
type_: PERF_RECORD_LOST as u32,
|
|
|
|
type_: PERF_RECORD_LOST as u32,
|
|
|
|