Commit Graph

3 Commits

Author SHA1 Message Date
Peter Krempa
ba2b4da02d examples: domtop: Avoid leaking memory
Use the virTypedParamsFree unconditionally as it handles NULL well and
has the benefit of freeing a typed parameter array even if it wasn't yet
assigned, but only allocated.
2014-07-21 15:20:59 +02:00
Peter Krempa
abab113bd2 examples: domtop: Fix uninitialized variable use
max_id could be used uninitialized in the cleanup section after the
domain wasn't found.

Discovered by Coverity.
2014-07-21 15:20:59 +02:00
Michal Privoznik
28d54aab05 examples: Introduce domtop
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.

Note: The usage is displayed from host perspective. That is, how much
host CPUs the domain is using. But it should be fairly simple to
switch do just guest CPU usage if needed.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2014-07-18 16:39:54 +02:00