Skip to content

Commit

Permalink
tools/offcputime Filter out negative offcpu duration
Browse files Browse the repository at this point in the history
  • Loading branch information
kawamuray authored and yonghong-song committed Jan 15, 2021
1 parent a9f9769 commit 2b97264
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tools/offcputime.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,13 @@ def signal_ignore(signal, frame):
}
// calculate current thread's delta time
u64 delta = bpf_ktime_get_ns() - *tsp;
u64 t_start = *tsp;
u64 t_end = bpf_ktime_get_ns();
start.delete(&pid);
if (t_start > t_end) {
return 0;
}
u64 delta = t_end - t_start;
delta = delta / 1000;
if ((delta < MINBLOCK_US) || (delta > MAXBLOCK_US)) {
return 0;
Expand Down

0 comments on commit 2b97264

Please sign in to comment.