Skip to main content

set_thread_hooks

Function set_thread_hooks 

Source
pub unsafe fn set_thread_hooks(hooks: Box<dyn Hooks + 'static>)
Expand description

Direct all perf-event system calls on this thread to hooks.

All subsequent uses by this crate of the underlying system calls and ioctls from the perf_event_open_sys crate are redirected to hooks’ implementations of the correspoding methods from the Hooks trait.

This affects only the calling thread. Any previously established hooks on that thread are dropped.

§Safety

The specified hooks trait object intercepts calls provoked by previously created Counter and Group objects, regardless of which hooks were in effect when they were created. This could make a hash of things.