pub struct TaskMemoryProfile {Show 15 fields
pub task_id: u64,
pub tokio_task_id: Option<u64>,
pub task_name: String,
pub task_type: TaskType,
pub created_at_ms: u64,
pub completed_at_ms: Option<u64>,
pub total_bytes: u64,
pub current_memory: u64,
pub peak_memory: u64,
pub total_allocations: u64,
pub total_deallocations: u64,
pub duration_ns: u64,
pub allocation_rate: f64,
pub efficiency_score: f64,
pub average_allocation_size: f64,
}Expand description
Memory usage profile for a single task
Fields§
§task_id: u64Unique task identifier (auto-generated, never reused)
tokio_task_id: Option<u64>Tokio task ID (if running in tokio context)
task_name: StringTask name for identification
task_type: TaskTypeTask type classification
created_at_ms: u64Task creation timestamp (milliseconds since Unix epoch)
completed_at_ms: Option<u64>Task completion timestamp (milliseconds since Unix epoch, if completed)
total_bytes: u64Total bytes allocated by this task
current_memory: u64Current memory usage (allocated - deallocated)
peak_memory: u64Peak memory usage observed
total_allocations: u64Number of allocation operations
total_deallocations: u64Number of deallocation operations
duration_ns: u64Task duration in nanoseconds
allocation_rate: f64Memory allocation rate (bytes/second)
efficiency_score: f64Memory efficiency score (0.0 to 1.0)
average_allocation_size: f64Average allocation size
Implementations§
Source§impl TaskMemoryProfile
impl TaskMemoryProfile
Sourcepub fn new(task_id: u64, task_name: String, task_type: TaskType) -> Self
pub fn new(task_id: u64, task_name: String, task_type: TaskType) -> Self
Create new task profile
Sourcepub fn with_tokio_id(
task_id: u64,
tokio_task_id: u64,
task_name: String,
task_type: TaskType,
) -> Self
pub fn with_tokio_id( task_id: u64, tokio_task_id: u64, task_name: String, task_type: TaskType, ) -> Self
Create new task profile with tokio task ID
Sourcepub fn mark_completed(&mut self)
pub fn mark_completed(&mut self)
Mark task as completed
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 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
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TaskMemoryProfile
impl Debug for TaskMemoryProfile
Source§impl<'de> Deserialize<'de> for TaskMemoryProfile
impl<'de> Deserialize<'de> for TaskMemoryProfile
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for TaskMemoryProfile
impl RefUnwindSafe for TaskMemoryProfile
impl Send for TaskMemoryProfile
impl Sync for TaskMemoryProfile
impl Unpin for TaskMemoryProfile
impl UnsafeUnpin 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
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>
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>
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