SYS_cpu_stat
Returns timing statistics about a given CPU.
Inputs
| Register | Type | Purpose |
|---|---|---|
| a1 | u32 | Target CPU ID |
| a2 | uaddr | cpu_stat structure |
The ID of each CPU is noted in the bootinfo structure’s cpu_info list.
cpu_stat structure
Each field of the cpu_stat structure represents the amount of time this CPU has spent in each state from an arbitrarily defined epoch. Time increases monotonically at the rate defined by the tick_rate parameter of the bootinfo structure.
// CPU usage statistics.
export type cpu_stat = struct {
idle: u64,
user: u64,
kern: u64,
};
Outputs
The cpu_stat structure is filled in with the latest timing info.
Errors
- ENOENT: No CPU by this ID was found
- EFAULT: The address of the cpu_stat structure is not valid