diff options
author | Kirill Marinushkin <kmarinushkin@de.adit-jv.com> | 2018-08-06 11:27:33 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-08-06 16:13:53 +0200 |
commit | 02be0ccad2fbf36a585b0374bf220e5477983cf2 (patch) | |
tree | c8687ec2bc41d25b96dcd095154066aa2bb00d3c /src/analyze | |
parent | analyze: set reverse_offset for containerized system (diff) | |
download | systemd-02be0ccad2fbf36a585b0374bf220e5477983cf2.tar.xz systemd-02be0ccad2fbf36a585b0374bf220e5477983cf2.zip |
analyze: fix condition for pretty printing kernel time
On target boards without RTC, `t->kernel_time` is 0 or 1 usec.
`systemd-analyze` reads this value over D-Bus from
`org.freedesktop.systemd1.Manager`, property `KernelTimestamp`.
The issue is: if `t->kernel_time` is 0, `systemd-analyze` does not print
the kernel time:
~~~~
$ systemd-analyze
Startup finished in 1.860s (userspace) = 5.957s
~~~~
This commit fixes the misbehaviour:
~~~~
$ systemd-analyze
Startup finished in 3.866s (kernel) + 2.015s (userspace) = 5.881s
~~~~
Fixes #7721.
v2: fixes one more condition (by Yu Watanabe <watanabe.yu+github@gmail.com>)
v3: fixes one more condition (by Kirill Marinushkin <kmarinushkin@de.adit-jv.com>)
Diffstat (limited to 'src/analyze')
-rw-r--r-- | src/analyze/analyze.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/analyze/analyze.c b/src/analyze/analyze.c index a2f85a6447..1becf759c3 100644 --- a/src/analyze/analyze.c +++ b/src/analyze/analyze.c @@ -528,13 +528,13 @@ static int pretty_boot_time(sd_bus *bus, char **_buf) { size = strpcpyf(&ptr, size, "%s (firmware) + ", format_timespan(ts, sizeof(ts), t->firmware_time - t->loader_time, USEC_PER_MSEC)); if (t->loader_time > 0) size = strpcpyf(&ptr, size, "%s (loader) + ", format_timespan(ts, sizeof(ts), t->loader_time, USEC_PER_MSEC)); - if (t->kernel_time > 0) + if (t->kernel_done_time > 0) size = strpcpyf(&ptr, size, "%s (kernel) + ", format_timespan(ts, sizeof(ts), t->kernel_done_time, USEC_PER_MSEC)); if (t->initrd_time > 0) size = strpcpyf(&ptr, size, "%s (initrd) + ", format_timespan(ts, sizeof(ts), t->userspace_time - t->initrd_time, USEC_PER_MSEC)); size = strpcpyf(&ptr, size, "%s (userspace) ", format_timespan(ts, sizeof(ts), t->finish_time - t->userspace_time, USEC_PER_MSEC)); - if (t->kernel_time > 0) + if (t->kernel_done_time > 0) strpcpyf(&ptr, size, "= %s ", format_timespan(ts, sizeof(ts), t->firmware_time + t->finish_time, USEC_PER_MSEC)); if (unit_id && activated_time > 0 && activated_time != USEC_INFINITY) { @@ -650,7 +650,7 @@ static int analyze_plot(int argc, char *argv[], void *userdata) { } if (boot->initrd_time > 0) m++; - if (boot->kernel_time > 0) + if (boot->kernel_done_time > 0) m++; for (u = times; u->has_data; u++) { @@ -750,7 +750,7 @@ static int analyze_plot(int argc, char *argv[], void *userdata) { svg_text(true, -(double) boot->loader_time, y, "loader"); y++; } - if (boot->kernel_time > 0) { + if (boot->kernel_done_time > 0) { svg_bar("kernel", 0, boot->kernel_done_time, y); svg_text(true, 0, y, "kernel"); y++; |