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).
This commit is contained in:
Willy Tarreau 2024-11-19 18:14:05 +01:00
parent 33c461314c
commit 12969c1b17
2 changed files with 2 additions and 4 deletions

View 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) */

View 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;