pub struct TimeStat { /* private fields */ }
Expand description
任务时间统计结构
Implementations§
source§impl TimeStat
impl TimeStat
sourcepub fn output(&self) -> (usize, usize)
pub fn output(&self) -> (usize, usize)
To get the time statistics
The format is (user time, kernel time) in nanoseconds
sourcepub fn switch_into_kernel_mode(&mut self, tid: isize, current_timestamp: usize)
pub fn switch_into_kernel_mode(&mut self, tid: isize, current_timestamp: usize)
从用户态进入内核态,记录当前时间戳,统计用户态时间
sourcepub fn switch_into_user_mode(&mut self, tid: isize, current_timestamp: usize)
pub fn switch_into_user_mode(&mut self, tid: isize, current_timestamp: usize)
从内核态进入用户态,记录当前时间戳,统计内核态时间
sourcepub fn swtich_from_old_task(&mut self, tid: isize, current_timestamp: usize)
pub fn swtich_from_old_task(&mut self, tid: isize, current_timestamp: usize)
内核态下,当前任务被切换掉,统计内核态时间
sourcepub fn switch_to_new_task(&mut self, tid: isize, current_timestamp: usize)
pub fn switch_to_new_task(&mut self, tid: isize, current_timestamp: usize)
内核态下,切换到当前任务,更新内核态时间戳
sourcepub fn output_timer_as_us(&self) -> (usize, usize)
pub fn output_timer_as_us(&self) -> (usize, usize)
以微秒形式输出计时器信息
(计时器周期,当前计时器剩余时间)
sourcepub fn set_timer(
&mut self,
timer_interval_ns: usize,
timer_remained_ns: usize,
timer_type: usize
) -> bool
pub fn set_timer( &mut self, timer_interval_ns: usize, timer_remained_ns: usize, timer_type: usize ) -> bool
设定计时器信息
若type不为None则返回成功
sourcepub fn update_timer(&mut self, delta: usize, _tid: isize)
pub fn update_timer(&mut self, delta: usize, _tid: isize)
更新计时器,同时判断是否要发出信号
sourcepub fn check_pending_timer_signal(&mut self) -> Option<usize>
pub fn check_pending_timer_signal(&mut self) -> Option<usize>
Return
If the timer has triggered, return the signal number and reset the timer Otherwise, return None
Reference:
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for TimeStat
impl Send for TimeStat
impl Sync for TimeStat
impl Unpin for TimeStat
impl UnwindSafe for TimeStat
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