pub struct GpuProfiler { /* private fields */ }Expand description
Central GPU profiler that owns all active and completed timestamps.
§Example
use oximedia_gpu::gpu_profiler::GpuProfiler;
let mut profiler = GpuProfiler::new();
profiler.begin("tonemap");
// ... GPU work ...
profiler.end("tonemap");
let summary = profiler.summary();
assert!(summary.contains_key("tonemap"));Implementations§
Source§impl GpuProfiler
impl GpuProfiler
Sourcepub fn begin(&mut self, label: impl Into<String>)
pub fn begin(&mut self, label: impl Into<String>)
Begin a new profiling scope with the given label.
If a scope with this label is already active it is overwritten.
Sourcepub fn end(&mut self, label: &str)
pub fn end(&mut self, label: &str)
End an active scope identified by label.
Records the elapsed time into cumulative stats. Does nothing if the label is not currently active.
Sourcepub fn scope(&mut self, label: impl Into<String>) -> GpuProfilerScope<'_>
pub fn scope(&mut self, label: impl Into<String>) -> GpuProfilerScope<'_>
Open a scope and return an RAII guard that calls end on drop.
Sourcepub fn summary(&self) -> &HashMap<String, ScopeStats>
pub fn summary(&self) -> &HashMap<String, ScopeStats>
Return a snapshot of the accumulated statistics for every scope.
Sourcepub fn scope_count(&self) -> usize
pub fn scope_count(&self) -> usize
Return the number of distinct scope labels that have been recorded.
Trait Implementations§
Source§impl Debug for GpuProfiler
impl Debug for GpuProfiler
Source§impl Default for GpuProfiler
impl Default for GpuProfiler
Source§fn default() -> GpuProfiler
fn default() -> GpuProfiler
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for GpuProfiler
impl RefUnwindSafe for GpuProfiler
impl Send for GpuProfiler
impl Sync for GpuProfiler
impl Unpin for GpuProfiler
impl UnsafeUnpin for GpuProfiler
impl UnwindSafe for GpuProfiler
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more