pub struct Meter(/* private fields */);
Expand description
A wrapper around original self_meter::Meter
that locks internal
mutex on most operations and maybe used in multiple threads safely.
Implementations§
Source§impl Meter
impl Meter
Sourcepub fn spawn_scanner(&self, handle: &Handle)
pub fn spawn_scanner(&self, handle: &Handle)
Adds a scanner coroutine to tokio main loop
This must be called once per process (not per thread or tokio loop)
Sourcepub fn process_report(&self) -> ProcessReport<'_>
pub fn process_report(&self) -> ProcessReport<'_>
Get serializable report for process data
This is a part of report()
/ Report
, and is needed for fine-grained
serialization control.
Sourcepub fn thread_report(&self) -> ThreadReport<'_>
pub fn thread_report(&self) -> ThreadReport<'_>
Get serializable report for thread data
This is a part of report()
/ Report
, and is needed for fine-grained
serialization control.
Sourcepub fn respond<S>(&self, e: Encoder<S>) -> EncoderDone<S>
pub fn respond<S>(&self, e: Encoder<S>) -> EncoderDone<S>
Same as serialize
but also adds required HTTP headers
Sourcepub fn track_thread(&self, tid: Pid, name: &str)
pub fn track_thread(&self, tid: Pid, name: &str)
Start tracking specified thread
Note: you must add main thread here manually. Usually you
should use track_current_thread()
instead.
Sourcepub fn untrack_thread(&self, tid: Pid)
pub fn untrack_thread(&self, tid: Pid)
Stop tracking specified thread (for example if it’s dead)
Sourcepub fn track_current_thread(&self, name: &str) -> Pid
pub fn track_current_thread(&self, name: &str) -> Pid
Add current thread using track_thread
, returns thread id
Sourcepub fn track_current_thread_by_name(&self)
pub fn track_current_thread_by_name(&self)
Track current thread by using name from std::thread::current().name()
This may not work if thread has no name, use track_current_thread
if thread has no own name or if you’re unsure.
§Panics
If no thread is set.
Sourcepub fn untrack_current_thread(&self)
pub fn untrack_current_thread(&self)
Remove current thread using untrack_thread