]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: tinfo/clock: turn sched_call_date to 64-bits
authorWilly Tarreau <w@1wt.eu>
Tue, 19 Nov 2024 17:14:05 +0000 (18:14 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 19 Nov 2024 19:13:41 +0000 (20:13 +0100)
We used to store it in 32-bits since we'd only use it for latency and CPU
usage calculation but usages will evolve so let's not truncate the value
anymore. Now we store the full 64 bits. Note that this doesn't even
increase the storage size due to alignment. The 3 usage places were
verified to still be valid (most were already cast to 32 bits anyway).

include/haproxy/tinfo-t.h
src/stream.c

index 65006531fd7c3cbc842590e567929a5a4b4a6b1f..3db77e56f158ef9eb625dc1142f4a9b590236482 100644 (file)
@@ -154,9 +154,7 @@ struct thread_ctx {
        uint emergency_bufs_left;           /* number of emergency buffers left in magic_bufs[] */
 
        uint32_t sched_wake_date;           /* current task/tasklet's wake date in 32-bit ns or 0 if not supported */
-       uint32_t sched_call_date;           /* current task/tasklet's call date in 32-bit ns */
-
-       // 4 bytes hole here
+       uint64_t sched_call_date;           /* current task/tasklet's call date in ns */
 
        uint64_t prev_mono_time;            /* previous system wide monotonic time (leaving poll) */
        uint64_t curr_mono_time;            /* latest system wide monotonic time (leaving poll) */
index fd9a0272111ebf29d4a62954590340086e5bde28..4d48ed7a23dc54f05869c8557cc3300651ae08ab 100644 (file)
@@ -1664,7 +1664,7 @@ static void stream_cond_update_cpu_usage(struct stream *s)
        if (likely(!th_ctx->sched_wake_date))
                return;
 
-       cpu = (uint32_t)now_mono_time() - th_ctx->sched_call_date;
+       cpu = now_mono_time() - th_ctx->sched_call_date;
        s->cpu_time += cpu;
        HA_ATOMIC_ADD(&th_ctx->sched_profile_entry->cpu_time, cpu);
        th_ctx->sched_wake_date = 0;