pub struct Tower {
state: Mutex<State>,
}Expand description
The process-wide sampler. Its state is the previous sample (for CPU rates) and sticky membership.
Fields§
§state: Mutex<State>Implementations§
Source§impl Tower
impl Tower
pub fn new() -> Self
pub fn global() -> &'static Tower
Sourcepub fn live_pids_since(&self, since: Instant) -> Option<HashSet<u32>>
pub fn live_pids_since(&self, since: Instant) -> Option<HashSet<u32>>
The PIDs in the process table of the last sample, if that sample’s read
began at or after since: what is missing from it had exited by then.
None for an older sample (one reused within REUSE_WITHIN, the last
good one before a failed read, or one whose read was already under way),
which can’t speak for a process that started after it.
Sourcepub fn sample(
&self,
want_host: bool,
hostname: &str,
inputs: impl FnOnce() -> Inputs,
labels: impl Fn(&str) -> Option<BlockLabel>,
renderer: impl Fn(u32) -> Option<String>,
) -> Result<TowerSnapshot>
pub fn sample( &self, want_host: bool, hostname: &str, inputs: impl FnOnce() -> Inputs, labels: impl Fn(&str) -> Option<BlockLabel>, renderer: impl Fn(u32) -> Option<String>, ) -> Result<TowerSnapshot>
A sample (module doc). BLOCKING: reads the process table, and labels
and renderer may read the store; call it off the async workers.
renderer says what a renderer PID serves (“window Main”), for the
AgentMux task’s rows (tower_agentmux::renderer_serves).
Sourcefn sample_from(
&self,
snapshot: impl FnOnce() -> Result<Vec<ProcInfo>>,
want_host: bool,
hostname: &str,
inputs: impl FnOnce() -> Inputs,
labels: impl Fn(&str) -> Option<BlockLabel>,
renderer: impl Fn(u32) -> Option<String>,
) -> Result<TowerSnapshot>
fn sample_from( &self, snapshot: impl FnOnce() -> Result<Vec<ProcInfo>>, want_host: bool, hostname: &str, inputs: impl FnOnce() -> Inputs, labels: impl Fn(&str) -> Option<BlockLabel>, renderer: impl Fn(u32) -> Option<String>, ) -> Result<TowerSnapshot>
sample with the process table read by snapshot.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Tower
impl RefUnwindSafe for Tower
impl Send for Tower
impl Sync for Tower
impl Unpin for Tower
impl UnsafeUnpin for Tower
impl UnwindSafe for Tower
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>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<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>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> 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)
Convert
&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)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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> NoneValue for Twhere
T: Default,
impl<T> NoneValue for Twhere
T: Default,
type NoneType = T
§fn null_value() -> T
fn null_value() -> T
The none-equivalent value.
§impl<T> NoneValue for Twhere
T: Default,
impl<T> NoneValue for Twhere
T: Default,
type NoneType = T
§fn null_value() -> T
fn null_value() -> T
The none-equivalent value.