Commit 3edb453f authored by Sandipan Das's avatar Sandipan Das

Make 'tools/wakeuptime' use an offcpu filter

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: default avatarSandipan Das <sandipan@linux.vnet.ibm.com>
parent 2c2d46f0
...@@ -101,8 +101,13 @@ BPF_STACK_TRACE(stack_traces, STACK_STORAGE_SIZE) ...@@ -101,8 +101,13 @@ BPF_STACK_TRACE(stack_traces, STACK_STORAGE_SIZE)
int offcpu(struct pt_regs *ctx) { int offcpu(struct pt_regs *ctx) {
u32 pid = bpf_get_current_pid_tgid(); u32 pid = bpf_get_current_pid_tgid();
u64 ts = bpf_ktime_get_ns(); struct task_struct *p = (struct task_struct *) bpf_get_current_task();
// XXX: should filter here too, but need task_struct u64 ts;
if (FILTER)
return 0;
ts = bpf_ktime_get_ns();
start.update(&pid, &ts); start.update(&pid, &ts);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment