use anyhow::{Result, bail};
#[derive(Debug, Clone, Copy)]
pub enum HeapDetailLevel {
Summary,
AllocationSites,
Full,
}
#[derive(Debug, Clone)]
pub struct HeapInspectionRequest {
pub pid: u32,
pub detail_level: HeapDetailLevel,
}
#[derive(Debug, Clone, Default)]
pub struct HeapSnapshotSummary {
pub inspected_pid: u32,
pub total_heap_mib: f64,
pub allocation_count: u64,
pub timestamp_unix_sec: u64,
}
pub trait HeapInspectorBackend {
fn is_supported(&self) -> bool;
fn inspect_heap(&self, request: &HeapInspectionRequest) -> Result<HeapSnapshotSummary>;
}
#[derive(Default)]
pub struct StubHeapInspector;
impl HeapInspectorBackend for StubHeapInspector {
fn is_supported(&self) -> bool {
false
}
fn inspect_heap(&self, request: &HeapInspectionRequest) -> Result<HeapSnapshotSummary> {
let _ = request;
bail!("Heap-Inspection ist vorbereitet, aber noch nicht implementiert")
}
}