pub struct ProfileTrace {
pub events: Vec<ProfileEvent>,
pub total_duration: Duration,
pub peak_memory_bytes: usize,
pub total_flops: u64,
}Expand description
Complete record of one inference pass.
Fields§
§events: Vec<ProfileEvent>Ordered list of events that occurred during the pass.
total_duration: DurationTotal wall-clock duration of the entire trace.
peak_memory_bytes: usizePeak resident memory observed during the trace (best-effort).
total_flops: u64Sum of estimated FLOPs across all events.
Implementations§
Source§impl ProfileTrace
impl ProfileTrace
Sourcepub fn top_events(&self, n: usize) -> Vec<&ProfileEvent>
pub fn top_events(&self, n: usize) -> Vec<&ProfileEvent>
Return the n events with the longest duration, sorted descending.
Sourcepub fn duration_for_prefix(&self, prefix: &str) -> Duration
pub fn duration_for_prefix(&self, prefix: &str) -> Duration
Sum the durations of all events whose names start with prefix.
Sourcepub fn avg_duration_for_prefix(&self, prefix: &str) -> Option<Duration>
pub fn avg_duration_for_prefix(&self, prefix: &str) -> Option<Duration>
Average duration of events whose names start with prefix.
Returns None if no events match.
Sourcepub fn aggregate_gflops(&self) -> f64
pub fn aggregate_gflops(&self) -> f64
Overall GFLOPs/s: total_flops / total_duration.
Returns 0.0 if duration is zero.
Sourcepub fn layer_breakdown(&self) -> HashMap<String, f64>
pub fn layer_breakdown(&self) -> HashMap<String, f64>
Map from event name to duration in milliseconds.
If multiple events share the same name, their durations are summed.
Trait Implementations§
Source§impl Clone for ProfileTrace
impl Clone for ProfileTrace
Source§fn clone(&self) -> ProfileTrace
fn clone(&self) -> ProfileTrace
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ProfileTrace
impl Debug for ProfileTrace
Source§impl Default for ProfileTrace
impl Default for ProfileTrace
Source§fn default() -> ProfileTrace
fn default() -> ProfileTrace
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ProfileTrace
impl RefUnwindSafe for ProfileTrace
impl Send for ProfileTrace
impl Sync for ProfileTrace
impl Unpin for ProfileTrace
impl UnsafeUnpin for ProfileTrace
impl UnwindSafe for ProfileTrace
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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