pub struct MemoryPressureMonitor { /* private fields */ }Expand description
Global memory pressure monitor for all actors.
Implementations§
Source§impl MemoryPressureMonitor
impl MemoryPressureMonitor
Sourcepub fn new(total_gpu_memory: u64) -> Self
pub fn new(total_gpu_memory: u64) -> Self
Create a monitor for a GPU with the given total memory.
Sourcepub fn set_budget(&mut self, actor: ActorId, budget: MemoryBudget)
pub fn set_budget(&mut self, actor: ActorId, budget: MemoryBudget)
Set a budget for a specific actor.
Sourcepub fn request_alloc(&mut self, actor: ActorId, bytes: u64) -> AllocationResult
pub fn request_alloc(&mut self, actor: ActorId, bytes: u64) -> AllocationResult
Request allocation from an actor’s budget.
Sourcepub fn record_dealloc(&mut self, actor: ActorId, bytes: u64)
pub fn record_dealloc(&mut self, actor: ActorId, bytes: u64)
Record a deallocation.
Sourcepub fn global_pressure(&self) -> PressureLevel
pub fn global_pressure(&self) -> PressureLevel
Get the global pressure level across all actors.
Sourcepub fn actors_over_budget(&self) -> Vec<(ActorId, f64)>
pub fn actors_over_budget(&self) -> Vec<(ActorId, f64)>
Get actors that are above their soft limit.
Sourcepub fn actors_by_usage(&self) -> Vec<(ActorId, u64)>
pub fn actors_by_usage(&self) -> Vec<(ActorId, u64)>
Get actors sorted by memory usage (descending).
Sourcepub fn get_budget(&self, actor: ActorId) -> Option<&MemoryBudget>
pub fn get_budget(&self, actor: ActorId) -> Option<&MemoryBudget>
Get an actor’s budget.
Sourcepub fn total_allocated(&self) -> u64
pub fn total_allocated(&self) -> u64
Get total allocated across all actors.
Sourcepub fn total_gpu_memory(&self) -> u64
pub fn total_gpu_memory(&self) -> u64
Get total GPU memory.
Auto Trait Implementations§
impl Freeze for MemoryPressureMonitor
impl RefUnwindSafe for MemoryPressureMonitor
impl Send for MemoryPressureMonitor
impl Sync for MemoryPressureMonitor
impl Unpin for MemoryPressureMonitor
impl UnsafeUnpin for MemoryPressureMonitor
impl UnwindSafe for MemoryPressureMonitor
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.