From 2b81650b138362dc1550f973289fc59a40dd3da7 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Mon, 14 Apr 2025 09:31:39 -0400 Subject: [PATCH] MT#55283 convert ng_command_stats to int64_t Change-Id: Iab5acb85dc2b857ffc3d4cbe8128a58907474c8f --- daemon/control_ng.c | 2 +- daemon/statistics.c | 3 +-- include/control_ng.h | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/daemon/control_ng.c b/daemon/control_ng.c index a3411e6d0..b86c4de31 100644 --- a/daemon/control_ng.c +++ b/daemon/control_ng.c @@ -872,7 +872,7 @@ static void control_ng_process_payload(ng_ctx *hctx, str *reply, str *data, cons if (command_ctx.opmode >= 0 && command_ctx.opmode < OP_COUNT) { mutex_lock(&cur->cmd[command_ctx.opmode].lock); cur->cmd[command_ctx.opmode].count++; - cur->cmd[command_ctx.opmode].time = timeval_add(cur->cmd[command_ctx.opmode].time, cmd_process_time); + cur->cmd[command_ctx.opmode].time += timeval_us(cmd_process_time); mutex_unlock(&cur->cmd[command_ctx.opmode].lock); } diff --git a/daemon/statistics.c b/daemon/statistics.c index b27a8026a..19f8e7600 100644 --- a/daemon/statistics.c +++ b/daemon/statistics.c @@ -616,8 +616,7 @@ stats_metric_q *statistics_gather_metrics(struct interface_sampled_rate_stats *i mn = g_strdup_printf("%sduration", ng_command_strings_short[i]); lw = g_ascii_strdown(mn, -1); - METRICs(lw, "%.6f", (double) cur->cmd[i].time.tv_sec + - (double) cur->cmd[i].time.tv_usec / 1000000.); + METRICs(lw, "%.6f", (double) cur->cmd[i].time / 1000000.); PROM("request_seconds_total", "counter"); PROMLAB("proxy=\"%s\",request=\"%s\"", sockaddr_print_buf(&cur->proxy), ng_command_strings[i]); diff --git a/include/control_ng.h b/include/control_ng.h index 5da8b65e7..078f1473e 100644 --- a/include/control_ng.h +++ b/include/control_ng.h @@ -48,7 +48,7 @@ enum ng_opmode { struct ng_command_stats { mutex_t lock; unsigned int count; - struct timeval time; + int64_t time; }; struct control_ng_stats {