Skip to main content

RealHooks

Struct RealHooks 

Source
pub struct RealHooks;
Expand description

An implementation of the Hooks trait in terms of the real Linux system calls.

This type implements each methods of the Hooks trait by calling the underlying system call or ioctl. The following call is equivalent to calling clear_thread_hooks:

unsafe {
    set_thread_hooks(Box::new(RealHooks));
}

If what you want is non-intercepted access to the underlying system calls, it’s probably better to just access the perf_event_open_sys crate directly, rather than using this type.

Trait Implementations§

Source§

impl Hooks for RealHooks

Source§

unsafe fn perf_event_open( &mut self, attrs: *mut perf_event_attr, pid: pid_t, cpu: c_int, group_fd: c_int, flags: c_ulong, ) -> c_int

Source§

unsafe fn ENABLE(&mut self, fd: c_int, arg: c_uint) -> c_int

Wrapper for perf_event ioctl perf_event_ioctls_ENABLE .
Source§

unsafe fn DISABLE(&mut self, fd: c_int, arg: c_uint) -> c_int

Wrapper for perf_event ioctl perf_event_ioctls_DISABLE .
Source§

unsafe fn REFRESH(&mut self, fd: c_int, arg: c_int) -> c_int

Wrapper for perf_event ioctl perf_event_ioctls_REFRESH .
Source§

unsafe fn RESET(&mut self, fd: c_int, arg: c_uint) -> c_int

Wrapper for perf_event ioctl perf_event_ioctls_RESET .
Source§

unsafe fn PERIOD(&mut self, fd: c_int, arg: u64) -> c_int

Wrapper for perf_event ioctl perf_event_ioctls_PERIOD .
Source§

unsafe fn SET_OUTPUT(&mut self, fd: c_int, arg: c_int) -> c_int

Wrapper for perf_event ioctl perf_event_ioctls_SET_OUTPUT .
Source§

unsafe fn SET_FILTER(&mut self, fd: c_int, arg: *mut c_char) -> c_int

Wrapper for perf_event ioctl perf_event_ioctls_SET_FILTER .
Source§

unsafe fn ID(&mut self, fd: c_int, arg: *mut u64) -> c_int

Wrapper for perf_event ioctl perf_event_ioctls_ID .
Source§

unsafe fn SET_BPF(&mut self, fd: c_int, arg: u32) -> c_int

Wrapper for perf_event ioctl perf_event_ioctls_SET_BPF .
Source§

unsafe fn PAUSE_OUTPUT(&mut self, fd: c_int, arg: u32) -> c_int

Wrapper for perf_event ioctl perf_event_ioctls_PAUSE_OUTPUT .
Source§

unsafe fn QUERY_BPF( &mut self, fd: c_int, arg: *mut perf_event_query_bpf, ) -> c_int

Wrapper for perf_event ioctl perf_event_ioctls_QUERY_BPF .
Source§

unsafe fn MODIFY_ATTRIBUTES( &mut self, fd: c_int, arg: *mut perf_event_attr, ) -> c_int

Wrapper for perf_event ioctl perf_event_ioctls_MODIFY_ATTRIBUTES .

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.