Struct GpuMemoryDashboard
pub struct GpuMemoryDashboard {
allocations: RwLock<RawRwLock, HashMap<u64, GpuMemoryAllocation>>,
device_stats: RwLock<RawRwLock, HashMap<u32, GpuDeviceMemoryStats>>,
thresholds: GpuMemoryThresholds,
allocation_counter: AtomicU64,
total_allocated: AtomicU64,
peak_allocated: AtomicU64,
}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();Fields§
§allocations: RwLock<RawRwLock, HashMap<u64, GpuMemoryAllocation>>§device_stats: RwLock<RawRwLock, HashMap<u32, GpuDeviceMemoryStats>>§thresholds: GpuMemoryThresholds§allocation_counter: AtomicU64§total_allocated: AtomicU64§peak_allocated: AtomicU64Implementations§
§impl GpuMemoryDashboard
impl GpuMemoryDashboard
pub fn new() -> Arc<GpuMemoryDashboard>
pub fn new() -> Arc<GpuMemoryDashboard>
Create a new GPU memory dashboard.
pub fn with_thresholds(
thresholds: GpuMemoryThresholds,
) -> Arc<GpuMemoryDashboard>
pub fn with_thresholds( thresholds: GpuMemoryThresholds, ) -> Arc<GpuMemoryDashboard>
Create with custom thresholds.
pub 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.
pub fn next_allocation_id(&self) -> u64
pub fn next_allocation_id(&self) -> u64
Generate a new unique allocation ID.
pub fn track_deallocation(&self, id: u64)
pub fn track_deallocation(&self, id: u64)
Track deallocation.
pub fn mark_unused(&self, id: u64)
pub fn mark_unused(&self, id: u64)
Mark an allocation as no longer in use (but not freed).
pub 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.
pub 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.
pub fn get_device_stats(
&self,
device_index: u32,
) -> Option<GpuDeviceMemoryStats>
pub fn get_device_stats( &self, device_index: u32, ) -> Option<GpuDeviceMemoryStats>
Get device statistics.
pub fn get_all_device_stats(&self) -> Vec<GpuDeviceMemoryStats>
pub fn get_all_device_stats(&self) -> Vec<GpuDeviceMemoryStats>
Get all device statistics.
pub fn get_allocations(&self) -> Vec<GpuMemoryAllocation>
pub fn get_allocations(&self) -> Vec<GpuMemoryAllocation>
Get all active allocations.
pub 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.
pub fn total_allocated(&self) -> u64
pub fn total_allocated(&self) -> u64
Get total allocated memory.
pub fn peak_allocated(&self) -> u64
pub fn peak_allocated(&self) -> u64
Get peak allocated memory.
pub fn allocation_count(&self) -> usize
pub fn allocation_count(&self) -> usize
Get allocation count.
pub fn check_pressure(&self, device_index: u32) -> MemoryPressureLevel
pub fn check_pressure(&self, device_index: u32) -> MemoryPressureLevel
Check memory pressure level for a device.
pub fn grafana_panel(&self) -> GrafanaPanel
pub fn grafana_panel(&self) -> GrafanaPanel
Generate Grafana dashboard panel for GPU memory.
pub fn prometheus_metrics(&self) -> String
pub fn prometheus_metrics(&self) -> String
Generate Prometheus metrics for GPU memory.
pub fn summary_report(&self) -> String
pub fn summary_report(&self) -> String
Generate a memory summary report.
Trait Implementations§
§impl Default for GpuMemoryDashboard
impl Default for GpuMemoryDashboard
§fn default() -> GpuMemoryDashboard
fn default() -> GpuMemoryDashboard
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§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
§fn deserialize(
&self,
deserializer: &mut D,
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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