pub struct AsyncTracker { /* private fields */ }Expand description
Async memory tracker for task-aware memory tracking.
Implementations§
Source§impl AsyncTracker
impl AsyncTracker
pub fn new() -> Self
pub fn set_current_task(task_id: u64)
pub fn clear_current_task()
pub fn get_current_task() -> Option<u64>
Sourcepub fn enter_task(task_id: u64) -> TaskGuard
pub fn enter_task(task_id: u64) -> TaskGuard
Enter a task context with automatic cleanup. Returns a TaskGuard that will clear the task ID when dropped.
Sourcepub fn with_task<F, T>(task_id: u64, f: F) -> Twhere
F: FnOnce() -> T,
pub fn with_task<F, T>(task_id: u64, f: F) -> Twhere
F: FnOnce() -> T,
Execute a closure within a task context with automatic cleanup. The task ID is automatically cleared after the closure completes, even if the closure panics.
pub fn track_task_start( &self, task_id: u64, name: String, _thread_id: ThreadId, ) -> Result<(), AsyncError>
Sourcepub fn track_task_end(&self, task_id: u64) -> Result<(), AsyncError>
pub fn track_task_end(&self, task_id: u64) -> Result<(), AsyncError>
Track a task end.
pub fn track_allocation_auto( &self, ptr: usize, size: usize, var_name: Option<String>, type_name: Option<String>, )
Sourcepub fn track_allocation(&self, ptr: usize, size: usize, task_id: u64)
pub fn track_allocation(&self, ptr: usize, size: usize, task_id: u64)
Track an allocation associated with a task.
Sourcepub fn track_allocation_with_location(
&self,
ptr: usize,
size: usize,
task_id: u64,
var_name: Option<String>,
type_name: Option<String>,
source_location: Option<SourceLocation>,
)
pub fn track_allocation_with_location( &self, ptr: usize, size: usize, task_id: u64, var_name: Option<String>, type_name: Option<String>, source_location: Option<SourceLocation>, )
Track an allocation with source location.
Sourcepub fn track_deallocation(&self, ptr: usize)
pub fn track_deallocation(&self, ptr: usize)
Track a deallocation associated with a task.
Sourcepub fn get_stats(&self) -> AsyncStats
pub fn get_stats(&self) -> AsyncStats
Get current statistics.
Sourcepub fn snapshot(&self) -> AsyncSnapshot
pub fn snapshot(&self) -> AsyncSnapshot
Take a snapshot of current state.
Sourcepub fn get_task_profile(&self, task_id: u64) -> Option<TaskMemoryProfile>
pub fn get_task_profile(&self, task_id: u64) -> Option<TaskMemoryProfile>
Get task memory profile
Sourcepub fn get_all_profiles(&self) -> Vec<TaskMemoryProfile>
pub fn get_all_profiles(&self) -> Vec<TaskMemoryProfile>
Get all task profiles
Sourcepub fn is_initialized(&self) -> bool
pub fn is_initialized(&self) -> bool
Check if tracker is initialized
Sourcepub fn set_initialized(&self)
pub fn set_initialized(&self)
Mark tracker as initialized
Sourcepub fn analyze_task(
&self,
task_id: u64,
task_type: TaskType,
) -> Option<TaskReport>
pub fn analyze_task( &self, task_id: u64, task_type: TaskType, ) -> Option<TaskReport>
Generate task efficiency report
Sourcepub fn get_resource_rankings(&self) -> Vec<ResourceRanking>
pub fn get_resource_rankings(&self) -> Vec<ResourceRanking>
Get resource rankings for all tasks
Trait Implementations§
Source§impl Default for AsyncTracker
impl Default for AsyncTracker
Auto Trait Implementations§
impl Freeze for AsyncTracker
impl RefUnwindSafe for AsyncTracker
impl Send for AsyncTracker
impl Sync for AsyncTracker
impl Unpin for AsyncTracker
impl UnsafeUnpin for AsyncTracker
impl UnwindSafe for AsyncTracker
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> 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