How is CPU usage calculated on a Linux system with a single core?
Cpu(s): 28.1%us, 6.5%sy, 0.0%ni, 43.0%id, 21.6%wa, 0.0%hi, 0.5%si, 0.2%st
Please explain me how the
st values are obtained.
CPU usage is calculated and tracked by the kernel. The exact methods and processes involved in this are far beyond the scope of this site (ServerFault).
If you're wondering what the values represent, I pulled this nice list from IBM's site, though the full article is a good read:
(from IBM... why it's only embedded in a Java SDK guide is beyond me)
/proc/[pid]/stat results are produced by this code in the Linux kernel.
You can click around and get more info from in there.
This article describes this clearly.