get_cycle

Function get_cycle 

Source
pub fn get_cycle(precision: Precision) -> Status
Expand description

Get back the elapsed time since startup, in various units

§Usage

The kernel store the elapsed time since its startup so that it is possible to get basic time measurement, being from startup or between two call to this API, in various format.

The precision required is passed in the unit argument, as defined in the Precision type.

Whatever the precision is, the returned value is always encoded as u64.

While Precision::Milliseconds and Precision::Microseconds do not require specific capability, Precision::Nanoseconds and Precision::Cycle require the CAP_TIM_HP_CHRONO capability. This avoid any hability to get high precision measurements that may leed to side channel analysis on another task’s behavior without having the corresponding capability.

Most of the time, this capability is not required.

This syscall returns the value in the SVC_EXCHANGE area, where it needs to be read afterward.