From: Willy Tarreau Date: Tue, 11 Apr 2023 13:26:24 +0000 (+0200) Subject: MINOR: activity: add a line reporting the average CPU usage to "show activity" X-Git-Tag: v2.8-dev8~183 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=28f2a590f63a2a051fe8cfc64b74dfa06c9e7f32;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/src/activity.c b/src/activity.c index 9d396cd906..0e021b08e5 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);