Commit bee8d360 authored by Sasha Goldshtein's avatar Sasha Goldshtein

cpudist: Protect against potentially negative time deltas

It seems from experimentation that the calculated timestamps between
on- and off-CPU switch events can produce incorrect results, with a
later event having a smaller timestamp. Discard events when the
resulting delta time would be negative.
parent 06d90d3d
......@@ -82,6 +82,11 @@ static inline void update_hist(u32 tgid, u32 pid, u64 ts)
if (tsp == 0)
return;
if (ts < *tsp) {
// Probably a clock issue where the recorded on-CPU event had a
// timestamp later than the recorded off-CPU event, or vice versa.
return;
}
u64 delta = ts - *tsp;
FACTOR
STORE
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment