-
Notifications
You must be signed in to change notification settings - Fork 246
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Per-container CPU usage in /proc/stat
Containers can see utilization of all available CPUs, even if the CPU is utilized by other containers or by the host. The contents of `/proc/stat` is shared across the system, except for hiding CPUs excluded by cpuset. This commit attempts to fix that, but at a cost. CPU usage is read from cpuacct cgroup, but that accounts only for `user` and `system` fields from `/proc/stat`. Idle time can be calculated, but other fields cannot, thus are always set to 0. Additionally, idle time is based on values from the host, so even a freshly started container has large initial idle time. If the cpuacct cgroup is not present, or reading from it fails, LXCFS will return CPU usage stats from the host as before. Signed-off-by: Jakub Skokan <jakub.skokan@havefun.cz>
- Loading branch information
Showing
1 changed file
with
181 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters