On 07/16/2014 08:27 AM, Eric Blake wrote:
On 07/16/2014 07:53 AM, Michal Privoznik wrote:
> There's this question on the list that is asked over and over again.
> How do I get {cpu, memory, ...} usage in percentage? Or its modified
> version: How do I plot nice graphs like virt-manager does?
>
> It would be nice if we have an example to inspire people. And that's
> what domtop should do. Yes, it could be written in different ways, but
> I've chosen this one as I think it show explicitly what users need to
> implement in order to imitate virt-manager's graphing.
>
> Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
> ---
> .gitignore | 1 +
> Makefile.am | 2 +-
> cfg.mk | 2 +-
> configure.ac | 1 +
> examples/domtop/Makefile.am | 27 +++
> examples/domtop/domtop.c | 388 ++++++++++++++++++++++++++++++++++++++++++++
> libvirt.spec.in | 2 +-
> 7 files changed, 420 insertions(+), 3 deletions(-)
> create mode 100644 examples/domtop/Makefile.am
> create mode 100644 examples/domtop/domtop.c
>
[first round review - I still plan to compile and examine what happens
when actually running the program, which may result in more comments...]
I was a bit confused that the usage depends on whether I supply a domain
name or not (it looks like without a name, you just list available names
and quit immediately; with a name, you show stats on just that named
domain). Not sure if the help text could be enhanced to explain that.
I noticed that even though my guest only has one vcpu assigned, the
stats shown listed four cpus (for my test machine), so this is reporting
the cumulative usage of each host cpu, and not of the guest vcpu.
Definitely worth mentioning what perspective the stats are taken from.
The output is hard to visually break apart - either put a blank line
between output spurts (with the current one line per cpu during the
spurt), or put all cpu stats on a single line per spurt. (Oh, I see Jan
also suggested single line per spurt, so it becomes easier to track
columns for usage patterns).
Looking forward to v2.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org