mirror of
https://github.com/Dasharo/systemd.git
synced 2026-03-06 15:02:31 -08:00
execute: make ExecStatus dump more useful by showing passed time
Let's show the runtimes of our commands and preparations for them. It's actually quite interesting, we sometimes are irritatingly slow with our handoffs.
This commit is contained in:
@@ -1877,21 +1877,42 @@ void exec_status_dump(const ExecStatus *s, FILE *f, const char *prefix) {
|
||||
if (dual_timestamp_is_set(&s->start_timestamp))
|
||||
fprintf(f,
|
||||
"%sStart Timestamp: %s\n",
|
||||
prefix, FORMAT_TIMESTAMP(s->start_timestamp.realtime));
|
||||
prefix, FORMAT_TIMESTAMP_STYLE(s->start_timestamp.realtime, TIMESTAMP_US));
|
||||
|
||||
if (dual_timestamp_is_set(&s->handoff_timestamp))
|
||||
if (dual_timestamp_is_set(&s->handoff_timestamp) && dual_timestamp_is_set(&s->start_timestamp) &&
|
||||
s->handoff_timestamp.monotonic > s->start_timestamp.monotonic)
|
||||
fprintf(f,
|
||||
"%sHandoff Timestamp: %s since start\n",
|
||||
prefix,
|
||||
FORMAT_TIMESPAN(usec_sub_unsigned(s->handoff_timestamp.monotonic, s->start_timestamp.monotonic), 1));
|
||||
else
|
||||
fprintf(f,
|
||||
"%sHandoff Timestamp: %s\n",
|
||||
prefix, FORMAT_TIMESTAMP(s->handoff_timestamp.realtime));
|
||||
prefix, FORMAT_TIMESTAMP_STYLE(s->handoff_timestamp.realtime, TIMESTAMP_US));
|
||||
|
||||
if (dual_timestamp_is_set(&s->exit_timestamp)) {
|
||||
|
||||
if (dual_timestamp_is_set(&s->handoff_timestamp) && s->exit_timestamp.monotonic > s->handoff_timestamp.monotonic)
|
||||
fprintf(f,
|
||||
"%sExit Timestamp: %s since handoff\n",
|
||||
prefix,
|
||||
FORMAT_TIMESPAN(usec_sub_unsigned(s->exit_timestamp.monotonic, s->handoff_timestamp.monotonic), 1));
|
||||
else if (dual_timestamp_is_set(&s->start_timestamp) && s->exit_timestamp.monotonic > s->start_timestamp.monotonic)
|
||||
fprintf(f,
|
||||
"%sExit Timestamp: %s since start\n",
|
||||
prefix,
|
||||
FORMAT_TIMESPAN(usec_sub_unsigned(s->exit_timestamp.monotonic, s->start_timestamp.monotonic), 1));
|
||||
else
|
||||
fprintf(f,
|
||||
"%sExit Timestamp: %s\n",
|
||||
prefix, FORMAT_TIMESTAMP_STYLE(s->exit_timestamp.realtime, TIMESTAMP_US));
|
||||
|
||||
if (dual_timestamp_is_set(&s->exit_timestamp))
|
||||
fprintf(f,
|
||||
"%sExit Timestamp: %s\n"
|
||||
"%sExit Code: %s\n"
|
||||
"%sExit Status: %i\n",
|
||||
prefix, FORMAT_TIMESTAMP(s->exit_timestamp.realtime),
|
||||
prefix, sigchld_code_to_string(s->code),
|
||||
prefix, s->status);
|
||||
}
|
||||
}
|
||||
|
||||
void exec_command_dump(ExecCommand *c, FILE *f, const char *prefix) {
|
||||
|
||||
Reference in New Issue
Block a user