Struct MemoryPressureMonitor
pub struct MemoryPressureMonitor {
budgets: HashMap<ActorId, MemoryBudget>,
total_gpu_memory: u64,
total_allocated: u64,
default_budget: MemoryBudget,
}Expand description
Global memory pressure monitor for all actors.
Fields§
§budgets: HashMap<ActorId, MemoryBudget>§total_gpu_memory: u64§total_allocated: u64§default_budget: MemoryBudgetImplementations§
§impl MemoryPressureMonitor
impl MemoryPressureMonitor
pub fn new(total_gpu_memory: u64) -> MemoryPressureMonitor
pub fn new(total_gpu_memory: u64) -> MemoryPressureMonitor
Create a monitor for a GPU with the given total memory.
pub 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.
pub 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.
pub fn record_dealloc(&mut self, actor: ActorId, bytes: u64)
pub fn record_dealloc(&mut self, actor: ActorId, bytes: u64)
Record a deallocation.
pub fn global_pressure(&self) -> PressureLevel
pub fn global_pressure(&self) -> PressureLevel
Get the global pressure level across all actors.
pub 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.
pub fn actors_by_usage(&self) -> Vec<(ActorId, u64)>
pub fn actors_by_usage(&self) -> Vec<(ActorId, u64)>
Get actors sorted by memory usage (descending).
pub fn get_budget(&self, actor: ActorId) -> Option<&MemoryBudget>
pub fn get_budget(&self, actor: ActorId) -> Option<&MemoryBudget>
Get an actor’s budget.
pub fn total_allocated(&self) -> u64
pub fn total_allocated(&self) -> u64
Get total allocated across all actors.
pub 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 UnwindSafe for MemoryPressureMonitor
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
§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
§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>
Deserializes using the given deserializer
§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>
Converts
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>
Converts
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§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
§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.