]> git.ipfire.org Git - thirdparty/libvirt.git/commit
cpustats: collect VM user and sys times
authorEric Blake <eblake@redhat.com>
Fri, 9 Mar 2012 00:35:59 +0000 (17:35 -0700)
committerEric Blake <eblake@redhat.com>
Mon, 12 Mar 2012 14:46:56 +0000 (08:46 -0600)
commit0d0b409863b4c7621e54c72869ee0f28a6ea1e04
tree429460dba6e681fb53f45bb088fe511c9b033d8c
parent6e0ff1d4024ca44fab307a89da1968f7b03cd482
cpustats: collect VM user and sys times

As documented in linux.git/Documentation/cgroups/cpuacct.txt,
cpuacct.stat returns user and system time in ticks (the same
unit used in times(2)).  It would be a bit nicer if it were like
getrusage(2) and reported timeval contents, or like cpuacct.usage
and in nanoseconds, but we can't be picky.

* src/util/cgroup.h (virCgroupGetCpuacctStat): New function.
* src/util/cgroup.c (virCgroupGetCpuacctStat): Implement it.
(virCgroupGetValueStr): Allow for multi-line files.
* src/libvirt_private.syms (cgroup.h): Export it.
src/libvirt_private.syms
src/util/cgroup.c
src/util/cgroup.h