Skip to content

Commit

Permalink
Make 'tools/wakeuptime' use an offcpu filter
Browse files Browse the repository at this point in the history
This modifies 'tools/wakeuptime' to include a filter
in offcpu() for capturing data only for a given pid
or for user threads only.

Signed-off-by: Sandipan Das <[email protected]>
  • Loading branch information
sandip4n committed Nov 17, 2017
1 parent 2c2d46f commit 3edb453
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tools/wakeuptime.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,13 @@ def signal_ignore(signal, frame):
int offcpu(struct pt_regs *ctx) {
u32 pid = bpf_get_current_pid_tgid();
u64 ts = bpf_ktime_get_ns();
// XXX: should filter here too, but need task_struct
struct task_struct *p = (struct task_struct *) bpf_get_current_task();
u64 ts;
if (FILTER)
return 0;
ts = bpf_ktime_get_ns();
start.update(&pid, &ts);
return 0;
}
Expand Down

0 comments on commit 3edb453

Please sign in to comment.