@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly t FinishTimestampMonotonic = ...;
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
- readonly t SoftRebootStartTimestamp = ...;
+ readonly t ShutdownStartTimestamp = ...;
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
- readonly t SoftRebootStartTimestampMonotonic = ...;
+ readonly t ShutdownStartTimestampMonotonic = ...;
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly t SecurityStartTimestamp = ...;
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
<variablelist class="dbus-property" generated="True" extra-ref="FinishTimestampMonotonic"/>
- <variablelist class="dbus-property" generated="True" extra-ref="SoftRebootStartTimestamp"/>
+ <variablelist class="dbus-property" generated="True" extra-ref="ShutdownStartTimestamp"/>
- <variablelist class="dbus-property" generated="True" extra-ref="SoftRebootStartTimestampMonotonic"/>
+ <variablelist class="dbus-property" generated="True" extra-ref="ShutdownStartTimestampMonotonic"/>
<variablelist class="dbus-property" generated="True" extra-ref="SecurityStartTimestamp"/>
<varname>InitRDTimestamp</varname>, <varname>InitRDTimestampMonotonic</varname>,
<varname>UserspaceTimestamp</varname>, <varname>UserspaceTimestampMonotonic</varname>,
<varname>FinishTimestamp</varname>, <varname>FinishTimestampMonotonic</varname>,
- <varname>SoftRebootStartTimestamp</varname> and <varname>SoftRebootStartTimestampMonotonic</varname>
+ <varname>ShutdownStartTimestamp</varname> and <varname>ShutdownStartTimestampMonotonic</varname>
encode <constant>CLOCK_REALTIME</constant> and <constant>CLOCK_MONOTONIC</constant> microsecond
timestamps taken when the firmware first began execution, when the boot loader first began execution,
when the kernel first began execution, when the initrd first began execution, when the main systemd
- instance began execution, when all queued startup jobs finished execution and finally, when a
- <citerefentry><refentrytitle>systemd-soft-reboot.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
+ instance began execution, when all queued startup jobs finished execution and finally, when a shutdown
operation first began execution. These values are useful for determining boot-time performance. Note
that as monotonic time begins with the kernel startup, the <varname>KernelTimestampMonotonic</varname>
timestamp will always be 0 and <varname>FirmwareTimestampMonotonic</varname> and
<function>SoftReboot()</function>, and
<function>DumpUnitFileDescriptorStore()</function> were added in version 254.</para>
<para><function>StartAuxiliaryScope()</function>,
- <varname>SoftRebootStartTimestamp</varname>,
- <varname>SoftRebootStartTimestampMonotonic</varname> and
+ <varname>ShutdownStartTimestamp</varname>,
+ <varname>ShutdownStartTimestampMonotonic</varname> and
<varname>SoftRebootsCount</varname> were added in version 256.</para>
</refsect2>
<refsect2>
strempty(host->virtualization));
svg("<g transform=\"translate(%.3f,100)\">\n", 20.0 + (SCALE_X * boot->firmware_time));
- if (timestamp_is_set(boot->softreboot_start_time))
+ if (boot->soft_reboots_count > 0)
svg_graph_box(m, 0, boot->finish_time);
else
svg_graph_box(m, -(double) boot->firmware_time, boot->finish_time);
svg_text(true, boot->initrd_time, y, "initrd");
y++;
}
- if (timestamp_is_set(boot->softreboot_start_time)) {
+ if (boot->soft_reboots_count > 0) {
svg_bar("soft-reboot", 0, boot->userspace_time, y);
svg_text(true, 0, y, "soft-reboot");
y++;
{ "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) },
+ { "ShutdownStartTimestampMonotonic", "t", NULL, offsetof(BootTimes, shutdown_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) },
if (require_finished && times.finish_time <= 0)
return log_not_finished(times.finish_time);
- if (arg_runtime_scope == RUNTIME_SCOPE_SYSTEM && timestamp_is_set(times.softreboot_start_time)) {
+ if (arg_runtime_scope == RUNTIME_SCOPE_SYSTEM && times.soft_reboots_count > 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 =
times.initrd_security_start_time = times.initrd_security_finish_time =
times.initrd_generators_start_time = times.initrd_generators_finish_time =
times.initrd_unitsload_start_time = times.initrd_unitsload_finish_time = 0;
- times.reverse_offset = times.softreboot_start_time;
+ times.reverse_offset = times.shutdown_start_time;
/* Clamp all timestamps to avoid showing huge graphs */
if (timestamp_is_set(times.finish_time))
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) && strextendf(&text, "%s (soft reboot #%" PRIu64 ") + ", FORMAT_TIMESPAN(t->userspace_time, USEC_PER_MSEC), t->soft_reboots_count) < 0)
+ if (t->soft_reboots_count > 0 && strextendf(&text, "%s (soft reboot #%" PRIu64 ") + ", FORMAT_TIMESPAN(t->userspace_time, USEC_PER_MSEC), t->soft_reboots_count) < 0)
return log_oom();
if (!strextend(&text, FORMAT_TIMESPAN(t->finish_time - t->userspace_time, USEC_PER_MSEC), " (userspace) "))
usec_t base;
/* On soft-reboot times are clamped to avoid showing huge graphs */
- if (timestamp_is_set(t->softreboot_start_time) && timestamp_is_set(t->userspace_time))
+ if (t->soft_reboots_count > 0 && timestamp_is_set(t->userspace_time))
base = t->userspace_time + t->reverse_offset;
else
base = timestamp_is_set(t->userspace_time) ? t->userspace_time : t->reverse_offset;
u.id, bus_error_message(&error, r));
/* Activated in the previous soft-reboot iteration? Ignore it, we want new activations */
- if ((t->activated > 0 && t->activated < boot_times->softreboot_start_time) ||
- (t->activating > 0 && t->activating < boot_times->softreboot_start_time))
+ if ((t->activated > 0 && t->activated < boot_times->shutdown_start_time) ||
+ (t->activating > 0 && t->activating < boot_times->shutdown_start_time))
continue;
subtract_timestamp(&t->activating, boot_times->reverse_offset);
subtract_timestamp(&t->activated, boot_times->reverse_offset);
/* If the last deactivation was in the previous soft-reboot, ignore it */
- if (timestamp_is_set(boot_times->softreboot_start_time)) {
+ if (boot_times->soft_reboots_count > 0) {
if (t->deactivating < boot_times->reverse_offset)
t->deactivating = 0;
else
usec_t initrd_time;
usec_t userspace_time;
usec_t finish_time;
- usec_t softreboot_start_time;
+ usec_t shutdown_start_time;
usec_t security_start_time;
usec_t security_finish_time;
usec_t generators_start_time;
BUS_PROPERTY_DUAL_TIMESTAMP("InitRDTimestamp", offsetof(Manager, timestamps[MANAGER_TIMESTAMP_INITRD]), SD_BUS_VTABLE_PROPERTY_CONST),
BUS_PROPERTY_DUAL_TIMESTAMP("UserspaceTimestamp", offsetof(Manager, timestamps[MANAGER_TIMESTAMP_USERSPACE]), SD_BUS_VTABLE_PROPERTY_CONST),
BUS_PROPERTY_DUAL_TIMESTAMP("FinishTimestamp", offsetof(Manager, timestamps[MANAGER_TIMESTAMP_FINISH]), SD_BUS_VTABLE_PROPERTY_CONST),
- BUS_PROPERTY_DUAL_TIMESTAMP("SoftRebootStartTimestamp", offsetof(Manager, timestamps[MANAGER_TIMESTAMP_SOFTREBOOT_START]), SD_BUS_VTABLE_PROPERTY_CONST),
+ BUS_PROPERTY_DUAL_TIMESTAMP("ShutdownStartTimestamp", offsetof(Manager, timestamps[MANAGER_TIMESTAMP_SHUTDOWN_START]), SD_BUS_VTABLE_PROPERTY_CONST),
BUS_PROPERTY_DUAL_TIMESTAMP("SecurityStartTimestamp", offsetof(Manager, timestamps[MANAGER_TIMESTAMP_SECURITY_START]), SD_BUS_VTABLE_PROPERTY_CONST),
BUS_PROPERTY_DUAL_TIMESTAMP("SecurityFinishTimestamp", offsetof(Manager, timestamps[MANAGER_TIMESTAMP_SECURITY_FINISH]), SD_BUS_VTABLE_PROPERTY_CONST),
BUS_PROPERTY_DUAL_TIMESTAMP("GeneratorsStartTimestamp", offsetof(Manager, timestamps[MANAGER_TIMESTAMP_GENERATORS_START]), SD_BUS_VTABLE_PROPERTY_CONST),
if (j->type != JOB_START)
return;
- if (!MANAGER_IS_SYSTEM(j->unit->manager))
+ if (!unit_has_name(j->unit, SPECIAL_SHUTDOWN_TARGET))
return;
- if (!unit_has_name(j->unit, SPECIAL_SHUTDOWN_TARGET))
+ /* This is the very beginning of the shutdown phase, so take the timestamp here */
+ dual_timestamp_now(ASSERT_PTR(j->manager)->timestamps + MANAGER_TIMESTAMP_SHUTDOWN_START);
+
+ if (!MANAGER_IS_SYSTEM(j->manager))
return;
/* In case messages on console has been disabled on boot */
"MESSAGE_ID=" SD_MESSAGE_CORE_MAINLOOP_FAILED_STR);
}
+ /* Ensure shutdown timestamp is taken even when bypassing the job engine */
+ if (IN_SET(objective,
+ MANAGER_SOFT_REBOOT,
+ MANAGER_REBOOT,
+ MANAGER_KEXEC,
+ MANAGER_HALT,
+ MANAGER_POWEROFF) &&
+ !dual_timestamp_is_set(m->timestamps + MANAGER_TIMESTAMP_SHUTDOWN_START))
+ dual_timestamp_now(m->timestamps + MANAGER_TIMESTAMP_SHUTDOWN_START);
+
switch (objective) {
case MANAGER_RELOAD: {
manager_send_reloading(m);
manager_set_switching_root(m, true);
- dual_timestamp_now(m->timestamps + MANAGER_TIMESTAMP_SOFTREBOOT_START);
-
r = prepare_reexecute(m, &arg_serialization, ret_fds, /* switching_root= */ true);
if (r < 0) {
*ret_error_message = "Failed to prepare for reexecution";
if (MANAGER_IS_TEST_RUN(m))
return;
- if (MANAGER_IS_SYSTEM(m) && dual_timestamp_is_set(&m->timestamps[MANAGER_TIMESTAMP_SOFTREBOOT_START])) {
+ if (MANAGER_IS_SYSTEM(m) && m->soft_reboots_count > 0) {
/* The soft-reboot case, where we only report data for the last reboot */
firmware_usec = loader_usec = initrd_usec = kernel_usec = 0;
- total_usec = userspace_usec = usec_sub_unsigned(m->timestamps[MANAGER_TIMESTAMP_FINISH].monotonic, m->timestamps[MANAGER_TIMESTAMP_SOFTREBOOT_START].monotonic);
+ total_usec = userspace_usec = usec_sub_unsigned(m->timestamps[MANAGER_TIMESTAMP_FINISH].monotonic, m->timestamps[MANAGER_TIMESTAMP_SHUTDOWN_START].monotonic);
log_struct(LOG_INFO,
"MESSAGE_ID=" SD_MESSAGE_STARTUP_FINISHED_STR,
[MANAGER_TIMESTAMP_INITRD] = "initrd",
[MANAGER_TIMESTAMP_USERSPACE] = "userspace",
[MANAGER_TIMESTAMP_FINISH] = "finish",
- [MANAGER_TIMESTAMP_SOFTREBOOT_START] = "softreboot-start",
[MANAGER_TIMESTAMP_SECURITY_START] = "security-start",
[MANAGER_TIMESTAMP_SECURITY_FINISH] = "security-finish",
[MANAGER_TIMESTAMP_GENERATORS_START] = "generators-start",
[MANAGER_TIMESTAMP_INITRD_GENERATORS_FINISH] = "initrd-generators-finish",
[MANAGER_TIMESTAMP_INITRD_UNITS_LOAD_START] = "initrd-units-load-start",
[MANAGER_TIMESTAMP_INITRD_UNITS_LOAD_FINISH] = "initrd-units-load-finish",
+ [MANAGER_TIMESTAMP_SHUTDOWN_START] = "shutdown-start",
};
DEFINE_STRING_TABLE_LOOKUP(manager_timestamp, ManagerTimestamp);
MANAGER_TIMESTAMP_INITRD_UNITS_LOAD_START,
MANAGER_TIMESTAMP_INITRD_UNITS_LOAD_FINISH,
- MANAGER_TIMESTAMP_SOFTREBOOT_START,
+ MANAGER_TIMESTAMP_SHUTDOWN_START,
_MANAGER_TIMESTAMP_MAX,
_MANAGER_TIMESTAMP_INVALID = -EINVAL,