Struct self_meter_http::Meter
[−]
[src]
pub struct Meter(_);
A wrapper around original self_meter::Meter
that locks internal
mutex on most operations and maybe used in multiple threads safely.
Methods
impl Meter
[src]
fn new() -> Meter
Create a new meter with specified scan iterval of one second
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)
fn serialize<W: Write>(&self, buf: W)
Serialize response into JSON
fn report(&self) -> Report
Get serializable report
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.
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.
fn respond<S>(&self, e: Encoder<S>) -> EncoderDone<S>
Same as serialize
but also adds required HTTP headers
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.
fn untrack_thread(&self, tid: Pid)
Stop tracking specified thread (for example if it's dead)
fn track_current_thread(&self, name: &str) -> Pid
Add current thread using track_thread
, returns thread id
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.
fn untrack_current_thread(&self)
Remove current thread using untrack_thread
Trait Implementations
impl Clone for Meter
[src]
fn clone(&self) -> Meter
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more