*/
# define VIR_DOMAIN_STATS_MEMORY_BANDWIDTH_MONITOR_SUFFIX_NODE_SUFFIX_BYTES_TOTAL ".bytes.total"
+
+/**
+ * VIR_DOMAIN_STATS_DIRTYRATE_CALC_STATUS:
+ *
+ * The status of last memory dirty rate calculation as an int from the
+ * virDomainDirtyRateStatus enum.
+ *
+ * Since: 11.2.0
+ */
+# define VIR_DOMAIN_STATS_DIRTYRATE_CALC_STATUS "dirtyrate.calc_status"
+
+/**
+ * VIR_DOMAIN_STATS_DIRTYRATE_CALC_START_TIME:
+ *
+ * The start time in seconds of the last memory dirty rate calculation as long
+ * long.
+ *
+ * Since: 11.2.0
+ */
+# define VIR_DOMAIN_STATS_DIRTYRATE_CALC_START_TIME "dirtyrate.calc_start_time"
+
+/**
+ * VIR_DOMAIN_STATS_DIRTYRATE_CALC_PERIOD:
+ *
+ * The period in seconds of last memory dirty rate calculation as int.
+ *
+ * Since: 11.2.0
+ */
+# define VIR_DOMAIN_STATS_DIRTYRATE_CALC_PERIOD "dirtyrate.calc_period"
+
+/**
+ * VIR_DOMAIN_STATS_DIRTYRATE_MEGABYTES_PER_SECOND:
+ *
+ * The calculated memory dirty rate in MiB/s as long long. It is produced only
+ * if the calc_status is measured.
+ *
+ * Since: 11.2.0
+ */
+# define VIR_DOMAIN_STATS_DIRTYRATE_MEGABYTES_PER_SECOND "dirtyrate.megabytes_per_second"
+
+/**
+ * VIR_DOMAIN_STATS_DIRTYRATE_CALC_MODE:
+ *
+ * The calculation mode used last measurement as string, either of these
+ * 'page-sampling', 'dirty-bitmap' or 'dirty-ring' values returned.
+ *
+ * Since: 11.2.0
+ */
+# define VIR_DOMAIN_STATS_DIRTYRATE_CALC_MODE "dirtyrate.calc_mode"
+
+/**
+ * VIR_DOMAIN_STATS_DIRTYRATE_VCPU_PREFIX:
+ *
+ * The parameter name prefix to access each VCPU entry. Concatenate the
+ * prefix, the entry number formatted as an unsigned integer and one of the
+ * VCPU suffix parameters to form a complete parameter name.
+ *
+ * Since: 11.2.0
+ */
+# define VIR_DOMAIN_STATS_DIRTYRATE_VCPU_PREFIX "dirtyrate.vcpu."
+
+/**
+ * VIR_DOMAIN_STATS_DIRTYRATE_VCPU_SUFFIX_MEGABYTES_PER_SECOND:
+ *
+ * The calculated memory dirty rate for a virtual cpu as unsigned long long.
+ *
+ * Since: 11.2.0
+ */
+# define VIR_DOMAIN_STATS_DIRTYRATE_VCPU_SUFFIX_MEGABYTES_PER_SECOND ".megabytes_per_second"
+
/**
* virDomainStatsTypes:
*
* parameter keys.
*
* VIR_DOMAIN_STATS_DIRTYRATE:
- * Return memory dirty rate information. The typed parameter keys are in
- * this format:
- *
- * "dirtyrate.calc_status" - the status of last memory dirty rate calculation,
- * returned as int from virDomainDirtyRateStatus
- * enum.
- * "dirtyrate.calc_start_time" - the start time of last memory dirty rate
- * calculation as long long.
- * "dirtyrate.calc_period" - the period of last memory dirty rate calculation
- * as int.
- * "dirtyrate.megabytes_per_second" - the calculated memory dirty rate in
- * MiB/s as long long. It is produced
- * only if the calc_status is measured.
- * "dirtyrate.calc_mode" - the calculation mode used last measurement, either
- * of these 3 'page-sampling,dirty-bitmap,dirty-ring'
- * values returned.
- * "dirtyrate.vcpu.<num>.megabytes_per_second" - the calculated memory dirty
- * rate for a virtual cpu as
- * unsigned long long.
+ * Return memory dirty rate information.
+ * The VIR_DOMAIN_STATS_DIRTYRATE_* constants define the known typed
+ * parameter keys.
*
* VIR_DOMAIN_STATS_VM:
* Return hypervisor-specific statistics. Note that the naming and meaning
return;
}
- virTypedParamListAddInt(params, info.status, "dirtyrate.calc_status");
- virTypedParamListAddLLong(params, info.startTime, "dirtyrate.calc_start_time");
- virTypedParamListAddInt(params, info.calcTime, "dirtyrate.calc_period");
+ virTypedParamListAddInt(params, info.status,
+ VIR_DOMAIN_STATS_DIRTYRATE_CALC_STATUS);
+ virTypedParamListAddLLong(params, info.startTime,
+ VIR_DOMAIN_STATS_DIRTYRATE_CALC_START_TIME);
+ virTypedParamListAddInt(params, info.calcTime,
+ VIR_DOMAIN_STATS_DIRTYRATE_CALC_PERIOD);
virTypedParamListAddString(params, qemuMonitorDirtyRateCalcModeTypeToString(info.mode),
- "dirtyrate.calc_mode");
+ VIR_DOMAIN_STATS_DIRTYRATE_CALC_MODE);
if (info.status == VIR_DOMAIN_DIRTYRATE_MEASURED) {
- virTypedParamListAddLLong(params, info.dirtyRate, "dirtyrate.megabytes_per_second");
+ virTypedParamListAddLLong(params, info.dirtyRate,
+ VIR_DOMAIN_STATS_DIRTYRATE_MEGABYTES_PER_SECOND);
if (info.mode == QEMU_MONITOR_DIRTYRATE_CALC_MODE_DIRTY_RING) {
size_t i;
for (i = 0; i < info.nvcpus; i++) {
- virTypedParamListAddULLong(params, info.rates[i].value,
- "dirtyrate.vcpu.%d.megabytes_per_second",
- info.rates[i].idx);
+ virTypedParamListAddULLong(
+ params, info.rates[i].value,
+ VIR_DOMAIN_STATS_DIRTYRATE_VCPU_PREFIX "%d" VIR_DOMAIN_STATS_DIRTYRATE_VCPU_SUFFIX_MEGABYTES_PER_SECOND,
+ info.rates[i].idx);
}
}
}