Struct perf_event_data::Mmap2

source ·
pub struct Mmap2<'a> {
    pub pid: u32,
    pub tid: u32,
    pub addr: u64,
    pub len: u64,
    pub pgoff: u64,
    pub prot: u32,
    pub flags: u32,
    pub filename: Cow<'a, [u8]>,
    /* private fields */
}
Expand description

MMAP2 events record memory mappings with extra info compared to MMAP records.

This struct corresponds to PERF_RECORD_MMAP2. See the manpage for more documentation here.

Fields§

§pid: u32

The process ID.

§tid: u32

The thread ID.

§addr: u64

The address that the mapping was placed at in the process’ address space.

§len: u64

The length, in bytes, of the allocated memory.

§pgoff: u64

The page offset of the memory mapping.

§prot: u32

Protection information for the mapping.

§flags: u32

Flags used when creating the mapping.

§filename: Cow<'a, [u8]>

The path to the file that is being mapped, if there is one.

Notes

  • Not all memory mappings have a path on the file system. In cases where there is no such path then this will be a label(ish) string from the kernel (e.g. [stack], [heap], [vdso], etc.)
  • Just because the mapping has a path doesn’t necessarily mean that the file at that path was the file that was mapped. The file may have been deleted in the meantime or the process may be under a chroot.

If you need to be able to tell whether the file at the path is the same one as was mapped you will need to use Mmap2 instead.

Implementations§

source§

impl<'a> Mmap2<'a>

source

pub fn filename_os(&self) -> &OsStr

The path to the file that is being mapped, as an OsStr.

Notes
  • Not all memory mappings have a path on the file system. In cases where there is no such path then this will be a label(ish) string from the kernel (e.g. [stack], [heap], [vdso], etc.)
  • Just because the mapping has a path doesn’t necessarily mean that the file at that path was the file that was mapped. The file may have been deleted in the meantime or the process may be under a chroot.

If you need to be able to tell whether the file at the path is the same one as was mapped you will need to use Mmap2 instead.

source

pub fn maj(&self) -> Option<u32>

The major ID of the underlying device of the fd being mapped.

source

pub fn min(&self) -> Option<u32>

The minor ID of the underlying device of the fd being mapped.

source

pub fn ino(&self) -> Option<u64>

The inode number.

source

pub fn ino_generation(&self) -> Option<u64>

The inode generation.

source

pub fn build_id(&self) -> Option<&[u8]>

The build id of the binary being mapped.

This variant will only be generated if build_id was set when building the counter.

source

pub fn to_mmap(&self) -> Mmap<'a>

Convert this record to a Mmap record.

source

pub fn into_mmap(self) -> Mmap<'a>

Convert this record to a Mmap record.

source

pub fn into_owned(self) -> Mmap2<'static>

Convert all the borrowed data in this Mmap2 into owned data.

Trait Implementations§

source§

impl<'a> Clone for Mmap2<'a>

source§

fn clone(&self) -> Mmap2<'a>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Mmap2<'_>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> From<Mmap2<'a>> for Mmap<'a>

source§

fn from(value: Mmap2<'a>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<Mmap2<'a>> for Record<'a>

source§

fn from(value: Mmap2<'a>) -> Self

Converts to this type from the input type.
source§

impl<'p> Parse<'p> for Mmap2<'p>

source§

fn parse<B, E>(p: &mut Parser<B, E>) -> ParseResult<Self>where E: Endian, B: ParseBuf<'p>,

Parse Self using the provided Parser instance.

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for Mmap2<'a>

§

impl<'a> Send for Mmap2<'a>

§

impl<'a> Sync for Mmap2<'a>

§

impl<'a> Unpin for Mmap2<'a>

§

impl<'a> UnwindSafe for Mmap2<'a>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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 Twhere U: TryFrom<T>,

§

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.