/* Current balloon value (in KB). */
VIR_DOMAIN_MEMORY_STAT_ACTUAL_BALLOON = 6,
+
+ /* Resident Set Size of the process running the domain. This value
+ * is in kB */
+ VIR_DOMAIN_MEMORY_STAT_RSS = 7,
+
/*
* The number of statistics supported by this version of the interface.
* To add new statistics, add them to the enum and increase this value.
*/
- VIR_DOMAIN_MEMORY_STAT_NR = 7,
+ VIR_DOMAIN_MEMORY_STAT_NR = 8,
#ifdef VIR_ENUM_SENTINELS
VIR_DOMAIN_MEMORY_STAT_LAST = VIR_DOMAIN_MEMORY_STAT_NR
{
struct qemud_driver *driver = dom->conn->privateData;
virDomainObjPtr vm;
- unsigned int ret = -1;
+ int ret = -1;
virCheckFlags(0, -1);
if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0)
goto cleanup;
- if (virDomainObjIsActive(vm)) {
+ if (!virDomainObjIsActive(vm)) {
+ qemuReportError(VIR_ERR_OPERATION_INVALID,
+ "%s", _("domain is not running"));
+ } else {
qemuDomainObjPrivatePtr priv = vm->privateData;
qemuDomainObjEnterMonitor(driver, vm);
ret = qemuMonitorGetMemoryStats(priv->mon, stats, nr_stats);
qemuDomainObjExitMonitor(driver, vm);
- } else {
- qemuReportError(VIR_ERR_OPERATION_INVALID,
- "%s", _("domain is not running"));
+
+ if (ret >= 0 && ret < nr_stats) {
+ long rss;
+ if (qemudGetProcessInfo(NULL, NULL, &rss, vm->pid, 0) < 0) {
+ qemuReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("cannot get RSS for domain"));
+ } else {
+ stats[ret].tag = VIR_DOMAIN_MEMORY_STAT_RSS;
+ stats[ret].val = rss;
+ ret++;
+ }
+
+ }
}
if (qemuDomainObjEndJob(driver, vm) == 0)
vshPrint (ctl, "available %llu\n", stats[i].val);
if (stats[i].tag == VIR_DOMAIN_MEMORY_STAT_ACTUAL_BALLOON)
vshPrint (ctl, "actual %llu\n", stats[i].val);
+ if (stats[i].tag == VIR_DOMAIN_MEMORY_STAT_RSS)
+ vshPrint (ctl, "rss %llu\n", stats[i].val);
}
virDomainFree(dom);