Skip to main content

PerfMmapBasedMemoryReader

Struct PerfMmapBasedMemoryReader 

Source
pub struct PerfMmapBasedMemoryReader { /* private fields */ }
Available on crate feature perf_memory_reader only.
Expand description

Memory reader that re-construct memory content from perf.data files.

To create a memory reader from perf.data, you should make sure that all binary images involved in the process that be recorded into perf.data are not modified and still in their original paths (perf.data only records the mmap operation for the target process, we use the arguments of mmap to reconstruct the target memory)

You should not use this struct if your perf.data also records kernel traces, since the kernel memory information would not be recorded in the perf.data file.

Implementations§

Source§

impl PerfMmapBasedMemoryReader

Source

pub fn new( mmap2_headers: &[PerfMmap2Header], ) -> Result<Self, PerfMmapBasedMemoryReaderCreateError>

Create a memory reader from mmap2 headers in perf.data.

Some special mmapped regions (e.g. VDSO pages) will be skipped since we cannot get its content.

Source

pub fn mmapped_entries(&self) -> &[MmappedEntry]

Get mmapped entries.

The entries are guaranteed to be sorted by virtual addresses

Trait Implementations§

Source§

impl ReadMemory for PerfMmapBasedMemoryReader

Source§

type Error = PerfMmapBasedMemoryReaderError

Error for memory reading
Source§

fn at_decode_begin(&mut self) -> Result<(), Self::Error>

Callback at begin of decoding. Read more
Source§

fn read_memory<T>( &mut self, address: u64, size: usize, callback: impl FnOnce(&[u8]) -> T, ) -> Result<T, Self::Error>

Read memories at given address with given size, and invoke the given callback with the read memories. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.