|
|
@ -3,6 +3,7 @@ use std::{
|
|
|
|
ffi::c_void,
|
|
|
|
ffi::c_void,
|
|
|
|
io, mem,
|
|
|
|
io, mem,
|
|
|
|
ops::DerefMut,
|
|
|
|
ops::DerefMut,
|
|
|
|
|
|
|
|
os::unix::prelude::AsRawFd,
|
|
|
|
ptr, slice,
|
|
|
|
ptr, slice,
|
|
|
|
sync::{
|
|
|
|
sync::{
|
|
|
|
atomic::{self, AtomicPtr, Ordering},
|
|
|
|
atomic::{self, AtomicPtr, Ordering},
|
|
|
@ -239,6 +240,12 @@ impl PerfBuffer {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
impl AsRawFd for PerfBuffer {
|
|
|
|
|
|
|
|
fn as_raw_fd(&self) -> RawFd {
|
|
|
|
|
|
|
|
self.fd
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
impl Drop for PerfBuffer {
|
|
|
|
impl Drop for PerfBuffer {
|
|
|
|
fn drop(&mut self) {
|
|
|
|
fn drop(&mut self) {
|
|
|
|
unsafe {
|
|
|
|
unsafe {
|
|
|
@ -290,6 +297,12 @@ impl<T: DerefMut<Target = Map>> PerfMapBuffer<T> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
impl<T: DerefMut<Target = Map>> AsRawFd for PerfMapBuffer<T> {
|
|
|
|
|
|
|
|
fn as_raw_fd(&self) -> RawFd {
|
|
|
|
|
|
|
|
self.buf.as_raw_fd()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pub struct PerfMap<T: DerefMut<Target = Map>> {
|
|
|
|
pub struct PerfMap<T: DerefMut<Target = Map>> {
|
|
|
|
map: Arc<T>,
|
|
|
|
map: Arc<T>,
|
|
|
|
page_size: usize,
|
|
|
|
page_size: usize,
|
|
|
|