Skip to content

Commit

Permalink
Update cpudist.py
Browse files Browse the repository at this point in the history
When calculating the ONCPU  time, prev has left the CPU already. It is not necessary to judge whether the process state is TASK_RUNNING or not.
  • Loading branch information
Nick-nizhen authored and yonghong-song committed May 27, 2021
1 parent 77f5252 commit ab14faf
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions tools/cpudist.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,19 +100,13 @@
u64 pid_tgid = bpf_get_current_pid_tgid();
u32 tgid = pid_tgid >> 32, pid = pid_tgid;
u32 prev_pid = prev->pid;
u32 prev_tgid = prev->tgid;
#ifdef ONCPU
if (prev->state == TASK_RUNNING) {
update_hist(prev_tgid, prev_pid, ts);
#else
if (1) {
store_start(prev_tgid, prev_pid, ts);
#endif
u32 prev_pid = prev->pid;
u32 prev_tgid = prev->tgid;
#ifdef ONCPU
update_hist(prev_tgid, prev_pid, ts);
#else
store_start(prev_tgid, prev_pid, ts);
#endif
}
BAIL:
#ifdef ONCPU
Expand Down

0 comments on commit ab14faf

Please sign in to comment.