virNodeGetCPUTimeParameters: Expose new API Signed-off-by: Minoru Usui <usui@xxxxxxxxxxxxxxxxx> --- include/libvirt/libvirt.h.in | 65 ++++++++++++++++++++++++++++++++++++++++++ src/libvirt_public.syms | 1 + 2 files changed, 66 insertions(+), 0 deletions(-) diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in index f4d0b40..723fdf8 100644 --- a/include/libvirt/libvirt.h.in +++ b/include/libvirt/libvirt.h.in @@ -280,6 +280,58 @@ struct _virNodeInfo { unsigned int threads;/* number of threads per core */ }; +/** + * VIR_CPU_TIME_FIELD_LENGTH: + * + * Macro providing the field length of virNodeCPUTimeParameters + */ +#define VIR_CPU_TIME_FIELD_LENGTH 80 + +/** + * VIR_CPU_TIME_KERNEL: + * + * Macro for the cumulative CPU time which spends by kernel, + * when the node booting up.(in nanoseconds). + */ +#define VIR_CPU_TIME_KERNEL "kernel" + +/** + * The cumulative CPU time which spends by user processes, + * when the node booting up.(in nanoseconds). + */ +#define VIR_CPU_TIME_USER "user" + +/** + * The cumulative idle CPU time, + * when the node booting up.(in nanoseconds). + */ +#define VIR_CPU_TIME_IDLE "idle" + +/** + * The cumulative I/O wait CPU time, + * when the node booting up.(in nanoseconds). + */ +#define VIR_CPU_TIME_IOWAIT "iowait" + +/** + * The CPU utilization. + * The usage value is in percent and 100% represents all CPUs on + * the server. + */ +#define VIR_CPU_TIME_UTILIZATION "utilization" + +/** + * virCPUTimeParameter: + * + * a virNodeCPUTimeParameter is a structure filled by virNodeGetCPUTime() + * and providing the information for the cpu time of the node. + */ +typedef struct _virCPUTimeParameter virCPUTimeParameter; + +struct _virCPUTimeParameter { + char field[VIR_CPU_TIME_FIELD_LENGTH]; + unsigned long long value; +}; /** * virDomainSchedParameterType: @@ -512,6 +564,14 @@ int virDomainMigrateSetMaxSpeed(virDomainPtr domain, typedef virNodeInfo *virNodeInfoPtr; /** + * virCPUTimeParameterPtr: + * + * a virCPUTimeParameterPtr is a pointer to a virCPUTimeParameter structure. + */ + +typedef virCPUTimeParameter *virCPUTimeParameterPtr; + +/** * virConnectFlags * * Flags when opening a connection to a hypervisor @@ -645,6 +705,11 @@ int virNodeGetInfo (virConnectPtr conn, virNodeInfoPtr info); char * virConnectGetCapabilities (virConnectPtr conn); +int virNodeGetCPUTimeParameters (virConnectPtr conn, + virCPUTimeParameterPtr params, + int *nparams, + unsigned int flags); + unsigned long long virNodeGetFreeMemory (virConnectPtr conn); int virNodeGetSecurityModel (virConnectPtr conn, diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms index 1444b55..fb8d3e0 100644 --- a/src/libvirt_public.syms +++ b/src/libvirt_public.syms @@ -441,6 +441,7 @@ LIBVIRT_0.9.2 { virDomainGetState; virDomainInjectNMI; virDomainScreenshot; + virNodeGetCPUTimeParameters; } LIBVIRT_0.9.0; # .... define new API here using predicted next version number .... -- 1.7.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list