pub struct MemorySnapshot {
pub timestamp: u64,
pub stats: MemoryStats,
pub active_allocations: HashMap<usize, ActiveAllocation>,
pub active_bindings: Option<Vec<SnapshotBinding>>,
pub thread_stats: HashMap<u64, ThreadMemoryStats>,
}Expand description
One of several same-named MemorySnapshot types in this crate: this one is the
the canonical point-in-time projection built by the snapshot engine.
Convert at the module boundary instead of passing it across; a global rename is deliberately avoided (see DATA_ACCURACY_DEVELOPMENT_PLAN §14.2). Memory snapshot - a point-in-time view of memory usage
Fields§
§timestamp: u64Timestamp when this snapshot was taken
stats: MemoryStatsOverall memory statistics
active_allocations: HashMap<usize, ActiveAllocation>Compatibility address lookup; returns the newest binding at an address.
active_bindings: Option<Vec<SnapshotBinding>>Lossless identity-bearing projection. None denotes a legacy address-only snapshot.
thread_stats: HashMap<u64, ThreadMemoryStats>Per-thread statistics
Implementations§
Source§impl MemorySnapshot
impl MemorySnapshot
Sourcepub fn from_allocation_infos(allocations: Vec<AllocationInfo>) -> Self
pub fn from_allocation_infos(allocations: Vec<AllocationInfo>) -> Self
Build a MemorySnapshot from a list of AllocationInfo (capture module type)
Sourcepub fn active_count(&self) -> usize
pub fn active_count(&self) -> usize
Get the number of active allocations
Sourcepub fn allocations(&self) -> impl Iterator<Item = &ActiveAllocation>
pub fn allocations(&self) -> impl Iterator<Item = &ActiveAllocation>
Iterate all bindings, including overlapping generations at the same address. Legacy snapshots continue to use their address-only map.
Sourcepub fn current_memory(&self) -> usize
pub fn current_memory(&self) -> usize
Get the current memory usage
Sourcepub fn peak_memory(&self) -> usize
pub fn peak_memory(&self) -> usize
Get the peak memory usage
Trait Implementations§
Source§impl Clone for MemorySnapshot
impl Clone for MemorySnapshot
Source§impl Debug for MemorySnapshot
impl Debug for MemorySnapshot
Source§impl Default for MemorySnapshot
impl Default for MemorySnapshot
Source§impl<'de> Deserialize<'de> for MemorySnapshot
impl<'de> Deserialize<'de> for MemorySnapshot
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 Forget for MemorySnapshot
impl Freeze for MemorySnapshot
impl RefUnwindSafe for MemorySnapshot
impl Send for MemorySnapshot
impl Sync for MemorySnapshot
impl Unpin for MemorySnapshot
impl UnsafeUnpin for MemorySnapshot
impl UnwindSafe for MemorySnapshot
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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