mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 19:45:21 +00:00
Added RSS reporting
Added RSS information gathering into qemuMemoryStats into qemu driver and the reporting into virsh dommemstat.
This commit is contained in:
parent
350d6ccb91
commit
3d93706d0d
@ -884,11 +884,16 @@ typedef enum {
|
|||||||
|
|
||||||
/* Current balloon value (in KB). */
|
/* Current balloon value (in KB). */
|
||||||
VIR_DOMAIN_MEMORY_STAT_ACTUAL_BALLOON = 6,
|
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.
|
* The number of statistics supported by this version of the interface.
|
||||||
* To add new statistics, add them to the enum and increase this value.
|
* 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
|
#ifdef VIR_ENUM_SENTINELS
|
||||||
VIR_DOMAIN_MEMORY_STAT_LAST = VIR_DOMAIN_MEMORY_STAT_NR
|
VIR_DOMAIN_MEMORY_STAT_LAST = VIR_DOMAIN_MEMORY_STAT_NR
|
||||||
|
@ -8035,7 +8035,7 @@ qemudDomainMemoryStats (virDomainPtr dom,
|
|||||||
{
|
{
|
||||||
struct qemud_driver *driver = dom->conn->privateData;
|
struct qemud_driver *driver = dom->conn->privateData;
|
||||||
virDomainObjPtr vm;
|
virDomainObjPtr vm;
|
||||||
unsigned int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
virCheckFlags(0, -1);
|
virCheckFlags(0, -1);
|
||||||
|
|
||||||
@ -8054,14 +8054,27 @@ qemudDomainMemoryStats (virDomainPtr dom,
|
|||||||
if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0)
|
if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virDomainObjIsActive(vm)) {
|
if (!virDomainObjIsActive(vm)) {
|
||||||
|
qemuReportError(VIR_ERR_OPERATION_INVALID,
|
||||||
|
"%s", _("domain is not running"));
|
||||||
|
} else {
|
||||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||||
qemuDomainObjEnterMonitor(driver, vm);
|
qemuDomainObjEnterMonitor(driver, vm);
|
||||||
ret = qemuMonitorGetMemoryStats(priv->mon, stats, nr_stats);
|
ret = qemuMonitorGetMemoryStats(priv->mon, stats, nr_stats);
|
||||||
qemuDomainObjExitMonitor(driver, vm);
|
qemuDomainObjExitMonitor(driver, vm);
|
||||||
} else {
|
|
||||||
qemuReportError(VIR_ERR_OPERATION_INVALID,
|
if (ret >= 0 && ret < nr_stats) {
|
||||||
"%s", _("domain is not running"));
|
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)
|
if (qemuDomainObjEndJob(driver, vm) == 0)
|
||||||
|
@ -2052,6 +2052,8 @@ cmdDomMemStat(vshControl *ctl, const vshCmd *cmd)
|
|||||||
vshPrint (ctl, "available %llu\n", stats[i].val);
|
vshPrint (ctl, "available %llu\n", stats[i].val);
|
||||||
if (stats[i].tag == VIR_DOMAIN_MEMORY_STAT_ACTUAL_BALLOON)
|
if (stats[i].tag == VIR_DOMAIN_MEMORY_STAT_ACTUAL_BALLOON)
|
||||||
vshPrint (ctl, "actual %llu\n", stats[i].val);
|
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);
|
virDomainFree(dom);
|
||||||
|
Loading…
Reference in New Issue
Block a user