pub struct OperationMetrics {
pub name: String,
pub duration: Duration,
pub peak_memory: Option<usize>,
pub input_shapes: Vec<Vec<usize>>,
pub output_shapes: Vec<Vec<usize>>,
pub flops: Option<u64>,
pub memory_bandwidth: Option<f64>,
pub cpu_utilization: Option<f32>,
pub custom_metrics: HashMap<String, f64>,
}Expand description
Performance metrics for an operation
Fields§
§name: StringName of the operation
duration: DurationExecution time
peak_memory: Option<usize>Peak memory usage during operation (in bytes)
input_shapes: Vec<Vec<usize>>Input tensor shapes
output_shapes: Vec<Vec<usize>>Output tensor shapes
flops: Option<u64>Number of floating-point operations (estimated)
memory_bandwidth: Option<f64>Memory bandwidth utilization (bytes/second)
cpu_utilization: Option<f32>CPU utilization percentage
custom_metrics: HashMap<String, f64>Additional custom metrics
Implementations§
Source§impl OperationMetrics
impl OperationMetrics
Sourcepub fn add_metric(&mut self, key: String, value: f64)
pub fn add_metric(&mut self, key: String, value: f64)
Add a custom metric
Sourcepub fn throughput(&self) -> f64
pub fn throughput(&self) -> f64
Get throughput in operations per second
Sourcepub fn flops_per_second(&self) -> Option<f64>
pub fn flops_per_second(&self) -> Option<f64>
Get FLOPS (floating-point operations per second)
Sourcepub fn memory_efficiency(&self, peak_bandwidth_gbps: f64) -> Option<f64>
pub fn memory_efficiency(&self, peak_bandwidth_gbps: f64) -> Option<f64>
Get memory efficiency (fraction of peak bandwidth utilized)
Trait Implementations§
Source§impl Clone for OperationMetrics
impl Clone for OperationMetrics
Source§fn clone(&self) -> OperationMetrics
fn clone(&self) -> OperationMetrics
Returns a duplicate of the value. Read more
1.0.0 · 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 OperationMetrics
impl RefUnwindSafe for OperationMetrics
impl Send for OperationMetrics
impl Sync for OperationMetrics
impl Unpin for OperationMetrics
impl UnsafeUnpin for OperationMetrics
impl UnwindSafe for OperationMetrics
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> 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