From: Willy Tarreau Date: Sun, 7 Dec 2008 23:16:21 +0000 (+0100) Subject: [MINOR] stats: indicate if a task is running in "show sess" X-Git-Tag: v1.3.16-rc1~94 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8a5c626e73bac905d150185e45110525588d7b4c;p=thirdparty%2Fhaproxy.git [MINOR] stats: indicate if a task is running in "show sess" It's sometimes useful to know that a task is currently running. --- diff --git a/src/dumpstats.c b/src/dumpstats.c index f67d21728d..e14168afad 100644 --- a/src/dumpstats.c +++ b/src/dumpstats.c @@ -1176,16 +1176,20 @@ void stats_dump_sess_to_buffer(struct session *s, struct buffer *rep) } chunk_printf(&msg, sizeof(trash), - " si=(%d,%d) as=%d age=%s", + " si=(%d,%d) as=%d ts=%02x age=%s", curr_sess->si[0].state, curr_sess->si[1].state, - curr_sess->ana_state, + curr_sess->ana_state, curr_sess->task->state, human_time(now.tv_sec - curr_sess->logs.tv_accept.tv_sec, 1)); - chunk_printf(&msg, sizeof(trash), - " exp=%s\n", - curr_sess->task->expire ? - human_time(TICKS_TO_MS(tick_remain(now_ms, curr_sess->task->expire)), - TICKS_TO_MS(1000)) : "never"); + if (curr_sess->task->state & TASK_IN_RUNQUEUE) + chunk_printf(&msg, sizeof(trash), " run(nice=%d)\n", curr_sess->task->nice); + else + chunk_printf(&msg, sizeof(trash), + " exp=%s\n", + curr_sess->task->expire ? + human_time(TICKS_TO_MS(tick_remain(now_ms, curr_sess->task->expire)), + TICKS_TO_MS(1000)) + : "never"); if (buffer_write_chunk(rep, &msg) >= 0) { /* let's try again later */