summaryrefslogtreecommitdiff
path: root/src/core/cgroup.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2019-03-22 12:16:03 +0100
committerLennart Poettering <lennart@poettering.net>2019-04-12 14:25:44 +0200
commitfbe14fc9a78e03ea4759aa00779d6799609decb6 (patch)
treec1701e6457f42b60274987bfc1b237238c194f83 /src/core/cgroup.h
parent83f18c91d095a437392a0b78f1c7631dcbc0ba5d (diff)
downloadsystemd-fbe14fc9a78e03ea4759aa00779d6799609decb6.tar.gz
croup: expose IO accounting data per unit
This was the last kind of accounting still not exposed on for each unit. Let's fix that. Note that this is a relatively simplistic approach: we don't expose per-device stats, but sum them all up, much like cgtop does. This kind of metric is probably the most interesting for most usecases, and covers the "systemctl status" output best. If we want per-device stats one day we can of course always add that eventually.
Diffstat (limited to 'src/core/cgroup.h')
-rw-r--r--src/core/cgroup.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/core/cgroup.h b/src/core/cgroup.h
index bfb2fa0a53..ad04be30e9 100644
--- a/src/core/cgroup.h
+++ b/src/core/cgroup.h
@@ -135,6 +135,16 @@ typedef enum CGroupIPAccountingMetric {
_CGROUP_IP_ACCOUNTING_METRIC_INVALID = -1,
} CGroupIPAccountingMetric;
+/* Used when querying IO accounting data */
+typedef enum CGroupIOAccountingMetric {
+ CGROUP_IO_READ_BYTES,
+ CGROUP_IO_WRITE_BYTES,
+ CGROUP_IO_READ_OPERATIONS,
+ CGROUP_IO_WRITE_OPERATIONS,
+ _CGROUP_IO_ACCOUNTING_METRIC_MAX,
+ _CGROUP_IO_ACCOUNTING_METRIC_INVALID = -1,
+} CGroupIOAccountingMetric;
+
typedef struct Unit Unit;
typedef struct Manager Manager;
@@ -200,10 +210,12 @@ int unit_synthesize_cgroup_empty_event(Unit *u);
int unit_get_memory_current(Unit *u, uint64_t *ret);
int unit_get_tasks_current(Unit *u, uint64_t *ret);
int unit_get_cpu_usage(Unit *u, nsec_t *ret);
+int unit_get_io_accounting(Unit *u, CGroupIOAccountingMetric metric, bool allow_cache, uint64_t *ret);
int unit_get_ip_accounting(Unit *u, CGroupIPAccountingMetric metric, uint64_t *ret);
int unit_reset_cpu_accounting(Unit *u);
int unit_reset_ip_accounting(Unit *u);
+int unit_reset_io_accounting(Unit *u);
int unit_reset_accounting(Unit *u);
#define UNIT_CGROUP_BOOL(u, name) \