*/
# define VIR_DOMAIN_STATS_IOTHREAD_SUFFIX_POLL_SHRINK ".poll-shrink"
+
+/**
+ * VIR_DOMAIN_STATS_MEMORY_BANDWIDTH_MONITOR_COUNT:
+ *
+ * The number of memory bandwidth monitors for this domain as an unsigned int.
+ *
+ * Since: 11.2.0
+ */
+# define VIR_DOMAIN_STATS_MEMORY_BANDWIDTH_MONITOR_COUNT "memory.bandwidth.monitor.count"
+
+/**
+ * VIR_DOMAIN_STATS_MEMORY_BANDWIDTH_MONITOR_PREFIX:
+ *
+ * The parameter name prefix to access each bandwith monitor entry.
+ * Concatenate the prefix, the entry number formatted as an unsigned integer
+ * and one of the memory bandwith suffix parameters to form a complete
+ * parameter name.
+ *
+ * Since: 11.2.0
+ */
+# define VIR_DOMAIN_STATS_MEMORY_BANDWIDTH_MONITOR_PREFIX "memory.bandwidth.monitor."
+
+/**
+ * VIR_DOMAIN_STATS_MEMORY_BANDWIDTH_MONITOR_SUFFIX_NAME:
+ *
+ * The name of the bandwidth monitor as a string.
+ *
+ * Since: 11.2.0
+ */
+# define VIR_DOMAIN_STATS_MEMORY_BANDWIDTH_MONITOR_SUFFIX_NAME ".name"
+
+/**
+ * VIR_DOMAIN_STATS_MEMORY_BANDWIDTH_MONITOR_SUFFIX_VCPUS:
+ *
+ * The vcpu list of the bandwidth monitor as a string.
+ *
+ * Since: 11.2.0
+ */
+# define VIR_DOMAIN_STATS_MEMORY_BANDWIDTH_MONITOR_SUFFIX_VCPUS ".vcpus"
+
+/**
+ * VIR_DOMAIN_STATS_MEMORY_BANDWIDTH_MONITOR_SUFFIX_NODE_COUNT:
+ *
+ * The number of memory controllers in the bandwidth monitor.
+ *
+ * Since: 11.2.0
+ */
+# define VIR_DOMAIN_STATS_MEMORY_BANDWIDTH_MONITOR_SUFFIX_NODE_COUNT ".node.count"
+
+/**
+ * VIR_DOMAIN_STATS_MEMORY_BANDWIDTH_MONITOR_SUFFIX_NODE_PREFIX:
+ *
+ * The parameter name prefix to access each controller entry. Concatenate the
+ * bandwidth monitor prefix, the monitor entry number formatted as an unsigned
+ * integer, the controller prefix, the controller entry number formatted as an
+ * unsigned integer and one of the controller suffix parameters to form a
+ * complete parameter name.
+ *
+ * Since: 11.2.0
+ */
+# define VIR_DOMAIN_STATS_MEMORY_BANDWIDTH_MONITOR_SUFFIX_NODE_PREFIX ".node."
+
+/**
+ * VIR_DOMAIN_STATS_MEMORY_BANDWIDTH_MONITOR_SUFFIX_NODE_SUFFIX_ID:
+ *
+ * Host allocated memory controller id for the controller as an unsigned int.
+ *
+ * Since: 11.2.0
+ */
+# define VIR_DOMAIN_STATS_MEMORY_BANDWIDTH_MONITOR_SUFFIX_NODE_SUFFIX_ID ".id"
+
+/**
+ * VIR_DOMAIN_STATS_MEMORY_BANDWIDTH_MONITOR_SUFFIX_NODE_SUFFIX_BYTES_LOCAL:
+ *
+ * The accumulative bytes consumed by vcpus passing through the memory
+ * controller in the same processor that the scheduled host CPU belongs to as
+ * an unsigned long long.
+ *
+ * Since: 11.2.0
+ */
+# define VIR_DOMAIN_STATS_MEMORY_BANDWIDTH_MONITOR_SUFFIX_NODE_SUFFIX_BYTES_LOCAL ".bytes.local"
+
+/**
+ * VIR_DOMAIN_STATS_MEMORY_BANDWIDTH_MONITOR_SUFFIX_NODE_SUFFIX_BYTES_TOTAL:
+ *
+ * The accumulative bytes consumed by vcpus passing through all memory
+ * controllers, either local or remote, as an unsigned long long.
+ *
+ * Since: 11.2.0
+ */
+# define VIR_DOMAIN_STATS_MEMORY_BANDWIDTH_MONITOR_SUFFIX_NODE_SUFFIX_BYTES_TOTAL ".bytes.total"
+
/**
* virDomainStatsTypes:
*
* VIR_DOMAIN_STATS_MEMORY:
* Return memory bandwidth statistics and the usage information. The typed
* parameter keys are in this format:
- *
- * "memory.bandwidth.monitor.count" - the number of memory bandwidth
- * monitors for this domain
- * "memory.bandwidth.monitor.<num>.name" - the name of monitor <num>
- * "memory.bandwidth.monitor.<num>.vcpus" - the vcpu list of monitor <num>
- * "memory.bandwidth.monitor.<num>.node.count" - the number of memory
- * controller in monitor <num>
- * "memory.bandwidth.monitor.<num>.node.<index>.id" - host allocated memory
- * controller id for controller
- * <index> of monitor <num>
- * "memory.bandwidth.monitor.<num>.node.<index>.bytes.local" - the
- * accumulative bytes consumed by @vcpus that passing
- * through the memory controller in the same processor
- * that the scheduled host CPU belongs to.
- * "memory.bandwidth.monitor.<num>.node.<index>.bytes.total" - the total
- * bytes consumed by @vcpus that passing through all
- * memory controllers, either local or remote controller.
+ * The VIR_DOMAIN_STATS_MEMORY_* constants define the known typed
+ * parameter keys.
*
* VIR_DOMAIN_STATS_DIRTYRATE:
* Return memory dirty rate information. The typed parameter keys are in
if (nresdata == 0)
return;
- virTypedParamListAddUInt(params, nresdata, "memory.bandwidth.monitor.count");
+ virTypedParamListAddUInt(params, nresdata,
+ VIR_DOMAIN_STATS_MEMORY_BANDWIDTH_MONITOR_COUNT);
for (i = 0; i < nresdata; i++) {
- virTypedParamListAddString(params, resdata[i]->name, "memory.bandwidth.monitor.%zu.name", i);
- virTypedParamListAddString(params, resdata[i]->vcpus, "memory.bandwidth.monitor.%zu.vcpus", i);
- virTypedParamListAddUInt(params, resdata[i]->nstats, "memory.bandwidth.monitor.%zu.node.count", i);
+ virTypedParamListAddString(params, resdata[i]->name,
+ VIR_DOMAIN_STATS_MEMORY_BANDWIDTH_MONITOR_PREFIX "%zu" VIR_DOMAIN_STATS_MEMORY_BANDWIDTH_MONITOR_SUFFIX_NAME, i);
+ virTypedParamListAddString(params, resdata[i]->vcpus,
+ VIR_DOMAIN_STATS_MEMORY_BANDWIDTH_MONITOR_PREFIX "%zu" VIR_DOMAIN_STATS_MEMORY_BANDWIDTH_MONITOR_SUFFIX_VCPUS, i);
+ virTypedParamListAddUInt(params, resdata[i]->nstats,
+ VIR_DOMAIN_STATS_MEMORY_BANDWIDTH_MONITOR_PREFIX "%zu" VIR_DOMAIN_STATS_MEMORY_BANDWIDTH_MONITOR_SUFFIX_NODE_COUNT, i);
for (j = 0; j < resdata[i]->nstats; j++) {
- virTypedParamListAddUInt(params, resdata[i]->stats[j]->id,
- "memory.bandwidth.monitor.%zu.node.%zu.id", i, j);
-
+ virTypedParamListAddUInt(
+ params, resdata[i]->stats[j]->id,
+ VIR_DOMAIN_STATS_MEMORY_BANDWIDTH_MONITOR_PREFIX "%zu" VIR_DOMAIN_STATS_MEMORY_BANDWIDTH_MONITOR_SUFFIX_NODE_PREFIX "%zu" VIR_DOMAIN_STATS_MEMORY_BANDWIDTH_MONITOR_SUFFIX_NODE_SUFFIX_ID, i, j);
features = resdata[i]->stats[j]->features;
for (k = 0; features[k]; k++) {
if (STREQ(features[k], "mbm_local_bytes")) {
/* The accumulative data passing through local memory
* controller is recorded with 64 bit counter. */
- virTypedParamListAddULLong(params, resdata[i]->stats[j]->vals[k],
- "memory.bandwidth.monitor.%zu.node.%zu.bytes.local", i, j);
+ virTypedParamListAddULLong(
+ params, resdata[i]->stats[j]->vals[k],
+ VIR_DOMAIN_STATS_MEMORY_BANDWIDTH_MONITOR_PREFIX "%zu" VIR_DOMAIN_STATS_MEMORY_BANDWIDTH_MONITOR_SUFFIX_NODE_PREFIX "%zu" VIR_DOMAIN_STATS_MEMORY_BANDWIDTH_MONITOR_SUFFIX_NODE_SUFFIX_BYTES_LOCAL, i, j);
}
if (STREQ(features[k], "mbm_total_bytes")) {
/* The accumulative data passing through local and remote
* memory controller is recorded with 64 bit counter. */
- virTypedParamListAddULLong(params, resdata[i]->stats[j]->vals[k],
- "memory.bandwidth.monitor.%zu.node.%zu.bytes.total", i, j);
+ virTypedParamListAddULLong(
+ params, resdata[i]->stats[j]->vals[k],
+ VIR_DOMAIN_STATS_MEMORY_BANDWIDTH_MONITOR_PREFIX "%zu" VIR_DOMAIN_STATS_MEMORY_BANDWIDTH_MONITOR_SUFFIX_NODE_PREFIX "%zu" VIR_DOMAIN_STATS_MEMORY_BANDWIDTH_MONITOR_SUFFIX_NODE_SUFFIX_BYTES_TOTAL, i, j);
}
}
}