pub struct ThreadLocalTracker { /* private fields */ }Expand description
Thread-local memory tracker using lock-free data structures.
This tracker uses SegQueue for events and DashMap for active allocations, ensuring no event loss under high contention.
Implementations§
Source§impl ThreadLocalTracker
impl ThreadLocalTracker
pub fn new(thread_id: ThreadId, output_file: PathBuf, sample_rate: f64) -> Self
pub fn track_allocation(&self, ptr: usize, size: usize, call_stack_hash: u64)
pub fn track_deallocation(&self, ptr: usize, call_stack_hash: u64)
pub fn get_stats(&self) -> MemoryStats
pub fn get_sampling_stats(&self) -> (usize, usize)
pub fn finalize(&self) -> Result<()>
pub fn thread_id(&self) -> ThreadId
pub fn output_file(&self) -> &PathBuf
pub fn event_count(&self) -> usize
pub fn clear_events(&self)
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ThreadLocalTracker
impl !RefUnwindSafe for ThreadLocalTracker
impl Send for ThreadLocalTracker
impl Sync for ThreadLocalTracker
impl Unpin for ThreadLocalTracker
impl UnsafeUnpin for ThreadLocalTracker
impl !UnwindSafe for ThreadLocalTracker
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