pub struct Options {
    pub first_checkpoint: u64,
    pub max_checkpoint_size: Option<u64>,
    pub delay: u64,
    pub max_scale_factor: f64,
    pub run_for: Option<Duration>,
}
Expand description

Optional parameters for creating a new progress observer.

Fields§

§first_checkpoint: u64

Number of ticks before sending the first report.

The default value of 1 is sometimes quite small, and in combination with the default max_scale_factor of 2, it can take several dozen iterations before the typical checkpoint size settles to an appropriate value. These unnecessary extra rapid prints can cause the beginning of your observed timeframe to be crowded with the expensive syscalls and calculations that might be associated with your operation. Setting this value to an approximate estimate of the number of iterations you expect to pass within the time frame specified by your frequency target will prevent this frontloading of printouts.

§max_checkpoint_size: Option<u64>

Specify a maximum number of ticks to wait for in between observations.

In some instances, such as during particularly chaotic computations, the observer could erroneously derive an exceedingly large size for the next potential checkpoint. In those situations, you might want to specify a maximum number of ticks between progress reports, so that the observer doesn’t get stuck waiting indefinitely after a bad next checkpoint estimate.

§delay: u64

Delay observations for this many initial ticks.

Sometimes your computation needs time to “warm up”, where the first 1 or 2 iterations may take significantly longer to process than all subsequent ones. This may throw off the checkpoint estimation. Specify this argument to ignore the first n ticks processed, only beginning to record progress after they have elapsed.

§max_scale_factor: f64

Maximum factor that subsequent checkpoints are allowed to increase in size by.

Intended to prevent sudden large jumps in checkpoint size between reports. The default value of 2 is generally fine for most cases. Panics if the factor is set less than 1.

§run_for: Option<Duration>

Specify a maximum duration to run the observer for.

After the duration has passed, the observer will return None from Iterator::next. Setting this value has no effect if using Observer::tick directly.

Trait Implementations§

source§

impl Default for Options

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.