summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/libcgroup.h1
-rw-r--r--src/tools/cgget.c23
2 files changed, 23 insertions, 1 deletions
diff --git a/include/libcgroup.h b/include/libcgroup.h
index ce75d2e..c8f1240 100644
--- a/include/libcgroup.h
+++ b/include/libcgroup.h
@@ -141,6 +141,7 @@ struct cgroup_file_info {
#define CG_NV_MAX 100
#define CG_CONTROLLER_MAX 100
+/* this is NOT ENOUGH for stat variables */
#define CG_VALUE_MAX 100
/* Max number of mounted hierarchies. Event if one controller is mounted per
* hier, it can not exceed CG_CONTROLLER_MAX
diff --git a/src/tools/cgget.c b/src/tools/cgget.c
index 4ca064e..f4feb4f 100644
--- a/src/tools/cgget.c
+++ b/src/tools/cgget.c
@@ -43,7 +43,28 @@ int display_one_record(char *name, struct cgroup_controller *group_controller,
if (mode & MODE_SHOW_NAMES)
printf("%s=", name);
- printf("%s\n", value);
+ if (strcmp(strchr(name, '.')+1, "stat"))
+ printf("%s\n", value);
+
+ else {
+ void *handle;
+ struct cgroup_stat stat;
+
+ cgroup_read_stats_begin(group_controller->name,
+ "/", &handle, &stat);
+ if (ret != 0) {
+ fprintf(stderr, "stats read failed\n");
+ return ret;
+ }
+ printf("%s %s", stat.name, stat.value);
+
+ while ((ret = cgroup_read_stats_next(&handle, &stat)) !=
+ ECGEOF) {
+ printf("\t%s %s", stat.name, stat.value);
+ }
+
+ cgroup_read_stats_end(&handle);
+ }
free(value);
return ret;