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