Skip to content

Commit

Permalink
Fix tools[/old]/offcputime -p PID
Browse files Browse the repository at this point in the history
We should extract pid before THREAD_FILTER
  • Loading branch information
evverx committed Jun 3, 2016
1 parent c419edf commit 9858ca5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions tools/offcputime.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,11 @@ def signal_ignore(signal, frame):
BPF_STACK_TRACE(stack_traces, STACK_STORAGE_SIZE)
int oncpu(struct pt_regs *ctx, struct task_struct *prev) {
u32 pid;
u32 pid = prev->pid;
u64 ts, *tsp;
// record previous thread sleep time
if (THREAD_FILTER) {
pid = prev->pid;
ts = bpf_ktime_get_ns();
start.update(&pid, &ts);
}
Expand Down
3 changes: 1 addition & 2 deletions tools/old/offcputime.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,11 @@ def signal_ignore(signal, frame):
}
int oncpu(struct pt_regs *ctx, struct task_struct *prev) {
u32 pid;
u32 pid = prev->pid;
u64 ts, *tsp;
// record previous thread sleep time
if (FILTER) {
pid = prev->pid;
ts = bpf_ktime_get_ns();
start.update(&pid, &ts);
}
Expand Down

0 comments on commit 9858ca5

Please sign in to comment.