[systemd-devel] systemd-cgtop vs docker-stats
Lennart Poettering
lennart at poettering.net
Fri Nov 27 09:30:17 PST 2015
On Fri, 27.11.15 15:10, Tiago Alves (tiagoalves83 at gmail.com) wrote:
> >
> >
> >
> > See:
> >
> > https://github.com/systemd/systemd/blob/master/src/cgtop/cgtop.c#L232
> >
> > It simply divides the CPU time spent by the real time spent, that's all.
> >
> >
> Any suggestion of how to get those times using bash ?
> I am using "/proc/stat" for system cpu and "/sys/fs/cgroup/cpu,
> cpuacct/system.slice/docker-${CID}*.scope/cpuacct.usage" for docker
> container cpu.
I am not convinced that "bash" is the right language to do such
calculations in.
cpuacct.usage is the right place to look for systemd's own cgroups. No
idea how docker uses cgroups though.
I don't see why you'd ever use /proc/stat. Just use the top-level
cpuacct.usage file in the cgroup tree, it should cover the whole tree,
and hence the entire system.
No idea how you would query the CLOCK_MONOTONIC clock for the time
passed though from bash.
Lennart
--
Lennart Poettering, Red Hat
More information about the systemd-devel
mailing list