pub struct Analyzer { /* private fields */ }Expand description
Unified analysis entry point.
Provides access to all analysis modules through a single interface. Uses lazy initialization for expensive operations.
Implementations§
Source§impl Analyzer
impl Analyzer
Sourcepub fn from_tracker(tracker: &GlobalTracker) -> Self
pub fn from_tracker(tracker: &GlobalTracker) -> Self
Create analyzer from GlobalTracker.
Sourcepub fn from_view(view: MemoryView) -> Self
pub fn from_view(view: MemoryView) -> Self
Create analyzer from view.
Sourcepub fn graph(&mut self) -> &mut GraphAnalysis
pub fn graph(&mut self) -> &mut GraphAnalysis
Get graph analysis (lazy).
Sourcepub fn detect(&mut self) -> &DetectionAnalysis
pub fn detect(&mut self) -> &DetectionAnalysis
Get detection analysis (lazy).
Sourcepub fn metrics(&mut self) -> &MetricsAnalysis
pub fn metrics(&mut self) -> &MetricsAnalysis
Get metrics analysis (lazy).
Sourcepub fn timeline(&mut self) -> &TimelineAnalysis
pub fn timeline(&mut self) -> &TimelineAnalysis
Get timeline analysis (lazy).
Sourcepub fn export(&self) -> ExportEngine<'_>
pub fn export(&self) -> ExportEngine<'_>
Get export engine.
Sourcepub fn view(&self) -> &MemoryView
pub fn view(&self) -> &MemoryView
Get underlying view.
Sourcepub fn analyze(&mut self) -> AnalysisReport
pub fn analyze(&mut self) -> AnalysisReport
Run full analysis on the memory data.
This method performs a comprehensive analysis of all tracked memory allocations and returns a complete report.
§Analysis Pipeline
The analysis is performed in the following order:
-
Statistics Collection (O(1))
- Total allocation count
- Total bytes allocated
- Peak memory usage
- Thread count
-
Leak Detection (O(n))
- Identifies allocations that were never deallocated
- Reports leaked bytes and allocation details
-
Cycle Detection (O(V + E))
- Uses DFS-based algorithm to detect reference cycles
- Groups allocations by type for potential cycle identification
-
Metrics Summary (O(n))
- Aggregates allocation statistics by type
- Reports top allocations by size
§Performance Characteristics
- Time Complexity: O(n + V + E) where n is the number of allocations, V is the number of unique pointers, and E is the number of edges
- Space Complexity: O(n) for storing analysis results
- Memory Overhead: Minimal, results are computed on-demand
§Example
ⓘ
let mut analyzer = analyzer(&tracker)?;
let report = analyzer.analyze();
println!("Allocations: {}", report.stats.allocation_count);
println!("Leaks: {}", report.leaks.leak_count);
println!("Cycles: {}", report.cycles.cycle_count);§Returns
An AnalysisReport containing:
stats: Basic memory statisticsleaks: Memory leak detection resultscycles: Reference cycle detection resultsmetrics: Aggregated metrics summary
Sourcepub fn quick_leak_check(&mut self) -> LeakReport
pub fn quick_leak_check(&mut self) -> LeakReport
Quick leak check.
Sourcepub fn quick_cycle_check(&mut self) -> CycleReport
pub fn quick_cycle_check(&mut self) -> CycleReport
Quick cycle check.
Sourcepub fn quick_metrics(&mut self) -> MetricsReport
pub fn quick_metrics(&mut self) -> MetricsReport
Quick metrics.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Analyzer
impl RefUnwindSafe for Analyzer
impl Send for Analyzer
impl Sync for Analyzer
impl Unpin for Analyzer
impl UnsafeUnpin for Analyzer
impl UnwindSafe for Analyzer
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> 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>
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