MINOR: stream: don't update s->lat_time when the wakeup date is not set

In 2.7 was added a stream wakeup latency calculation with commit
6a28a30efa ("MINOR: tasks: do not keep cpu and latency times in struct
task"). However, due to the transformation of the previous code, it
kept unconditionally updating s->lat_time even of the sched_wake_date
was zero. In other words, s->lat_time is constantly updated for the
huge majority of calls that are made without profiling. Let's just
check the sched_wake_date status before doing so.
This commit is contained in:
Willy Tarreau 2024-11-19 16:42:40 +01:00
parent 973c81ceec
commit 33c461314c
1 changed files with 5 additions and 1 deletions

View File

@ -1639,8 +1639,12 @@ static void stream_handle_timeouts(struct stream *s)
*/
static void stream_cond_update_cpu_latency(struct stream *s)
{
uint32_t lat = th_ctx->sched_call_date - th_ctx->sched_wake_date;
uint32_t lat;
if (likely(!th_ctx->sched_wake_date))
return;
lat = th_ctx->sched_call_date - th_ctx->sched_wake_date;
s->lat_time += lat;
}