summaryrefslogtreecommitdiff
path: root/src/manager.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-09-21 04:14:38 +0200
committerLennart Poettering <lennart@poettering.net>2010-09-21 04:14:38 +0200
commitb0c918b97f1abb160d8df2b94deb03efcb4fcf8f (patch)
tree5332ec267b9722d39c12e7324cf80d8e61bcef15 /src/manager.c
parente409f87570a87009d023e1ba97263445241b84d3 (diff)
manager: measure startup times
Diffstat (limited to 'src/manager.c')
-rw-r--r--src/manager.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/manager.c b/src/manager.c
index 31dd44caa7..1be2bfdfc5 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -2173,6 +2173,8 @@ int manager_loop(Manager *m) {
set_free_free(m->unit_path_cache);
m->unit_path_cache = NULL;
+ manager_check_finished(m);
+
/* There might still be some zombies hanging around from
* before we were exec()'ed. Leat's reap them */
if ((r = manager_dispatch_sigchld(m)) < 0)
@@ -2598,6 +2600,34 @@ bool manager_unit_pending_inactive(Manager *m, const char *name) {
return unit_pending_inactive(u);
}
+void manager_check_finished(Manager *m) {
+ char userspace[FORMAT_TIMESPAN_MAX], kernel[FORMAT_TIMESPAN_MAX], sum[FORMAT_TIMESPAN_MAX];
+
+ assert(m);
+
+ if (dual_timestamp_is_set(&m->finish_timestamp))
+ return;
+
+ if (hashmap_size(m->jobs) > 0)
+ return;
+
+ dual_timestamp_get(&m->finish_timestamp);
+
+ if (m->running_as == MANAGER_SYSTEM)
+ log_info("Startup finished in %s (kernel) + %s (userspace) = %s.",
+ format_timespan(kernel, sizeof(kernel),
+ m->startup_timestamp.monotonic),
+ format_timespan(userspace, sizeof(userspace),
+ m->finish_timestamp.monotonic - m->startup_timestamp.monotonic),
+ format_timespan(sum, sizeof(sum),
+ m->finish_timestamp.monotonic));
+ else
+ log_debug("Startup finished in %s.",
+ format_timespan(userspace, sizeof(userspace),
+ m->finish_timestamp.monotonic - m->startup_timestamp.monotonic));
+
+}
+
static const char* const manager_running_as_table[_MANAGER_RUNNING_AS_MAX] = {
[MANAGER_SYSTEM] = "system",
[MANAGER_SESSION] = "session"