[libvirt] [PATCH 1/2] Add a new flag VIR_DOMAIN_CPU_STATS_F_VCPU to virDomainGetCPUStats

Hu Tao hutao at cn.fujitsu.com
Wed Apr 18 11:14:55 UTC 2012


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(-)

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.  */
+
+    /* 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,
-- 
1.7.1




More information about the libvir-list mailing list