summaryrefslogtreecommitdiff
path: root/src/core/manager.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-01-27 00:59:08 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-01-27 01:23:16 -0500
commit2cba2e03524ec0922ddc70f933e8a89b7d23b4ec (patch)
tree715e583b85ca435c905432b5792e8449ce4bab5c /src/core/manager.c
parent68db7a3bd9b2f8640c7297382b6d20eb995f7e1e (diff)
manager: print ephemeral information about running jobs' timeouts
Produces output like: [ *** ] (1 of 2) A start job is running for slow.service (33s / 1min 30s) The first nubmer is the time since job start, the second is the job timeout.
Diffstat (limited to 'src/core/manager.c')
-rw-r--r--src/core/manager.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/core/manager.c b/src/core/manager.c
index 95fc7e64ac..76c8daceac 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -143,6 +143,8 @@ static void manager_print_jobs_in_progress(Manager *m) {
unsigned counter = 0, print_nr;
char cylon[6 + CYLON_BUFFER_EXTRA + 1];
unsigned cylon_pos;
+ char time[FORMAT_TIMESPAN_MAX], limit[FORMAT_TIMESPAN_MAX] = "no limit";
+ uint64_t x;
assert(m);
@@ -162,14 +164,23 @@ static void manager_print_jobs_in_progress(Manager *m) {
cylon_pos = 14 - cylon_pos;
draw_cylon(cylon, sizeof(cylon), 6, cylon_pos);
+ m->jobs_in_progress_iteration++;
+
if (m->n_running_jobs > 1)
if (asprintf(&job_of_n, "(%u of %u) ", counter, m->n_running_jobs) < 0)
job_of_n = NULL;
- manager_status_printf(m, true, cylon, "%sA %s job is running for %s",
- strempty(job_of_n), job_type_to_string(j->type), unit_description(j->unit));
+ format_timespan(time, sizeof(time), now(CLOCK_MONOTONIC) - j->begin_usec, 1*USEC_PER_SEC);
+ if (job_get_timeout(j, &x) > 0)
+ format_timespan(limit, sizeof(limit), x - j->begin_usec, 1*USEC_PER_SEC);
+
+ manager_status_printf(m, true, cylon,
+ "%sA %s job is running for %s (%s / %s)",
+ strempty(job_of_n),
+ job_type_to_string(j->type),
+ unit_description(j->unit),
+ time, limit);
- m->jobs_in_progress_iteration++;
}
static int manager_watch_idle_pipe(Manager *m) {