Skip to content

Commit 33c4613

Browse files
committed
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 6a28a30 ("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.
1 parent 973c81c commit 33c4613

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/stream.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1639,8 +1639,12 @@ static void stream_handle_timeouts(struct stream *s)
16391639
*/
16401640
static void stream_cond_update_cpu_latency(struct stream *s)
16411641
{
1642-
uint32_t lat = th_ctx->sched_call_date - th_ctx->sched_wake_date;
1642+
uint32_t lat;
16431643

1644+
if (likely(!th_ctx->sched_wake_date))
1645+
return;
1646+
1647+
lat = th_ctx->sched_call_date - th_ctx->sched_wake_date;
16441648
s->lat_time += lat;
16451649
}
16461650

0 commit comments

Comments
 (0)