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