eminence / procfs

Rust library for reading the Linux procfs filesystem
Other
367 stars 106 forks source link

KernelStats doesn't handle CPU hotplug (discontiguous CPUs) #124

Open antonblanchard opened 3 years ago

antonblanchard commented 3 years ago

I have a system where CPUs have been hot unplugged:

cpu  2074740 293711 234994 2597681757 257 22230 26383 0 0 0
cpu0 14996 1543 5186 5195036 1 63 1986 0 0 0
cpu4 10653 1590 913 5205455 0 57 116 0 0 0
cpu8 22749 1621 923 5193341 0 69 101 0 0 0
cpu12 24716 1511 1236 5191184 1 67 90 0 0 0

It looks like we assume CPUs are contiguous, and don't have a way to retrieve the CPU IDs.

antonblanchard commented 3 years ago

Thinking about it some more, I can pull that data from CpuInfo. A bit of extra work to get there though.

eminence commented 3 years ago

What if the CpuTime struct included a new field that contained the name of the cpu ("cpu4" for example)? Does that help? Or are you looking for maybe a HashMap instead of a Vec?