Commit 9ddab761 authored by Brendan Gregg's avatar Brendan Gregg

Merge pull request #554 from evverx/fix-p-option

Fix tools[/old]/offcputime -p PID
parents c419edf4 9858ca5e
......@@ -96,12 +96,11 @@ BPF_HASH(start, u32);
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);
}
......
......@@ -89,12 +89,11 @@ static u64 get_frame(u64 *bp) {
}
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);
}
......
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