diff options
Diffstat (limited to 'src/cgtop/cgtop.c')
-rw-r--r-- | src/cgtop/cgtop.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/cgtop/cgtop.c b/src/cgtop/cgtop.c index 45c050c9c3..a1c0f48c89 100644 --- a/src/cgtop/cgtop.c +++ b/src/cgtop/cgtop.c @@ -133,12 +133,16 @@ static int process( Group **ret) { Group *g; - int r; + int r, all_unified; assert(controller); assert(path); assert(a); + all_unified = cg_all_unified(); + if (all_unified < 0) + return all_unified; + g = hashmap_get(a, path); if (!g) { g = hashmap_get(b, path); @@ -214,7 +218,7 @@ static int process( uint64_t new_usage; nsec_t timestamp; - if (cg_all_unified()) { + if (all_unified) { const char *keys[] = { "usage_usec", NULL }; _cleanup_free_ char *val = NULL; @@ -274,10 +278,10 @@ static int process( } else if (streq(controller, "memory")) { _cleanup_free_ char *p = NULL, *v = NULL; - if (!cg_all_unified()) - r = cg_get_path(controller, path, "memory.usage_in_bytes", &p); - else + if (all_unified) r = cg_get_path(controller, path, "memory.current", &p); + else + r = cg_get_path(controller, path, "memory.usage_in_bytes", &p); if (r < 0) return r; @@ -294,14 +298,14 @@ static int process( if (g->memory > 0) g->memory_valid = true; - } else if ((streq(controller, "io") && cg_all_unified()) || - (streq(controller, "blkio") && !cg_all_unified())) { + } else if ((streq(controller, "io") && all_unified) || + (streq(controller, "blkio") && !all_unified)) { _cleanup_fclose_ FILE *f = NULL; _cleanup_free_ char *p = NULL; uint64_t wr = 0, rd = 0; nsec_t timestamp; - r = cg_get_path(controller, path, cg_all_unified() ? "io.stat" : "blkio.io_service_bytes", &p); + r = cg_get_path(controller, path, all_unified ? "io.stat" : "blkio.io_service_bytes", &p); if (r < 0) return r; @@ -324,7 +328,7 @@ static int process( l += strcspn(l, WHITESPACE); l += strspn(l, WHITESPACE); - if (cg_all_unified()) { + if (all_unified) { while (!isempty(l)) { if (sscanf(l, "rbytes=%" SCNu64, &k)) rd += k; |