diff options
author | Luca Boccassi <bluca@debian.org> | 2024-03-26 23:32:04 +0100 |
---|---|---|
committer | Luca Boccassi <bluca@debian.org> | 2024-03-27 02:27:34 +0100 |
commit | 7addfba9c45af97305a628e98acf684eedb7d510 (patch) | |
tree | bf90b8b1827f937e4ca6f9ad3fb85acbb9ca9b2a /src | |
parent | core: add SoftRebootStartTimestamp (diff) | |
download | systemd-7addfba9c45af97305a628e98acf684eedb7d510.tar.xz systemd-7addfba9c45af97305a628e98acf684eedb7d510.zip |
analyze: show only current times after soft-reboot
The firmware/loader/kernel times are no longer relevant for the startup
sequence on soft-reboot, so use only the userspace timestamps
Diffstat (limited to 'src')
-rw-r--r-- | src/analyze/analyze-time-data.c | 8 | ||||
-rw-r--r-- | src/analyze/analyze-time-data.h | 1 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/analyze/analyze-time-data.c b/src/analyze/analyze-time-data.c index 741cab33b6..7f8bcae999 100644 --- a/src/analyze/analyze-time-data.c +++ b/src/analyze/analyze-time-data.c @@ -38,6 +38,7 @@ int acquire_boot_times(sd_bus *bus, bool require_finished, BootTimes **ret) { { "FinishTimestampMonotonic", "t", NULL, offsetof(BootTimes, finish_time) }, { "SecurityStartTimestampMonotonic", "t", NULL, offsetof(BootTimes, security_start_time) }, { "SecurityFinishTimestampMonotonic", "t", NULL, offsetof(BootTimes, security_finish_time) }, + { "SoftRebootStartTimestampMonotonic", "t", NULL, offsetof(BootTimes, softreboot_start_time) }, { "GeneratorsStartTimestampMonotonic", "t", NULL, offsetof(BootTimes, generators_start_time) }, { "GeneratorsFinishTimestampMonotonic", "t", NULL, offsetof(BootTimes, generators_finish_time) }, { "UnitsLoadStartTimestampMonotonic", "t", NULL, offsetof(BootTimes, unitsload_start_time) }, @@ -81,7 +82,10 @@ int acquire_boot_times(sd_bus *bus, bool require_finished, BootTimes **ret) { if (require_finished && times.finish_time <= 0) return log_not_finished(times.finish_time); - if (arg_runtime_scope == RUNTIME_SCOPE_SYSTEM && times.security_start_time > 0) { + if (arg_runtime_scope == RUNTIME_SCOPE_SYSTEM && times.softreboot_start_time > 0) + /* On soft-reboot ignore kernel/firmware/initrd times as they are from the previous boot */ + times.firmware_time = times.loader_time = times.kernel_time = times.initrd_time = 0; + else if (arg_runtime_scope == RUNTIME_SCOPE_SYSTEM && times.security_start_time > 0) { /* security_start_time is set when systemd is not running under container environment. */ if (times.initrd_time > 0) times.kernel_done_time = times.initrd_time; @@ -183,6 +187,8 @@ int pretty_boot_time(sd_bus *bus, char **ret) { return log_oom(); if (timestamp_is_set(t->initrd_time) && !strextend(&text, FORMAT_TIMESPAN(t->userspace_time - t->initrd_time, USEC_PER_MSEC), " (initrd) + ")) return log_oom(); + if (timestamp_is_set(t->softreboot_start_time) && !strextend(&text, FORMAT_TIMESPAN(t->userspace_time - t->softreboot_start_time, USEC_PER_MSEC), " (soft reboot) + ")) + return log_oom(); if (!strextend(&text, FORMAT_TIMESPAN(t->finish_time - t->userspace_time, USEC_PER_MSEC), " (userspace) ")) return log_oom(); diff --git a/src/analyze/analyze-time-data.h b/src/analyze/analyze-time-data.h index 9049d876b2..72b1ede402 100644 --- a/src/analyze/analyze-time-data.h +++ b/src/analyze/analyze-time-data.h @@ -14,6 +14,7 @@ typedef struct BootTimes { usec_t initrd_time; usec_t userspace_time; usec_t finish_time; + usec_t softreboot_start_time; usec_t security_start_time; usec_t security_finish_time; usec_t generators_start_time; |