Skip to main content

Module tracker

Module tracker 

Source
Expand description

Unified Tracker API - Simple, unified interface for memory tracking Unified Tracker API - Enhanced Version

This module provides a simple, unified interface for memory tracking with all the power of the old API and more.

§Features

  • Simple API: tracker!() and track!() macros
  • Auto-capture: Automatic variable name and type capture
  • System Monitoring: CPU, memory monitoring (background thread, zero overhead)
  • Per-thread Tracking: Independent tracking per thread
  • Sampling: Configurable sampling rates
  • Hotspot Analysis: Automatic allocation hotspot detection
  • HTML Dashboard: Interactive visualization
  • JSON/Binary Export: Multiple export formats

§Architecture

System monitoring runs in a background thread that collects metrics every 100ms. The track! macro only reads atomic values (nanosecond overhead), ensuring no blocking on data collection.

§Usage

use memscope_rs::{tracker, track};

// Simple usage - system monitoring is automatic
let tracker = tracker!();
let my_vec = vec![1, 2, 3];
track!(tracker, my_vec);
// Analyze the tracked allocations
let report = tracker.analyze();

// Advanced usage with custom sampling
use memscope_rs::tracker::SamplingConfig;
let tracker = tracker!().with_sampling(SamplingConfig::high_performance());

Structs§

AllocationHotspot
AnalysisReport
SamplingConfig
SystemSnapshot
Tracker