pub struct TaskMemoryProfile {
pub task_id: TaskId,
pub created_at: Instant,
pub completed_at: Option<Instant>,
pub total_allocated: u64,
pub current_usage: u64,
pub peak_usage: u64,
pub allocation_count: u64,
pub deallocation_count: u64,
pub average_allocation_size: f64,
}
Expand description
Memory usage profile for a single async task
Fields§
§task_id: TaskId
Unique task identifier
created_at: Instant
Task creation timestamp
completed_at: Option<Instant>
Task completion timestamp (if completed)
total_allocated: u64
Total bytes allocated by this task
current_usage: u64
Current memory usage (allocated - deallocated)
peak_usage: u64
Peak memory usage observed
allocation_count: u64
Number of allocation operations
deallocation_count: u64
Number of deallocation operations
average_allocation_size: f64
Average allocation size
Implementations§
Source§impl TaskMemoryProfile
impl TaskMemoryProfile
Sourcepub fn record_allocation(&mut self, size: u64)
pub fn record_allocation(&mut self, size: u64)
Record allocation event
Sourcepub fn record_deallocation(&mut self, size: u64)
pub fn record_deallocation(&mut self, size: u64)
Record deallocation event
Sourcepub fn mark_completed(&mut self)
pub fn mark_completed(&mut self)
Mark task as completed
Sourcepub fn is_completed(&self) -> bool
pub fn is_completed(&self) -> bool
Check if task is completed
Sourcepub fn memory_efficiency(&self) -> f64
pub fn memory_efficiency(&self) -> f64
Calculate memory efficiency (deallocated / allocated)
Sourcepub fn has_potential_leak(&self) -> bool
pub fn has_potential_leak(&self) -> bool
Check if task has potential memory leak
Trait Implementations§
Source§impl Clone for TaskMemoryProfile
impl Clone for TaskMemoryProfile
Source§fn clone(&self) -> TaskMemoryProfile
fn clone(&self) -> TaskMemoryProfile
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 TaskMemoryProfile
impl RefUnwindSafe for TaskMemoryProfile
impl Send for TaskMemoryProfile
impl Sync for TaskMemoryProfile
impl Unpin for TaskMemoryProfile
impl UnwindSafe for TaskMemoryProfile
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