chiark / gitweb /
core: expose consumed CPU time per unit
[elogind.git] / src / core / slice.c
index a31e629370e0b68b98349537b8471c30b9520805..0bebdbcbc649591637ed2595f344eae088ee900d 100644 (file)
 ***/
 
 #include <errno.h>
-#include <signal.h>
-#include <unistd.h>
 
 #include "unit.h"
 #include "slice.h"
-#include "load-fragment.h"
 #include "log.h"
 #include "dbus-slice.h"
 #include "special.h"
@@ -184,10 +181,11 @@ static int slice_start(Unit *u) {
         assert(t);
         assert(t->state == SLICE_DEAD);
 
-        unit_realize_cgroup(u);
+        (void) unit_realize_cgroup(u);
+        (void) unit_reset_cpu_usage(u);
 
         slice_set_state(t, SLICE_ACTIVE);
-        return 0;
+        return 1;
 }
 
 static int slice_stop(Unit *u) {
@@ -200,7 +198,7 @@ static int slice_stop(Unit *u) {
          * unit_notify() will do that for us anyway. */
 
         slice_set_state(t, SLICE_DEAD);
-        return 0;
+        return 1;
 }
 
 static int slice_kill(Unit *u, KillWho who, int signo, sd_bus_error *error) {