
Hi, Daniel. On Mon, 18 Apr 2011 12:32:03 +0100 "Daniel P. Berrange" <berrange@redhat.com> wrote:
On Thu, Apr 14, 2011 at 07:08:44PM +0900, Minoru Usui wrote:
virNodeGetCPUTime: Expose new API
Signed-off-by: Minoru Usui <usui@mxm.nes.nec.co.jp> --- include/libvirt/libvirt.h.in | 50 ++++++++++++++++++++++++++++++++++++++++++ src/libvirt_public.syms | 5 ++++ 2 files changed, 55 insertions(+), 0 deletions(-)
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in index 5783303..25cc08c 100644 --- a/include/libvirt/libvirt.h.in +++ b/include/libvirt/libvirt.h.in @@ -228,6 +228,51 @@ struct _virNodeInfo { unsigned int threads;/* number of threads per core */ };
+/** + * virNodeCpuTime: + */ + +/** + * virNodeCpuTimeFlags + * + * Flags when getting cpu statistics of the node. + */ +typedef enum { + /* + * The cumulative CPU time which spends by kernel, + * when the node booting up.(in nanoseconds). + */ + VIR_NODE_CPU_TIME_KERNEL = 1, + /* + * The cumulative CPU time which spends by user processes, + * when the node booting up.(in nanoseconds). + */ + VIR_NODE_CPU_TIME_USER = 2, + /* + * The cumulative idle CPU time, + * when the node booting up.(in nanoseconds). + */ + VIR_NODE_CPU_TIME_IDLE = 4, + /* + * The cumulative I/O wait CPU time, + * when the node booting up.(in nanoseconds). + */ + VIR_NODE_CPU_TIME_IOWAIT = 8, + /* + * The CPU utilization. + * The usage value is in percent and 100% represents all CPUs on + * the server. + */ + VIR_NODE_CPU_TIME_UTILIZATION = 16, + + /* + * The number of statistics supported by this version of the interface. + * To add new statistics, add them to the enum and increase this value. + */ + VIR_NODE_CPU_TIME_MAX = 32 +} virNodeCpuTimeFlags; + +#define VIR_NODE_CPU_TIME_MASK (VIR_NODE_CPU_TIME_MAX - 1)
/** * virDomainSchedParameterType: @@ -593,6 +638,11 @@ int virNodeGetInfo (virConnectPtr conn, virNodeInfoPtr info); char * virConnectGetCapabilities (virConnectPtr conn);
+int virNodeGetCpuTime (virConnectPtr conn, + unsigned long long *stats, + unsigned int nr_stats, + unsigned int flags); + unsigned long long virNodeGetFreeMemory (virConnectPtr conn);
I'm sorry, but NACK to this API design. Your v2 design was consistent with the design of the other stats APIs we provide & better than this IMHO.
I understand. I drop this v3 design.
Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
-- Minoru Usui <usui@mxm.nes.nec.co.jp>