cgtop: hook up new /proc based emulation code for root cgroup memory/cpu stats

Let's make this work.
This commit is contained in:
Lennart Poettering 2018-02-09 17:34:31 +01:00
parent a04fcf17ba
commit 744c39ff7e

View file

@ -252,7 +252,11 @@ static int process(
uint64_t new_usage;
nsec_t timestamp;
if (all_unified) {
if (is_root_cgroup(path)) {
r = procfs_cpu_get_usage(&new_usage);
if (r < 0)
return r;
} else if (all_unified) {
const char *keys[] = { "usage_usec", NULL };
_cleanup_free_ char *val = NULL;
@ -310,6 +314,12 @@ static int process(
g->cpu_iteration = iteration;
} else if (streq(controller, "memory")) {
if (is_root_cgroup(path)) {
r = procfs_memory_get_current(&g->memory);
if (r < 0)
return r;
} else {
_cleanup_free_ char *p = NULL, *v = NULL;
if (all_unified)
@ -328,6 +338,7 @@ static int process(
r = safe_atou64(v, &g->memory);
if (r < 0)
return r;
}
if (g->memory > 0)
g->memory_valid = true;