pub struct GpuMemoryDashboard { /* private fields */ }Expand description
GPU Memory Dashboard for monitoring and visualization.
Provides real-time GPU memory tracking with allocation history, per-kernel usage, and memory pressure alerts.
§Example
ⓘ
use ringkernel_core::observability::GpuMemoryDashboard;
let dashboard = GpuMemoryDashboard::new();
// Track an allocation
dashboard.track_allocation(
1,
"input_queue",
65536,
GpuMemoryType::QueueBuffer,
0,
Some("processor_kernel"),
);
// Get current stats
let stats = dashboard.get_device_stats(0);
println!("GPU 0 utilization: {:.1}%", stats.utilization());
// Generate Grafana panel JSON
let panel = dashboard.grafana_panel();Implementations§
Source§impl GpuMemoryDashboard
impl GpuMemoryDashboard
Sourcepub fn with_thresholds(thresholds: GpuMemoryThresholds) -> Arc<Self>
pub fn with_thresholds(thresholds: GpuMemoryThresholds) -> Arc<Self>
Create with custom thresholds.
Sourcepub fn track_allocation(
&self,
id: u64,
name: impl Into<String>,
size: usize,
memory_type: GpuMemoryType,
device_index: u32,
kernel_id: Option<&str>,
)
pub fn track_allocation( &self, id: u64, name: impl Into<String>, size: usize, memory_type: GpuMemoryType, device_index: u32, kernel_id: Option<&str>, )
Track a new GPU memory allocation.
Sourcepub fn next_allocation_id(&self) -> u64
pub fn next_allocation_id(&self) -> u64
Generate a new unique allocation ID.
Sourcepub fn track_deallocation(&self, id: u64)
pub fn track_deallocation(&self, id: u64)
Track deallocation.
Sourcepub fn mark_unused(&self, id: u64)
pub fn mark_unused(&self, id: u64)
Mark an allocation as no longer in use (but not freed).
Sourcepub fn register_device(
&self,
device_index: u32,
name: impl Into<String>,
total_memory: u64,
)
pub fn register_device( &self, device_index: u32, name: impl Into<String>, total_memory: u64, )
Register a GPU device.
Sourcepub fn update_device_stats(
&self,
device_index: u32,
free_memory: u64,
ringkernel_used: u64,
)
pub fn update_device_stats( &self, device_index: u32, free_memory: u64, ringkernel_used: u64, )
Update device memory statistics.
Sourcepub fn get_device_stats(
&self,
device_index: u32,
) -> Option<GpuDeviceMemoryStats>
pub fn get_device_stats( &self, device_index: u32, ) -> Option<GpuDeviceMemoryStats>
Get device statistics.
Sourcepub fn get_all_device_stats(&self) -> Vec<GpuDeviceMemoryStats>
pub fn get_all_device_stats(&self) -> Vec<GpuDeviceMemoryStats>
Get all device statistics.
Sourcepub fn get_allocations(&self) -> Vec<GpuMemoryAllocation>
pub fn get_allocations(&self) -> Vec<GpuMemoryAllocation>
Get all active allocations.
Sourcepub fn get_kernel_allocations(
&self,
kernel_id: &str,
) -> Vec<GpuMemoryAllocation>
pub fn get_kernel_allocations( &self, kernel_id: &str, ) -> Vec<GpuMemoryAllocation>
Get allocations for a specific kernel.
Sourcepub fn total_allocated(&self) -> u64
pub fn total_allocated(&self) -> u64
Get total allocated memory.
Sourcepub fn peak_allocated(&self) -> u64
pub fn peak_allocated(&self) -> u64
Get peak allocated memory.
Sourcepub fn allocation_count(&self) -> usize
pub fn allocation_count(&self) -> usize
Get allocation count.
Sourcepub fn check_pressure(&self, device_index: u32) -> MemoryPressureLevel
pub fn check_pressure(&self, device_index: u32) -> MemoryPressureLevel
Check memory pressure level for a device.
Sourcepub fn grafana_panel(&self) -> GrafanaPanel
pub fn grafana_panel(&self) -> GrafanaPanel
Generate Grafana dashboard panel for GPU memory.
Sourcepub fn prometheus_metrics(&self) -> String
pub fn prometheus_metrics(&self) -> String
Generate Prometheus metrics for GPU memory.
Sourcepub fn summary_report(&self) -> String
pub fn summary_report(&self) -> String
Generate a memory summary report.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for GpuMemoryDashboard
impl !RefUnwindSafe for GpuMemoryDashboard
impl Send for GpuMemoryDashboard
impl Sync for GpuMemoryDashboard
impl Unpin for GpuMemoryDashboard
impl UnwindSafe for GpuMemoryDashboard
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
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> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Gets the layout of the type.