diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2019-07-04 19:12:03 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2019-07-04 22:52:25 +0200 |
commit | 3454129571c65c60a967b3b48069f5292e516904 (patch) | |
tree | 2e534c48d9b11c99a042a1590202424b32361867 /src/core | |
parent | 1f65fd4926c5b88db770c1b47a0b0a24c2319d12 (diff) | |
download | systemd-3454129571c65c60a967b3b48069f5292e516904.tar.gz systemd-3454129571c65c60a967b3b48069f5292e516904.tar.bz2 systemd-3454129571c65c60a967b3b48069f5292e516904.zip |
pid1: use monotonic timestamp in dump if realtime is not available
$ systemd-analyze dump | head -3
Timestamp firmware: (null)
Timestamp loader: (null)
Timestamp kernel: Mon 2019-07-01 17:21:02 CEST
Since this is a debugging interface, it is OK to change the output format.
The user can infer what "Timestamp firmware: 123.456ms" means.
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/manager.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/core/manager.c b/src/core/manager.c index 3ded0d96a1..4a2f07368a 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -2094,13 +2094,15 @@ void manager_dump(Manager *m, FILE *f, const char *prefix) { assert(f); for (q = 0; q < _MANAGER_TIMESTAMP_MAX; q++) { - char buf[FORMAT_TIMESTAMP_MAX]; + const dual_timestamp *t = m->timestamps + q; + char buf[CONST_MAX(FORMAT_TIMESPAN_MAX, FORMAT_TIMESTAMP_MAX)]; - if (dual_timestamp_is_set(m->timestamps + q)) + if (dual_timestamp_is_set(t)) fprintf(f, "%sTimestamp %s: %s\n", strempty(prefix), manager_timestamp_to_string(q), - format_timestamp(buf, sizeof(buf), m->timestamps[q].realtime)); + timestamp_is_set(t->realtime) ? format_timestamp(buf, sizeof buf, t->realtime) : + format_timespan(buf, sizeof buf, t->monotonic, 1)); } manager_dump_units(m, f, prefix); |