]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: activity: add a new mem_avg column to show profiling stats
authorWilly Tarreau <w@1wt.eu>
Thu, 11 Sep 2025 12:49:02 +0000 (14:49 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 11 Sep 2025 14:32:34 +0000 (16:32 +0200)
This new column will be used for reporting the average time spent
allocating or freeing memory in a task when task profiling is enabled.
For now it is not updated.

include/haproxy/activity-t.h
src/activity.c

index 4dc377d9117d637bb1e005fd5e0552ddf89a0582..ba9241d03a2fd35e45376312fa64163a0826562c 100644 (file)
@@ -145,6 +145,7 @@ struct sched_activity {
        uint64_t lat_time;
        uint64_t lkw_time; /* lock waiting time */
        uint64_t lkd_time; /* locked time */
+       uint64_t mem_time; /* memory ops wait time */
 };
 
 #endif /* _HAPROXY_ACTIVITY_T_H */
index c174ae034385e5d46d09f157be2c8edd2822e095..ad4d60d8b5a32a7d440f1537d57e5c6882be78e2 100644 (file)
@@ -759,6 +759,7 @@ static int cli_parse_set_profiling(char **args, char *payload, struct appctx *ap
                        HA_ATOMIC_STORE(&sched_activity[i].lat_time, 0);
                        HA_ATOMIC_STORE(&sched_activity[i].lkw_time, 0);
                        HA_ATOMIC_STORE(&sched_activity[i].lkd_time, 0);
+                       HA_ATOMIC_STORE(&sched_activity[i].mem_time, 0);
                        HA_ATOMIC_STORE(&sched_activity[i].func, NULL);
                        HA_ATOMIC_STORE(&sched_activity[i].caller, NULL);
                }
@@ -982,6 +983,7 @@ static int cli_io_handler_show_profiling(struct appctx *appctx)
                                tmp_activity[i].lat_time += tmp_activity[j].lat_time;
                                tmp_activity[i].lkw_time += tmp_activity[j].lkw_time;
                                tmp_activity[i].lkd_time += tmp_activity[j].lkd_time;
+                               tmp_activity[i].mem_time += tmp_activity[j].mem_time;
                                tmp_activity[j].calls = 0;
                        }
                }
@@ -994,7 +996,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   lkw_avg   lkd_avg   lat_avg\n",
+                                     "  function                      calls   cpu_tot   cpu_avg   lkw_avg   lkd_avg   mem_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);
 
@@ -1033,6 +1035,7 @@ static int cli_io_handler_show_profiling(struct appctx *appctx)
                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].lkd_time / tmp_activity[i].calls, "");
+               print_time_short(&trash, "   ", tmp_activity[i].mem_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)