diff options
-rw-r--r-- | man/org.freedesktop.systemd1.xml | 36 | ||||
-rw-r--r-- | src/core/dbus-manager.c | 1 | ||||
-rw-r--r-- | src/core/main.c | 2 | ||||
-rw-r--r-- | src/core/manager.c | 13 | ||||
-rw-r--r-- | src/core/manager.h | 3 |
5 files changed, 42 insertions, 13 deletions
diff --git a/man/org.freedesktop.systemd1.xml b/man/org.freedesktop.systemd1.xml index 4e43b4ba20..1f30f65bf7 100644 --- a/man/org.freedesktop.systemd1.xml +++ b/man/org.freedesktop.systemd1.xml @@ -340,6 +340,10 @@ node /org/freedesktop/systemd1 { @org.freedesktop.DBus.Property.EmitsChangedSignal("const") readonly t FinishTimestampMonotonic = ...; @org.freedesktop.DBus.Property.EmitsChangedSignal("const") + readonly t SoftRebootStartTimestamp = ...; + @org.freedesktop.DBus.Property.EmitsChangedSignal("const") + readonly t SoftRebootStartTimestampMonotonic = ...; + @org.freedesktop.DBus.Property.EmitsChangedSignal("const") readonly t SecurityStartTimestamp = ...; @org.freedesktop.DBus.Property.EmitsChangedSignal("const") readonly t SecurityStartTimestampMonotonic = ...; @@ -1033,6 +1037,10 @@ node /org/freedesktop/systemd1 { <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="SoftRebootStartTimestampMonotonic"/> + <variablelist class="dbus-property" generated="True" extra-ref="SecurityStartTimestamp"/> <variablelist class="dbus-property" generated="True" extra-ref="SecurityStartTimestampMonotonic"/> @@ -1733,17 +1741,19 @@ node /org/freedesktop/systemd1 { <varname>KernelTimestamp</varname>, <varname>KernelTimestampMonotonic</varname>, <varname>InitRDTimestamp</varname>, <varname>InitRDTimestampMonotonic</varname>, <varname>UserspaceTimestamp</varname>, <varname>UserspaceTimestampMonotonic</varname>, - <varname>FinishTimestamp</varname>, and <varname>FinishTimestampMonotonic</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 and finally, when all queued startup jobs finished 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 <varname>LoaderTimestampMonotonic</varname> are to - be read as negative values. Also, not all fields are always available, depending on the used firmware, - boot loader or initrd implementation. In these cases the respective pairs of timestamps are both 0, - indicating that no data is available.</para> + <varname>FinishTimestamp</varname>, <varname>FinishTimestampMonotonic</varname>, + <varname>SoftRebootStartTimestamp</varname> and <varname>SoftRebootStartTimestampMonotonic</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> + 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 + <varname>LoaderTimestampMonotonic</varname> are to be read as negative values. Also, not all fields + are always available, depending on the used firmware, boot loader or initrd implementation. In these + cases the respective pairs of timestamps are both 0, indicating that no data is available.</para> <para><varname>UnitsLoadTimestamp</varname> and <varname>UnitsLoadTimestampMonotonic</varname> encode <constant>CLOCK_REALTIME</constant> and <constant>CLOCK_MONOTONIC</constant> microseconds timestamps @@ -11982,7 +11992,9 @@ $ gdbus introspect --system --dest org.freedesktop.systemd1 \ <function>QueueSignalUnit()</function>, <function>SoftReboot()</function>, and <function>DumpUnitFileDescriptorStore()</function> were added in version 254.</para> - <para><function>StartAuxiliaryScope()</function> was added in version 256.</para> + <para><function>StartAuxiliaryScope()</function>, + <varname>SoftRebootStartTimestamp</varname> and + <varname>SoftRebootStartTimestampMonotonic</varname> were added in version 256.</para> </refsect2> <refsect2> <title>Unit Objects</title> diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c index 11f93b0c80..e7ad850d35 100644 --- a/src/core/dbus-manager.c +++ b/src/core/dbus-manager.c @@ -3042,6 +3042,7 @@ const sd_bus_vtable bus_manager_vtable[] = { 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("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), diff --git a/src/core/main.c b/src/core/main.c index 1c57cce748..b086122a8c 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -2129,6 +2129,8 @@ static int invoke_main_loop( 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"; diff --git a/src/core/manager.c b/src/core/manager.c index b2d8457790..97e54d68a4 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -3694,7 +3694,17 @@ static void manager_notify_finished(Manager *m) { if (MANAGER_IS_TEST_RUN(m)) return; - if (MANAGER_IS_SYSTEM(m) && detect_container() <= 0) { + if (MANAGER_IS_SYSTEM(m) && dual_timestamp_is_set(&m->timestamps[MANAGER_TIMESTAMP_SOFTREBOOT_START])) { + /* 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 = m->timestamps[MANAGER_TIMESTAMP_FINISH].monotonic - m->timestamps[MANAGER_TIMESTAMP_SOFTREBOOT_START].monotonic; + + log_struct(LOG_INFO, + "MESSAGE_ID=" SD_MESSAGE_STARTUP_FINISHED_STR, + "USERSPACE_USEC="USEC_FMT, userspace_usec, + LOG_MESSAGE("Soft-reboot finished in %s.", + FORMAT_TIMESPAN(total_usec, USEC_PER_MSEC))); + } else if (MANAGER_IS_SYSTEM(m) && detect_container() <= 0) { char buf[FORMAT_TIMESPAN_MAX + STRLEN(" (firmware) + ") + FORMAT_TIMESPAN_MAX + STRLEN(" (loader) + ")] = {}; char *p = buf; @@ -5041,6 +5051,7 @@ static const char *const manager_timestamp_table[_MANAGER_TIMESTAMP_MAX] = { [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", diff --git a/src/core/manager.h b/src/core/manager.h index 4d82c4a6a0..c1782ea5f7 100644 --- a/src/core/manager.h +++ b/src/core/manager.h @@ -120,6 +120,9 @@ typedef enum ManagerTimestamp { MANAGER_TIMESTAMP_INITRD_GENERATORS_FINISH, MANAGER_TIMESTAMP_INITRD_UNITS_LOAD_START, MANAGER_TIMESTAMP_INITRD_UNITS_LOAD_FINISH, + + MANAGER_TIMESTAMP_SOFTREBOOT_START, + _MANAGER_TIMESTAMP_MAX, _MANAGER_TIMESTAMP_INVALID = -EINVAL, } ManagerTimestamp; |