pub struct Profile { /* private fields */ }Expand description
The Profile structure stores how long it takes to do a task.
§Examples
use std::{time::Duration, thread::sleep};
use xuko_misc::profiling::Profile;
let mut profile = Profile::new("sleep");
sleep(Duration::from_millis(100));
let elapsed = profile.elapsed().unwrap();
assert!(elapsed >= 100);
sleep(Duration::from_millis(100));
// the result is saved!
assert_eq!(profile.elapsed().unwrap(), elapsed);Implementations§
Source§impl Profile
impl Profile
Sourcepub fn elapsed(&mut self) -> Result<u128, SystemTimeError>
pub fn elapsed(&mut self) -> Result<u128, SystemTimeError>
Same as Self::elapsed_duration, except maps the result with Duration::as_millis
Sourcepub fn elapsed_duration(&mut self) -> Result<Duration, SystemTimeError>
pub fn elapsed_duration(&mut self) -> Result<Duration, SystemTimeError>
Auto Trait Implementations§
impl Freeze for Profile
impl RefUnwindSafe for Profile
impl Send for Profile
impl Sync for Profile
impl Unpin for Profile
impl UnsafeUnpin for Profile
impl UnwindSafe for Profile
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