2

Recently did some perf testing of a process running in a docker container. CPU usage was gathered via the cpuacct.stat file found in the /sys/fs container directory. When monitoring the process by hand, using a tool such as top, I noticed that the cgroup CPU usage was always less than that shown by top, sometimes by a factor of four.

I wrote a quick script to track the ticks used by the process in the container as reported by both cpuacct.stat and /proc//stat. They aren't even close. The proc stats are much larger, which doesn't make any sense; it's like saying the container is smaller than what's in it.

The only reference to any of this I could find was a kernel comment saying that cpuacct.stat might be a little inaccurate once in a while. This is more than a rounding error.

Anyone have any experience or knowledge about this? It kind of throws all of my CPU usage metrics into doubt.

Linux 3.10.0-327.18.2.el7.x86_64 Centos on an 8 cpu box.

  • Chris, what is the specific question here? I'm researching perf in general and want to assist here if possible. Are you interested in cpuacct.stat accuracy in the general case or specifically for dockers? If the letter, please provide some more details on what you are trying to do. – Tgilgul Jul 26 '17 at 13:34

0 Answers0