From 28f2a590f63a2a051fe8cfc64b74dfa06c9e7f32 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Tue, 11 Apr 2023 15:26:24 +0200 Subject: [PATCH] MINOR: activity: add a line reporting the average CPU usage to "show activity" It was missing from the output but is sometimes convenient to observe and understand how incoming connections are distributed. The CPU usage is reported as the instant measurement of 100-idle_pct for each thread, and the average value is shown for the aggregated value. This could be backported as it's helpful in certain troublehsooting sessions. --- src/activity.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/activity.c b/src/activity.c index 9d396cd90..0e021b08e 100644 --- a/src/activity.c +++ b/src/activity.c @@ -1109,6 +1109,7 @@ static int cli_io_handler_show_activity(struct appctx *appctx) chunk_appendf(&trash, "cpust_ms_tot:"); SHOW_TOT(thr, activity[thr].cpust_total / 2); chunk_appendf(&trash, "cpust_ms_1s:"); SHOW_TOT(thr, read_freq_ctr(&activity[thr].cpust_1s) / 2); chunk_appendf(&trash, "cpust_ms_15s:"); SHOW_TOT(thr, read_freq_ctr_period(&activity[thr].cpust_15s, 15000) / 2); + chunk_appendf(&trash, "avg_cpu_pct:"); SHOW_AVG(thr, (100 - ha_thread_ctx[thr].idle_pct)); chunk_appendf(&trash, "avg_loop_us:"); SHOW_AVG(thr, swrate_avg(activity[thr].avg_loop_us, TIME_STATS_SAMPLES)); chunk_appendf(&trash, "accepted:"); SHOW_TOT(thr, activity[thr].accepted); chunk_appendf(&trash, "accq_pushed:"); SHOW_TOT(thr, activity[thr].accq_pushed); -- 2.47.3