Trait perf_event::hooks::Hooks
source · pub trait Hooks {
Show 13 methods
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;
unsafe fn ENABLE(&mut self, _fd: c_int, _arg: c_uint) -> c_int { ... }
unsafe fn DISABLE(&mut self, _fd: c_int, _arg: c_uint) -> c_int { ... }
unsafe fn REFRESH(&mut self, _fd: c_int, _arg: c_int) -> c_int { ... }
unsafe fn RESET(&mut self, _fd: c_int, _arg: c_uint) -> c_int { ... }
unsafe fn PERIOD(&mut self, _fd: c_int, _arg: u64) -> c_int { ... }
unsafe fn SET_OUTPUT(&mut self, _fd: c_int, _arg: c_int) -> c_int { ... }
unsafe fn SET_FILTER(&mut self, _fd: c_int, _arg: *mut c_char) -> c_int { ... }
unsafe fn ID(&mut self, _fd: c_int, _arg: *mut u64) -> c_int { ... }
unsafe fn SET_BPF(&mut self, _fd: c_int, _arg: u32) -> c_int { ... }
unsafe fn PAUSE_OUTPUT(&mut self, _fd: c_int, _arg: u32) -> c_int { ... }
unsafe fn QUERY_BPF(
&mut self,
_fd: c_int,
_arg: *mut perf_event_query_bpf
) -> c_int { ... }
unsafe fn MODIFY_ATTRIBUTES(
&mut self,
_fd: c_int,
_arg: *mut perf_event_attr
) -> c_int { ... }
}
Expand description
A trait with a method for every system call and ioctl used by this crate.
The methods of this trait correspond to the public functions of
the perf_event_open_sys
crate used to implement this
crate’s functionality. For testing purposes, you can redirect this
crate to a value of your own design that implements this trait by
calling set_thread_hooks
.
Each method has a default definition that panics. This means that you only need to provide definitions for the operations your tests actually use; if they touch anything else, you’ll get a failure.
The RealHooks
type implements this trait in terms of the real
Linux system calls and ioctls.
Required Methods
sourceunsafe 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
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
Provided Methods
sourceunsafe fn ENABLE(&mut self, _fd: c_int, _arg: c_uint) -> c_int
unsafe fn ENABLE(&mut self, _fd: c_int, _arg: c_uint) -> c_int
Wrapper for perf_event ioctl perf_event_ioctls_ENABLE .
sourceunsafe fn DISABLE(&mut self, _fd: c_int, _arg: c_uint) -> c_int
unsafe fn DISABLE(&mut self, _fd: c_int, _arg: c_uint) -> c_int
Wrapper for perf_event ioctl perf_event_ioctls_DISABLE .
sourceunsafe fn REFRESH(&mut self, _fd: c_int, _arg: c_int) -> c_int
unsafe fn REFRESH(&mut self, _fd: c_int, _arg: c_int) -> c_int
Wrapper for perf_event ioctl perf_event_ioctls_REFRESH .
sourceunsafe fn RESET(&mut self, _fd: c_int, _arg: c_uint) -> c_int
unsafe fn RESET(&mut self, _fd: c_int, _arg: c_uint) -> c_int
Wrapper for perf_event ioctl perf_event_ioctls_RESET .
sourceunsafe fn PERIOD(&mut self, _fd: c_int, _arg: u64) -> c_int
unsafe fn PERIOD(&mut self, _fd: c_int, _arg: u64) -> c_int
Wrapper for perf_event ioctl perf_event_ioctls_PERIOD .
sourceunsafe fn SET_OUTPUT(&mut self, _fd: c_int, _arg: c_int) -> c_int
unsafe fn SET_OUTPUT(&mut self, _fd: c_int, _arg: c_int) -> c_int
Wrapper for perf_event ioctl perf_event_ioctls_SET_OUTPUT .
sourceunsafe fn SET_FILTER(&mut self, _fd: c_int, _arg: *mut c_char) -> c_int
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 .
sourceunsafe fn ID(&mut self, _fd: c_int, _arg: *mut u64) -> c_int
unsafe fn ID(&mut self, _fd: c_int, _arg: *mut u64) -> c_int
Wrapper for perf_event ioctl perf_event_ioctls_ID .
sourceunsafe fn SET_BPF(&mut self, _fd: c_int, _arg: u32) -> c_int
unsafe fn SET_BPF(&mut self, _fd: c_int, _arg: u32) -> c_int
Wrapper for perf_event ioctl perf_event_ioctls_SET_BPF .
sourceunsafe fn PAUSE_OUTPUT(&mut self, _fd: c_int, _arg: u32) -> c_int
unsafe fn PAUSE_OUTPUT(&mut self, _fd: c_int, _arg: u32) -> c_int
Wrapper for perf_event ioctl perf_event_ioctls_PAUSE_OUTPUT .
sourceunsafe fn QUERY_BPF(
&mut self,
_fd: c_int,
_arg: *mut perf_event_query_bpf
) -> c_int
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 .
sourceunsafe fn MODIFY_ATTRIBUTES(
&mut self,
_fd: c_int,
_arg: *mut perf_event_attr
) -> c_int
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 .