Struct cpu_time::ThreadTime [−][src]
pub struct ThreadTime(_, _);
CPU Time Used by The Current Thread
This is an opaque type similar to std::time::Instant.
Use elapsed() or duration_since() to get meaningful time deltas.
This type is non-thread-shareable (!Sync, !Send) because otherwise it's
to easy to mess up times from different threads. However, you can freely
send Duration's returned by elapsed() and duration_since().
Methods
impl ThreadTime[src]
impl ThreadTimepub fn now() -> ThreadTime[src]
pub fn now() -> ThreadTimeGet current CPU time used by a process process
Panics
This method panics if linux kernel doesn't support CLOCK_THREAD_CPUTIME_ID, which works since linux 2.6.12 (~ year 2005).
pub fn elapsed(&self) -> Duration[src]
pub fn elapsed(&self) -> DurationReturns the amount of CPU time used by the current thread from the previous timestamp to now.
pub fn duration_since(&self, timestamp: ThreadTime) -> Duration[src]
pub fn duration_since(&self, timestamp: ThreadTime) -> DurationReturns the amount of CPU time used by the current thread from the previous timestamp.
Trait Implementations
impl Copy for ThreadTime[src]
impl Copy for ThreadTimeimpl Clone for ThreadTime[src]
impl Clone for ThreadTimefn clone(&self) -> ThreadTime[src]
fn clone(&self) -> ThreadTimeReturns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more
impl PartialEq for ThreadTime[src]
impl PartialEq for ThreadTimefn eq(&self, other: &ThreadTime) -> bool[src]
fn eq(&self, other: &ThreadTime) -> boolThis method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &ThreadTime) -> bool[src]
fn ne(&self, other: &ThreadTime) -> boolThis method tests for !=.
impl Eq for ThreadTime[src]
impl Eq for ThreadTimeimpl Debug for ThreadTime[src]
impl Debug for ThreadTimefn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl Hash for ThreadTime[src]
impl Hash for ThreadTimeAuto Trait Implementations
impl !Send for ThreadTime
impl !Send for ThreadTimeimpl !Sync for ThreadTime
impl !Sync for ThreadTime