mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-20 06:50:22 +03:00
src: add constants for domain stats 'iothread.' parameters
Contrary to most APIs returning typed parameters, there are no constants defined for the domain stats data keys. This is was because many of the keys needs to be dynamically constructed using one or more array index values. It is possible to define constants while still supporting dynamic array indexes by simply defining the prefixes and suffixes as constants. The consuming code can then combine the constants with array index value. With this approach, it is practical to add constants for the domain stats API keys. Reviewed-by: Peter Krempa <pkrempa@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
69e8341f10
commit
ca0aa86fbb
@ -3700,6 +3700,62 @@ struct _virDomainStatsRecord {
|
||||
*/
|
||||
# define VIR_DOMAIN_STATS_PERF_EMULATION_FAULTS "perf.emulation_faults"
|
||||
|
||||
|
||||
/**
|
||||
* VIR_DOMAIN_STATS_IOTHREAD_COUNT:
|
||||
*
|
||||
* Maximum number of IOThreads in the subsequent list as unsigned int. Each
|
||||
* IOThread in the list will will use it's iothread_id value as the array
|
||||
* index. There may be fewer array entries than the iothread.count value if
|
||||
* the polling values are not supported.
|
||||
*
|
||||
* Since: 11.2.0
|
||||
*/
|
||||
# define VIR_DOMAIN_STATS_IOTHREAD_COUNT "iothread.count"
|
||||
|
||||
/**
|
||||
* VIR_DOMAIN_STATS_IOTHREAD_PREFIX:
|
||||
*
|
||||
* The parameter name prefix to access each iothread entry. Concatenate the
|
||||
* prefix, the entry number formatted as an unsigned integer and one of the
|
||||
* iothread suffix parameters to form a complete parameter name.
|
||||
*
|
||||
* Since: 11.2.0
|
||||
*/
|
||||
# define VIR_DOMAIN_STATS_IOTHREAD_PREFIX "iothread."
|
||||
|
||||
/**
|
||||
* VIR_DOMAIN_STATS_IOTHREAD_SUFFIX_POLL_MAX_NS:
|
||||
*
|
||||
* Maximum polling time in ns as an unsigned long long. A 0 (zero) means
|
||||
* polling is disabled.
|
||||
*
|
||||
* Since: 11.2.0
|
||||
*/
|
||||
# define VIR_DOMAIN_STATS_IOTHREAD_SUFFIX_POLL_MAX_NS ".poll-max-ns"
|
||||
|
||||
/**
|
||||
* VIR_DOMAIN_STATS_IOTHREAD_SUFFIX_POLL_GROW:
|
||||
*
|
||||
* Polling time factor as an unsigned int or unsigned long long if exceeding
|
||||
* range of unsigned int. A 0 (zero) indicates to allow the underlying
|
||||
* hypervisor to choose how to grow the polling time.
|
||||
*
|
||||
* Since: 11.2.0
|
||||
*/
|
||||
# define VIR_DOMAIN_STATS_IOTHREAD_SUFFIX_POLL_GROW ".poll-grow"
|
||||
|
||||
/**
|
||||
* VIR_DOMAIN_STATS_IOTHREAD_SUFFIX_POLL_SHRINK:
|
||||
*
|
||||
* Polling time divisor as an unsigned int or unsigned long long if exceeding
|
||||
* range of unsigned int. A 0 (zero) indicates to allow the underlying
|
||||
* hypervisor to choose how to shrink the polling time.
|
||||
*
|
||||
* Since: 11.2.0
|
||||
*/
|
||||
# define VIR_DOMAIN_STATS_IOTHREAD_SUFFIX_POLL_SHRINK ".poll-shrink"
|
||||
|
||||
/**
|
||||
* virDomainStatsTypes:
|
||||
*
|
||||
|
@ -12313,28 +12313,8 @@ virConnectGetDomainCapabilities(virConnectPtr conn,
|
||||
* which could quickly exceed poll-max-ns; however, a poll-shrink of
|
||||
* 10 would cut that polling time more gradually.
|
||||
*
|
||||
* The typed parameter keys are in this format:
|
||||
*
|
||||
* "iothread.count" - maximum number of IOThreads in the subsequent list
|
||||
* as unsigned int. Each IOThread in the list will
|
||||
* will use it's iothread_id value as the <id>. There
|
||||
* may be fewer <id> entries than the iothread.count
|
||||
* value if the polling values are not supported.
|
||||
* "iothread.<id>.poll-max-ns" - maximum polling time in ns as an unsigned
|
||||
* long long. A 0 (zero) means polling is
|
||||
* disabled.
|
||||
* "iothread.<id>.poll-grow" - polling time factor as an unsigned int or
|
||||
* unsigned long long if exceeding range of
|
||||
* unsigned int.
|
||||
* A 0 (zero) indicates to allow the underlying
|
||||
* hypervisor to choose how to grow the
|
||||
* polling time.
|
||||
* "iothread.<id>.poll-shrink" - polling time divisor as an unsigned int or
|
||||
* unsigned long long if exceeding range of
|
||||
* unsigned int.
|
||||
* A 0 (zero) indicates to allow the underlying
|
||||
* hypervisor to choose how to shrink the
|
||||
* polling time.
|
||||
* The VIR_DOMAIN_STATS_IOTHREAD_* constants define the known typed
|
||||
* parameter keys.
|
||||
*
|
||||
* VIR_DOMAIN_STATS_MEMORY:
|
||||
* Return memory bandwidth statistics and the usage information. The typed
|
||||
|
@ -17576,18 +17576,19 @@ qemuDomainGetStatsIOThread(virQEMUDriver *driver G_GNUC_UNUSED,
|
||||
if (niothreads == 0)
|
||||
return;
|
||||
|
||||
virTypedParamListAddUInt(params, niothreads, "iothread.count");
|
||||
virTypedParamListAddUInt(params, niothreads,
|
||||
VIR_DOMAIN_STATS_IOTHREAD_COUNT);
|
||||
|
||||
for (i = 0; i < niothreads; i++) {
|
||||
if (iothreads[i]->poll_valid) {
|
||||
virTypedParamListAddULLong(params, iothreads[i]->poll_max_ns,
|
||||
"iothread.%u.poll-max-ns",
|
||||
VIR_DOMAIN_STATS_IOTHREAD_PREFIX "%u" VIR_DOMAIN_STATS_IOTHREAD_SUFFIX_POLL_MAX_NS,
|
||||
iothreads[i]->iothread_id);
|
||||
virTypedParamListAddUnsigned(params, iothreads[i]->poll_grow,
|
||||
"iothread.%u.poll-grow",
|
||||
VIR_DOMAIN_STATS_IOTHREAD_PREFIX "%u" VIR_DOMAIN_STATS_IOTHREAD_SUFFIX_POLL_GROW,
|
||||
iothreads[i]->iothread_id);
|
||||
virTypedParamListAddUnsigned(params, iothreads[i]->poll_shrink,
|
||||
"iothread.%u.poll-shrink",
|
||||
VIR_DOMAIN_STATS_IOTHREAD_PREFIX "%u" VIR_DOMAIN_STATS_IOTHREAD_SUFFIX_POLL_SHRINK,
|
||||
iothreads[i]->iothread_id);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user