pub struct CachedFunctionMetadata {
pub compiled_at: SystemTime,
pub execution_count: u64,
pub total_execution_time_ns: u64,
pub avg_execution_time_ns: f64,
pub function_size_bytes: usize,
pub compilation_time_ns: u64,
pub is_hot: bool,
pub last_accessed: Instant,
pub effectiveness_score: f64,
}Expand description
Metadata about a cached function
Fields§
§compiled_at: SystemTimeWhen the function was compiled
execution_count: u64How many times this function has been executed
total_execution_time_ns: u64Total execution time in nanoseconds
avg_execution_time_ns: f64Average execution time in nanoseconds
function_size_bytes: usizeSize of the compiled function in bytes
compilation_time_ns: u64Compilation time in nanoseconds
is_hot: boolWhether this function is performance-critical (frequently used)
last_accessed: InstantLast access time
effectiveness_score: f64Function effectiveness score (performance improvement over naive implementation)
Implementations§
Source§impl CachedFunctionMetadata
impl CachedFunctionMetadata
Sourcepub fn new(compilation_time_ns: u64, function_size_bytes: usize) -> Self
pub fn new(compilation_time_ns: u64, function_size_bytes: usize) -> Self
Create new metadata for a compiled function
Sourcepub fn record_execution(&mut self, execution_time_ns: u64)
pub fn record_execution(&mut self, execution_time_ns: u64)
Record an execution of this function
Sourcepub fn cache_benefit(&self) -> f64
pub fn cache_benefit(&self) -> f64
Calculate the benefit of caching this function
Sourcepub fn should_evict(&self, cache_pressure: f64) -> bool
pub fn should_evict(&self, cache_pressure: f64) -> bool
Check if this function should be evicted from cache
Trait Implementations§
Source§impl Clone for CachedFunctionMetadata
impl Clone for CachedFunctionMetadata
Source§fn clone(&self) -> CachedFunctionMetadata
fn clone(&self) -> CachedFunctionMetadata
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 CachedFunctionMetadata
impl RefUnwindSafe for CachedFunctionMetadata
impl Send for CachedFunctionMetadata
impl Sync for CachedFunctionMetadata
impl Unpin for CachedFunctionMetadata
impl UnsafeUnpin for CachedFunctionMetadata
impl UnwindSafe for CachedFunctionMetadata
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