pub struct LatencySampler {
inner: EventCounter,
display_name: String,
}Expand description
A Counter that records one latency sample per event (e.g. one per GC pause, for things
like time-to-yield or pause time) and reports it as p50/p9999 columns instead of a raw
per-phase total.
This is a thin wrapper around an EventCounter: it reuses the inner counter’s
start/stop/phase_change machinery unchanged to accumulate one sample per pause into the
per-phase array. It only overrides how the counter is
named and printed, bending two parts of the Counter contract to do so:
Counter::merge_phasesalways returnstrue.Counter::namereturns a compound, tab-separated pair of column names (e.g."pause-time.p50\tpause-time.p9999"), so the singleprint!("{}\t", c.name())call site incrate::util::statistics::stats::Stats::print_column_namesprints both headers.Counter::print_totalprints"{p50}\t{p9999}"(two tab-separated values, ignoring theotherargument), so the singlec.print_total(None)call site incrate::util::statistics::stats::Stats::print_statsprints both values.
This trick only works because Counter::name() has a single caller (Stats’s own printing
code) anywhere in the codebase; if that changes, this would need revisiting.
Fields§
§inner: EventCounter§display_name: StringA compound "{name}.p50\t{name}.p9999" string, returned by name().
Implementations§
Trait Implementations§
Source§impl Counter for LatencySampler
impl Counter for LatencySampler
Source§fn phase_change(&mut self, old_phase: usize)
fn phase_change(&mut self, old_phase: usize)
Signal a change in GC phase. Read more
Source§fn print_count(&self, phase: usize)
fn print_count(&self, phase: usize)
Print the counter value for a particular phase Read more
Source§fn get_total(&self, other: Option<bool>) -> u64
fn get_total(&self, other: Option<bool>) -> u64
Get the total count over past phases Read more
Source§fn print_last(&self)
fn print_last(&self)
Print the count of the last phases
Source§fn merge_phases(&self) -> bool
fn merge_phases(&self) -> bool
Whether the counter merges other and stw phases.
Source§fn implicitly_start(&self) -> bool
fn implicitly_start(&self) -> bool
Whether the counter starts implicitly after creation Read more
Auto Trait Implementations§
impl Freeze for LatencySampler
impl RefUnwindSafe for LatencySampler
impl Send for LatencySampler
impl Sync for LatencySampler
impl Unpin for LatencySampler
impl UnwindSafe for LatencySampler
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
Mutably borrows from an owned value. Read more
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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