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.
*/
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;
}