Stat::cpus is Option<Vec<CpuStat>> which is populated by each cpuN line in /proc/stat. However, /proc/stat CPU numbers may have holes. Here's an example from a 4 CPU qemu instance:
KernelStats::cpu_time will contain 3 entries but without any way to reliably find out which three CPUs are being reported. Corroborating other sources doesn't really work as there may be intervening hot[un]plug operations between reads.
It seems like KernelStats::cpu_time, instead of being a Vec, should be keyed with CPU ID read from /proc/stat.
Stat::cpus
isOption<Vec<CpuStat>>
which is populated by eachcpuN
line in/proc/stat
. However,/proc/stat
CPU numbers may have holes. Here's an example from a 4 CPU qemu instance:After taking cpu2 offline with echo 0 > /sys/devices/system/cpu/cpu2/online, the file looks as follows:
KernelStats::cpu_time
will contain 3 entries but without any way to reliably find out which three CPUs are being reported. Corroborating other sources doesn't really work as there may be intervening hot[un]plug operations between reads.It seems like
KernelStats::cpu_time
, instead of being aVec
, should be keyed with CPU ID read from/proc/stat
.