Trait webrender::ProfilerHooks
source · pub trait ProfilerHooks: Send + Sync {
// Required methods
fn register_thread(&self, thread_name: &str);
fn unregister_thread(&self);
fn begin_marker(&self, label: &str);
fn end_marker(&self, label: &str);
fn event_marker(&self, label: &str);
fn add_text_marker(&self, label: &str, text: &str, duration: Duration);
fn thread_is_being_profiled(&self) -> bool;
}
Expand description
Defines the interface for hooking up an external profiler to WR.
Required Methods§
sourcefn register_thread(&self, thread_name: &str)
fn register_thread(&self, thread_name: &str)
Register a thread with the profiler.
sourcefn unregister_thread(&self)
fn unregister_thread(&self)
Unregister a thread with the profiler.
sourcefn begin_marker(&self, label: &str)
fn begin_marker(&self, label: &str)
Called at the beginning of a profile scope.
sourcefn end_marker(&self, label: &str)
fn end_marker(&self, label: &str)
Called at the end of a profile scope.
sourcefn event_marker(&self, label: &str)
fn event_marker(&self, label: &str)
Called to mark an event happening.
sourcefn add_text_marker(&self, label: &str, text: &str, duration: Duration)
fn add_text_marker(&self, label: &str, text: &str, duration: Duration)
Called with a duration to indicate a text marker that just ended. Text markers allow different types of entries to be recorded on the same row in the timeline, by adding labels to the entry.
This variant is also useful when the caller only wants to record events longer than a certain threshold, and thus they don’t know in advance whether the event will qualify.
sourcefn thread_is_being_profiled(&self) -> bool
fn thread_is_being_profiled(&self) -> bool
Returns true if the current thread is being profiled.