1 /* SPDX-License-Identifier: LGPL-2.1-or-later */ 2 #pragma once 3 4 #include "time-util.h" 5 6 typedef struct BootTimes { 7 usec_t firmware_time; 8 usec_t loader_time; 9 usec_t kernel_time; 10 usec_t kernel_done_time; 11 usec_t initrd_time; 12 usec_t userspace_time; 13 usec_t finish_time; 14 usec_t security_start_time; 15 usec_t security_finish_time; 16 usec_t generators_start_time; 17 usec_t generators_finish_time; 18 usec_t unitsload_start_time; 19 usec_t unitsload_finish_time; 20 usec_t initrd_security_start_time; 21 usec_t initrd_security_finish_time; 22 usec_t initrd_generators_start_time; 23 usec_t initrd_generators_finish_time; 24 usec_t initrd_unitsload_start_time; 25 usec_t initrd_unitsload_finish_time; 26 27 /* 28 * If we're analyzing the user instance, all timestamps will be offset by its own start-up timestamp, 29 * which may be arbitrarily big. With "plot", this causes arbitrarily wide output SVG files which 30 * almost completely consist of empty space. Thus we cancel out this offset. 31 * 32 * This offset is subtracted from times above by acquire_boot_times(), but it still needs to be 33 * subtracted from unit-specific timestamps (so it is stored here for reference). 34 */ 35 usec_t reverse_offset; 36 } BootTimes; 37 38 typedef struct UnitTimes { 39 bool has_data; 40 char *name; 41 usec_t activating; 42 usec_t activated; 43 usec_t deactivated; 44 usec_t deactivating; 45 usec_t time; 46 } UnitTimes; 47 48 int acquire_boot_times(sd_bus *bus, BootTimes **ret); 49 int pretty_boot_time(sd_bus *bus, char **ret); 50 51 UnitTimes* unit_times_free_array(UnitTimes *t); 52 DEFINE_TRIVIAL_CLEANUP_FUNC(UnitTimes*, unit_times_free_array); 53 54 int acquire_time_data(sd_bus *bus, UnitTimes **out); 55