Skip to content

Commit 12969c1

Browse files
committed
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).
1 parent 33c4613 commit 12969c1

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

include/haproxy/tinfo-t.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,7 @@ struct thread_ctx {
154154
uint emergency_bufs_left; /* number of emergency buffers left in magic_bufs[] */
155155

156156
uint32_t sched_wake_date; /* current task/tasklet's wake date in 32-bit ns or 0 if not supported */
157-
uint32_t sched_call_date; /* current task/tasklet's call date in 32-bit ns */
158-
159-
// 4 bytes hole here
157+
uint64_t sched_call_date; /* current task/tasklet's call date in ns */
160158

161159
uint64_t prev_mono_time; /* previous system wide monotonic time (leaving poll) */
162160
uint64_t curr_mono_time; /* latest system wide monotonic time (leaving poll) */

src/stream.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1664,7 +1664,7 @@ static void stream_cond_update_cpu_usage(struct stream *s)
16641664
if (likely(!th_ctx->sched_wake_date))
16651665
return;
16661666

1667-
cpu = (uint32_t)now_mono_time() - th_ctx->sched_call_date;
1667+
cpu = now_mono_time() - th_ctx->sched_call_date;
16681668
s->cpu_time += cpu;
16691669
HA_ATOMIC_ADD(&th_ctx->sched_profile_entry->cpu_time, cpu);
16701670
th_ctx->sched_wake_date = 0;

0 commit comments

Comments
 (0)