projects
/
platform
/
upstream
/
bcc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
77f5252
)
Update cpudist.py
author
Nick-nizhen
<74173686+Nick-nizhen@users.noreply.github.com>
Thu, 27 May 2021 05:21:59 +0000
(13:21 +0800)
committer
yonghong-song
<ys114321@gmail.com>
Thu, 27 May 2021 17:24:13 +0000
(10:24 -0700)
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.
tools/cpudist.py
patch
|
blob
|
history
diff --git
a/tools/cpudist.py
b/tools/cpudist.py
index eb04f590ddecbadb54f3274a87dbe67545f6cf8a..b5a6a9782de2a22fec96c7d47b1450efe8a0fec7 100755
(executable)
--- a/
tools/cpudist.py
+++ b/
tools/cpudist.py
@@
-100,19
+100,13
@@
int sched_switch(struct pt_regs *ctx, struct task_struct *prev)
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