summaryrefslogtreecommitdiff
path: root/src/core/service.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-03-01 16:24:19 +0100
committerLennart Poettering <lennart@poettering.net>2015-03-02 12:15:25 +0100
commit5ad096b3f1331b175340129a8c9a5a9d711e5415 (patch)
tree41896760dde9b0ca2d45d04484c4a2308a600b0e /src/core/service.c
parent606303a93ea52a70ebba55bb3152820e630f2164 (diff)
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.
Diffstat (limited to 'src/core/service.c')
-rw-r--r--src/core/service.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/core/service.c b/src/core/service.c
index c7b35050bd..a89ff3f96c 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -1057,7 +1057,11 @@ static int service_spawn(
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)
@@ -1828,6 +1832,7 @@ static int service_start(Unit *u) {
s->main_pid_known = false;
s->main_pid_alien = false;
s->forbid_restart = false;
+ s->reset_cpu_usage = true;
free(s->status_text);
s->status_text = NULL;