pub struct Metrics {
pub comparisons: u64,
pub moves: u64,
pub execution_time_us: u64,
pub peak_memory_bytes: usize,
pub current_memory_bytes: usize,
pub steps: usize,
pub array_accesses: u64,
pub recursive_calls: u64,
}
Expand description
Comprehensive metrics for algorithm performance
Fields§
§comparisons: u64
Total number of comparisons performed
moves: u64
Total number of element moves/swaps performed
execution_time_us: u64
Total execution time in microseconds
peak_memory_bytes: usize
Peak memory usage in bytes
current_memory_bytes: usize
Current memory usage in bytes
steps: usize
Number of algorithm steps executed
array_accesses: u64
Array access count (reads + writes)
recursive_calls: u64
Number of recursive calls made
Implementations§
Source§impl Metrics
impl Metrics
Sourcepub fn add_comparisons(&mut self, count: u64)
pub fn add_comparisons(&mut self, count: u64)
Add comparison count
Sourcepub fn update_memory(&mut self, current: usize)
pub fn update_memory(&mut self, current: usize)
Update memory usage
Sourcepub fn increment_steps(&mut self)
pub fn increment_steps(&mut self)
Increment step counter
Sourcepub fn add_array_accesses(&mut self, count: u64)
pub fn add_array_accesses(&mut self, count: u64)
Add array access count
Sourcepub fn add_recursive_calls(&mut self, count: u64)
pub fn add_recursive_calls(&mut self, count: u64)
Add recursive call count
Sourcepub fn ops_per_second(&self) -> f64
pub fn ops_per_second(&self) -> f64
Calculate operations per second
Sourcepub fn avg_step_time_us(&self) -> f64
pub fn avg_step_time_us(&self) -> f64
Calculate average time per step
Sourcepub fn memory_efficiency(&self) -> f64
pub fn memory_efficiency(&self) -> f64
Get memory efficiency ratio
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Metrics
impl RefUnwindSafe for Metrics
impl Send for Metrics
impl Sync for Metrics
impl Unpin for Metrics
impl UnwindSafe for Metrics
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