pub struct MemoryEvent {
pub timestamp: u64,
pub event_type: MemoryEventType,
pub ptr: usize,
pub size: usize,
pub old_size: Option<usize>,
pub thread_id: u64,
pub var_name: Option<String>,
pub type_name: Option<String>,
pub call_stack_hash: Option<u64>,
pub thread_name: Option<String>,
pub source_file: Option<String>,
pub source_line: Option<u32>,
}Expand description
Unified memory event type
This structure captures all essential information about memory operations across all tracking backends (core, lockfree, async, unified).
Fields§
§timestamp: u64Event timestamp (nanoseconds since epoch)
event_type: MemoryEventTypeEvent type
ptr: usizeMemory pointer address
size: usizeAllocation size in bytes
old_size: Option<usize>Previous allocation size (for Reallocate events)
thread_id: u64Thread identifier
var_name: Option<String>Optional variable name
type_name: Option<String>Optional type name
call_stack_hash: Option<u64>Optional call stack hash
thread_name: Option<String>Optional thread name
source_file: Option<String>Optional source file path
source_line: Option<u32>Optional source line number
Implementations§
Source§impl MemoryEvent
impl MemoryEvent
Sourcepub fn deallocate(ptr: usize, size: usize, thread_id: u64) -> Self
pub fn deallocate(ptr: usize, size: usize, thread_id: u64) -> Self
Create a new deallocation event
Sourcepub fn reallocate(
ptr: usize,
old_size: usize,
new_size: usize,
thread_id: u64,
) -> Self
pub fn reallocate( ptr: usize, old_size: usize, new_size: usize, thread_id: u64, ) -> Self
Create a new reallocation event
Sourcepub fn metadata(
var_name: String,
type_name: String,
thread_id: u64,
size: usize,
) -> Self
pub fn metadata( var_name: String, type_name: String, thread_id: u64, size: usize, ) -> Self
Create a new metadata event for Container/Value types (no heap allocation)
Sourcepub fn now() -> u64
pub fn now() -> u64
Get current timestamp in nanoseconds Returns 0 if system time is before Unix epoch (should not happen in practice)
Sourcepub fn with_var_name(self, name: String) -> Self
pub fn with_var_name(self, name: String) -> Self
Set variable name
Sourcepub fn with_type_name(self, name: String) -> Self
pub fn with_type_name(self, name: String) -> Self
Set type name
Sourcepub fn with_source_file(self, file: String) -> Self
pub fn with_source_file(self, file: String) -> Self
Set source file path
Sourcepub fn with_source_line(self, line: u32) -> Self
pub fn with_source_line(self, line: u32) -> Self
Set source line number
Sourcepub fn with_call_stack_hash(self, hash: u64) -> Self
pub fn with_call_stack_hash(self, hash: u64) -> Self
Set call stack hash
Sourcepub fn with_thread_name(self, name: String) -> Self
pub fn with_thread_name(self, name: String) -> Self
Set thread name
Sourcepub fn is_allocation(&self) -> bool
pub fn is_allocation(&self) -> bool
Check if this is an allocation event
Sourcepub fn is_deallocation(&self) -> bool
pub fn is_deallocation(&self) -> bool
Check if this is a deallocation event
Trait Implementations§
Source§impl Clone for MemoryEvent
impl Clone for MemoryEvent
Source§fn clone(&self) -> MemoryEvent
fn clone(&self) -> MemoryEvent
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MemoryEvent
impl Debug for MemoryEvent
Source§impl<'de> Deserialize<'de> for MemoryEvent
impl<'de> Deserialize<'de> for MemoryEvent
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 MemoryEvent
impl RefUnwindSafe for MemoryEvent
impl Send for MemoryEvent
impl Sync for MemoryEvent
impl Unpin for MemoryEvent
impl UnsafeUnpin for MemoryEvent
impl UnwindSafe for MemoryEvent
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