From: Willy Tarreau Date: Thu, 11 Sep 2025 08:42:02 +0000 (+0200) Subject: MINOR: activity: add a new lkw_avg column to show profiling stats X-Git-Tag: v3.3-dev9~132 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1956c544b58c2b9fcf96874c211fde38728451a6;p=thirdparty%2Fhaproxy.git MINOR: activity: add a new lkw_avg column to show profiling stats This new column will be used for reporting the average time spent waiting for a lock. It will only have a non-zero value when DEBUG_THREAD > 0. For now it is not updated. --- diff --git a/include/haproxy/activity-t.h b/include/haproxy/activity-t.h index d7264c7f6..a0b30d4b2 100644 --- a/include/haproxy/activity-t.h +++ b/include/haproxy/activity-t.h @@ -143,6 +143,7 @@ struct sched_activity { uint64_t calls; uint64_t cpu_time; uint64_t lat_time; + uint64_t lkw_time; /* lock waiting time */ }; #endif /* _HAPROXY_ACTIVITY_T_H */ diff --git a/src/activity.c b/src/activity.c index b06b48d68..ba1143d06 100644 --- a/src/activity.c +++ b/src/activity.c @@ -757,6 +757,7 @@ static int cli_parse_set_profiling(char **args, char *payload, struct appctx *ap HA_ATOMIC_STORE(&sched_activity[i].calls, 0); HA_ATOMIC_STORE(&sched_activity[i].cpu_time, 0); HA_ATOMIC_STORE(&sched_activity[i].lat_time, 0); + HA_ATOMIC_STORE(&sched_activity[i].lkw_time, 0); HA_ATOMIC_STORE(&sched_activity[i].func, NULL); HA_ATOMIC_STORE(&sched_activity[i].caller, NULL); } @@ -978,6 +979,7 @@ static int cli_io_handler_show_profiling(struct appctx *appctx) tmp_activity[i].calls += tmp_activity[j].calls; tmp_activity[i].cpu_time += tmp_activity[j].cpu_time; tmp_activity[i].lat_time += tmp_activity[j].lat_time; + tmp_activity[i].lkw_time += tmp_activity[j].lkw_time; tmp_activity[j].calls = 0; } } @@ -990,7 +992,7 @@ static int cli_io_handler_show_profiling(struct appctx *appctx) if (!ctx->linenum) chunk_appendf(&trash, "Tasks activity over %.3f sec till %.3f sec ago:\n" - " function calls cpu_tot cpu_avg lat_avg\n", + " function calls cpu_tot cpu_avg lkw_avg lat_avg\n", (prof_task_start_ns ? (prof_task_stop_ns ? prof_task_stop_ns : now_ns) - prof_task_start_ns : 0) / 1000000000.0, (prof_task_stop_ns ? now_ns - prof_task_stop_ns : 0) / 1000000000.0); @@ -1027,6 +1029,7 @@ static int cli_io_handler_show_profiling(struct appctx *appctx) print_time_short(&trash, " ", tmp_activity[i].cpu_time, ""); print_time_short(&trash, " ", tmp_activity[i].cpu_time / tmp_activity[i].calls, ""); + print_time_short(&trash, " ", tmp_activity[i].lkw_time / tmp_activity[i].calls, ""); print_time_short(&trash, " ", tmp_activity[i].lat_time / tmp_activity[i].calls, ""); if (caller && !ctx->aggr && caller->what <= WAKEUP_TYPE_APPCTX_WAKEUP)