From 5ad096b3f1331b175340129a8c9a5a9d711e5415 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sun, 1 Mar 2015 16:24:19 +0100 Subject: core: expose consumed CPU time per unit This adds support for showing the accumulated consumed CPU time per-unit in the "systemctl status" output. The property is also readable via the bus. --- src/core/socket.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/core/socket.c') diff --git a/src/core/socket.c b/src/core/socket.c index 7d052f2ef..9606ac2b1 100644 --- a/src/core/socket.c +++ b/src/core/socket.c @@ -1392,7 +1392,11 @@ static int socket_spawn(Socket *s, ExecCommand *c, pid_t *_pid) { assert(c); assert(_pid); - unit_realize_cgroup(UNIT(s)); + (void) unit_realize_cgroup(UNIT(s)); + if (s->reset_cpu_usage) { + (void) unit_reset_cpu_usage(UNIT(s)); + s->reset_cpu_usage = false; + } r = unit_setup_exec_runtime(UNIT(s)); if (r < 0) @@ -1948,6 +1952,8 @@ static int socket_start(Unit *u) { assert(s->state == SOCKET_DEAD || s->state == SOCKET_FAILED); s->result = SOCKET_SUCCESS; + s->reset_cpu_usage = true; + socket_enter_start_pre(s); return 1; -- cgit v1.2.3