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 ThreadTime
pub fn now() -> ThreadTime
[src]
pub fn now() -> ThreadTime
Get 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) -> Duration
Returns 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) -> Duration
Returns the amount of CPU time used by the current thread from the previous timestamp.
Trait Implementations
impl Copy for ThreadTime
[src]
impl Copy for ThreadTime
impl Clone for ThreadTime
[src]
impl Clone for ThreadTime
fn clone(&self) -> ThreadTime
[src]
fn clone(&self) -> ThreadTime
Returns 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 ThreadTime
fn eq(&self, other: &ThreadTime) -> bool
[src]
fn eq(&self, other: &ThreadTime) -> bool
This 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) -> bool
This method tests for !=
.
impl Eq for ThreadTime
[src]
impl Eq for ThreadTime
impl Debug for ThreadTime
[src]
impl Debug for ThreadTime
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Hash for ThreadTime
[src]
impl Hash for ThreadTime
Auto Trait Implementations
impl !Send for ThreadTime
impl !Send for ThreadTime
impl !Sync for ThreadTime
impl !Sync for ThreadTime