mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-30 09:53:10 +00:00
add interface virCgroupGetMemSwapUsage
virCgroupGetMemSwapUsage is used to get container's swap usage, with this interface,we can get swap usage in fuse filesystem. Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
This commit is contained in:
parent
2a596dac5e
commit
4d4f371e09
@ -98,6 +98,7 @@ virCgroupGetCpuacctUsage;
|
||||
virCgroupGetCpusetCpus;
|
||||
virCgroupGetCpusetMems;
|
||||
virCgroupGetFreezerState;
|
||||
virCgroupGetMemSwapUsage;
|
||||
virCgroupGetMemSwapHardLimit;
|
||||
virCgroupGetMemoryHardLimit;
|
||||
virCgroupGetMemorySoftLimit;
|
||||
|
@ -1370,6 +1370,26 @@ int virCgroupGetMemSwapHardLimit(virCgroupPtr group, unsigned long long *kb)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* virCgroupGetMemSwapUsage:
|
||||
*
|
||||
* @group: The cgroup to get mem+swap usage for
|
||||
* @kb: The mem+swap amount in kilobytes
|
||||
*
|
||||
* Returns: 0 on success
|
||||
*/
|
||||
int virCgroupGetMemSwapUsage(virCgroupPtr group, unsigned long long *kb)
|
||||
{
|
||||
long long unsigned int usage_in_bytes;
|
||||
int ret;
|
||||
ret = virCgroupGetValueU64(group,
|
||||
VIR_CGROUP_CONTROLLER_MEMORY,
|
||||
"memory.memsw.usage_in_bytes", &usage_in_bytes);
|
||||
if (ret == 0)
|
||||
*kb = usage_in_bytes >> 10;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* virCgroupSetCpusetMems:
|
||||
*
|
||||
|
@ -92,6 +92,7 @@ int virCgroupSetMemorySoftLimit(virCgroupPtr group, unsigned long long kb);
|
||||
int virCgroupGetMemorySoftLimit(virCgroupPtr group, unsigned long long *kb);
|
||||
int virCgroupSetMemSwapHardLimit(virCgroupPtr group, unsigned long long kb);
|
||||
int virCgroupGetMemSwapHardLimit(virCgroupPtr group, unsigned long long *kb);
|
||||
int virCgroupGetMemSwapUsage(virCgroupPtr group, unsigned long long *kb);
|
||||
|
||||
enum {
|
||||
VIR_CGROUP_DEVICE_READ = 1,
|
||||
|
Loading…
Reference in New Issue
Block a user