pub trait GpuProfiler: Send + Sync {
// Required method
fn backend(&self) -> GpuProfilerBackend;
// Provided methods
fn is_available(&self) -> bool { ... }
fn start_capture(&self) -> Result<(), ProfilerError> { ... }
fn end_capture(&self) -> Result<(), ProfilerError> { ... }
fn trigger_capture(&self) -> Result<(), ProfilerError> { ... }
fn push_range(&self, name: &str, _color: ProfilerColor) -> ProfilerRange { ... }
fn pop_range(&self) { ... }
fn mark(&self, _name: &str, _color: ProfilerColor) { ... }
fn set_thread_name(&self, _name: &str) { ... }
fn message(&self, _text: &str) { ... }
fn register_allocation(&self, _ptr: u64, _size: usize, _name: &str) { ... }
fn unregister_allocation(&self, _ptr: u64) { ... }
}Expand description
Trait for GPU profiler integration.
Implement this trait to integrate with specific GPU profiling tools. The default implementation is a no-op for when no profiler is attached.
Required Methods§
Sourcefn backend(&self) -> GpuProfilerBackend
fn backend(&self) -> GpuProfilerBackend
Get the profiler backend type.
Provided Methods§
Sourcefn is_available(&self) -> bool
fn is_available(&self) -> bool
Check if the profiler is available and attached.
Sourcefn start_capture(&self) -> Result<(), ProfilerError>
fn start_capture(&self) -> Result<(), ProfilerError>
Start a profiler capture session.
Sourcefn end_capture(&self) -> Result<(), ProfilerError>
fn end_capture(&self) -> Result<(), ProfilerError>
End a profiler capture session.
Sourcefn trigger_capture(&self) -> Result<(), ProfilerError>
fn trigger_capture(&self) -> Result<(), ProfilerError>
Trigger a frame/dispatch capture.
Sourcefn push_range(&self, name: &str, _color: ProfilerColor) -> ProfilerRange
fn push_range(&self, name: &str, _color: ProfilerColor) -> ProfilerRange
Push a named range onto the profiler stack.
Sourcefn mark(&self, _name: &str, _color: ProfilerColor)
fn mark(&self, _name: &str, _color: ProfilerColor)
Insert an instantaneous marker.
Sourcefn set_thread_name(&self, _name: &str)
fn set_thread_name(&self, _name: &str)
Set a per-thread name for the profiler.
Sourcefn register_allocation(&self, _ptr: u64, _size: usize, _name: &str)
fn register_allocation(&self, _ptr: u64, _size: usize, _name: &str)
Register a GPU memory allocation.
Sourcefn unregister_allocation(&self, _ptr: u64)
fn unregister_allocation(&self, _ptr: u64)
Unregister a GPU memory allocation.