lab.nexedi.com will be down from Thursday, 20 March 2025, 07:30:00 UTC for a duration of approximately 2 hours

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); ...@@ -96,12 +96,11 @@ BPF_HASH(start, u32);
BPF_STACK_TRACE(stack_traces, STACK_STORAGE_SIZE) BPF_STACK_TRACE(stack_traces, STACK_STORAGE_SIZE)
int oncpu(struct pt_regs *ctx, struct task_struct *prev) { int oncpu(struct pt_regs *ctx, struct task_struct *prev) {
u32 pid; u32 pid = prev->pid;
u64 ts, *tsp; u64 ts, *tsp;
// record previous thread sleep time // record previous thread sleep time
if (THREAD_FILTER) { if (THREAD_FILTER) {
pid = prev->pid;
ts = bpf_ktime_get_ns(); ts = bpf_ktime_get_ns();
start.update(&pid, &ts); start.update(&pid, &ts);
} }
......
...@@ -89,12 +89,11 @@ static u64 get_frame(u64 *bp) { ...@@ -89,12 +89,11 @@ static u64 get_frame(u64 *bp) {
} }
int oncpu(struct pt_regs *ctx, struct task_struct *prev) { int oncpu(struct pt_regs *ctx, struct task_struct *prev) {
u32 pid; u32 pid = prev->pid;
u64 ts, *tsp; u64 ts, *tsp;
// record previous thread sleep time // record previous thread sleep time
if (FILTER) { if (FILTER) {
pid = prev->pid;
ts = bpf_ktime_get_ns(); ts = bpf_ktime_get_ns();
start.update(&pid, &ts); 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