Re: [PATCHv5 1/6] virNodeGetCPUTimeParameters: Expose new API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2011/5/20 Daniel P. Berrange <berrange@xxxxxxxxxx>:
> On Tue, May 17, 2011 at 04:01:36PM +0900, Minoru Usui wrote:
>> 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 ....
>
> ACK.
>
> I'm wondering whether virCPUTimeParameter should be dropped and just use
> the generic virTypedParameter instead. It would be rather overkill since
> we only really want to ever use Â'unsigned long long' for this data,
> but it might be simpler for apps to have the same struct, even if we only
> use one field of it.
>
> Daniel
>

Actually virNodeGetCPUTimeParameters is the wrong name. It's not a
parameter function, it's a statistics function. Therefore, it should
be called virNodeGetCPUTimeStats or virNodeGetCPUStats.

Matthias

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]