On 04/18/2012 05:14 AM, Hu Tao wrote:
Currently virDomainGetCPUStats gets total cpu usage, which consists
of:
1. vcpu usage: the physical cpu time consumed by virtual cpu(s) of
domain
2. hypervisor: `total cpu usage' - `vcpu usage'
The flag VIR_DOMAIN_CPU_STATS_F_VCPU is for getting vcpu usages.
---
include/libvirt/libvirt.h.in | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
Missing documentation of what the new flag does in src/libvirt.c.
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 499dcd4..94c6abd 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -1355,6 +1355,16 @@ int virDomainGetState (virDomainPtr
domain,
*/
#define VIR_DOMAIN_CPU_STATS_SYSTEMTIME "system_time"
+typedef enum {
+ /* virDomainModificationImpact and virTypedParameterFlags go
+ here. */
Why reserve space for virDomainModificationImpact? CPU stats are only
available for a running VM, so there is no point in reserving a flag to
query the stats of an inactive persistent domain.
But I do agree that we must not conflict with virTypedParameterFlags.
+
+ /* Additionally, these flags may be bitwise-OR'd in. These
+ flags should not override those of virDomainModificationImpact
+ and virTypedParameterFlags */
+ VIR_DOMAIN_CPU_STATS_F_VCPU = 1 << 3, /* get vcpu stats */
+} virDomainGetCPUStatsFlags;
+
int virDomainGetCPUStats(virDomainPtr domain,
virTypedParameterPtr params,
unsigned int nparams,
--
Eric Blake eblake(a)redhat.com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org