pub struct ProfileEvent {
pub name: String,
pub duration: Duration,
pub memory_delta_bytes: i64,
pub flops: u64,
pub metadata: HashMap<String, String>,
}Expand description
A single profiled event (one layer or one phase).
Fields§
§name: StringHuman-readable name, e.g. "attention.layer3".
duration: DurationWall-clock duration of the event.
memory_delta_bytes: i64Signed memory delta in bytes (positive = allocated, negative = freed).
flops: u64Estimated floating point operations performed.
metadata: HashMap<String, String>Arbitrary key-value metadata attached to this event.
Implementations§
Source§impl ProfileEvent
impl ProfileEvent
Sourcepub fn new(name: impl Into<String>) -> Self
pub fn new(name: impl Into<String>) -> Self
Create a new event with zero duration, no memory delta, and no FLOPs.
Sourcepub fn with_flops(self, flops: u64) -> Self
pub fn with_flops(self, flops: u64) -> Self
Builder: attach an estimated FLOP count.
Sourcepub fn with_metadata(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_metadata( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Builder: attach a key-value metadata entry.
Sourcepub fn duration_ms(&self) -> f64
pub fn duration_ms(&self) -> f64
Duration in milliseconds (floating point).
Sourcepub fn gflops_per_second(&self) -> f64
pub fn gflops_per_second(&self) -> f64
Estimated GFLOPs per second for this event.
Returns 0.0 if duration is zero or flops is zero.
Trait Implementations§
Source§impl Clone for ProfileEvent
impl Clone for ProfileEvent
Source§fn clone(&self) -> ProfileEvent
fn clone(&self) -> ProfileEvent
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 moreAuto Trait Implementations§
impl Freeze for ProfileEvent
impl RefUnwindSafe for ProfileEvent
impl Send for ProfileEvent
impl Sync for ProfileEvent
impl Unpin for ProfileEvent
impl UnsafeUnpin for ProfileEvent
impl UnwindSafe for ProfileEvent
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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