]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/analyze/analyze-time-data.c
core: rename SoftRebootStartTimestamp -> ShutdownStartTimestamp and generalize
[thirdparty/systemd.git] / src / analyze / analyze-time-data.c
index 94f6031893d6141e00ca5b998c50330818580cc8..62e055dda4de7708701b2c6f4e2fe56cab3a0288 100644 (file)
@@ -38,7 +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)         },
+                { "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)          },
@@ -83,13 +83,13 @@ 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 && 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))
@@ -203,7 +203,7 @@ 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) && 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) "))
@@ -217,7 +217,7 @@ int pretty_boot_time(sd_bus *bus, char **ret) {
                 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;
@@ -328,15 +328,15 @@ int acquire_time_data(sd_bus *bus, bool require_finished, UnitTimes **out) {
                                                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