From: Willy Tarreau Date: Tue, 19 Nov 2024 17:14:05 +0000 (+0100) Subject: MINOR: tinfo/clock: turn sched_call_date to 64-bits X-Git-Tag: v3.1-dev14~70 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=12969c1b1726857ffa274138c95500a337fb7bee;p=thirdparty%2Fhaproxy.git MINOR: tinfo/clock: turn sched_call_date to 64-bits 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). --- diff --git a/include/haproxy/tinfo-t.h b/include/haproxy/tinfo-t.h index 65006531fd..3db77e56f1 100644 --- a/include/haproxy/tinfo-t.h +++ b/include/haproxy/tinfo-t.h @@ -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) */ diff --git a/src/stream.c b/src/stream.c index fd9a027211..4d48ed7a23 100644 --- a/src/stream.c +++ b/src/stream.c @@ -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;