pub struct ResourceMonitor {
pub conflicts: u64,
pub decisions: u64,
pub restarts: u64,
pub theory_checks: u64,
/* private fields */
}Expand description
Tracks resource usage and checks whether limits have been exceeded.
The monitor is created from a ResourceLimits configuration and then
updated as the solver progresses. Call check to
see if any limit has been hit.
Fields§
§conflicts: u64Number of conflicts observed so far
decisions: u64Number of decisions observed so far
restarts: u64Number of restarts observed so far
theory_checks: u64Number of theory checks observed so far
Implementations§
Source§impl ResourceMonitor
impl ResourceMonitor
Sourcepub fn new(limits: ResourceLimits) -> Self
pub fn new(limits: ResourceLimits) -> Self
Create a new monitor with the given limits and reset all counters.
Sourcepub fn record_conflict(&mut self)
pub fn record_conflict(&mut self)
Record one conflict.
Sourcepub fn record_decision(&mut self)
pub fn record_decision(&mut self)
Record one decision.
Sourcepub fn record_restart(&mut self)
pub fn record_restart(&mut self)
Record one restart.
Sourcepub fn record_theory_check(&mut self)
pub fn record_theory_check(&mut self)
Record one theory check.
Sourcepub fn check(&self) -> Option<ResourceExhausted>
pub fn check(&self) -> Option<ResourceExhausted>
Check whether any resource limit has been exceeded.
Returns Some(reason) if a limit was hit, or None if all limits are
still satisfied.
Sourcepub fn check_result(&self) -> Result<(), ResourceExhausted>
pub fn check_result(&self) -> Result<(), ResourceExhausted>
Check limits and return a Result.
Convenience wrapper: returns Ok(()) when no limit is hit, or
Err(ResourceExhausted) when one is.
Sourcepub fn limits(&self) -> &ResourceLimits
pub fn limits(&self) -> &ResourceLimits
Get the configured limits.
Trait Implementations§
Source§impl Clone for ResourceMonitor
impl Clone for ResourceMonitor
Source§fn clone(&self) -> ResourceMonitor
fn clone(&self) -> ResourceMonitor
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ResourceMonitor
impl RefUnwindSafe for ResourceMonitor
impl Send for ResourceMonitor
impl Sync for ResourceMonitor
impl Unpin for ResourceMonitor
impl UnsafeUnpin for ResourceMonitor
impl UnwindSafe for ResourceMonitor
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> 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