Skip to content

Commit

Permalink
fixup: apply feedback
Browse files Browse the repository at this point in the history
Signed-off-by: Florian Lehner <florian.lehner@elastic.co>
  • Loading branch information
florianl committed Dec 10, 2024
1 parent 7cec8dc commit 73481bf
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
6 changes: 3 additions & 3 deletions cli_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ var (
"on agent startup, but not periodically."
sendErrorFramesHelp = "Send error frames (devfiler only, breaks Kibana)"
offCPUThresholdHelp = fmt.Sprintf("If set to a value between 1 and %d will enable "+
"off cpu profiling: Every time an off-cpu entry point is hit, a random number between "+
"0 and %d is chosen. If the given threshold is greater than this random number, the off "+
"cpu trace is collected and reported.",
"off-cpu profiling: Every time an off-cpu entry point is hit, a random number between "+
"0 and %d is chosen. If the given threshold is greater than this random number, the "+
"off-cpu trace is collected and reported.",
tracer.OffCPUThresholdMax-1, tracer.OffCPUThresholdMax-1)
)

Expand Down
2 changes: 1 addition & 1 deletion libpf/symbol.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func (symmap *SymbolMap) LookupSymbolByPrefix(prefix string) (*Symbol, error) {
return sym, nil
}
}
return nil, fmt.Errorf("no symbol not present that starts with '%s' in map", prefix)
return nil, fmt.Errorf("no symbol present that starts with '%s'", prefix)
}

// LookupSymbolAddress returns the address of a symbol.
Expand Down
6 changes: 3 additions & 3 deletions support/ebpf/off_cpu.ebpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ int tracepoint__sched_switch(void *ctx) {
u64 ts = bpf_ktime_get_ns();

if (bpf_map_update_elem(&profile_off_cpu, &pid_tgid, &ts, BPF_ANY)<0){
return 0;
DEBUG_PRINT("Failed to record sched_switch event entry");
return 0;
}

return 0;
Expand Down Expand Up @@ -78,9 +79,8 @@ int finish_task_switch(struct pt_regs *ctx) {
return 0;
}

DEBUG_PRINT("==== finish_task_switch ====");

u64 diff = ts - *start_ts;
DEBUG_PRINT("==== finish_task_switch ====");

return collect_trace(ctx, TRACE_OFF_CPU, pid, tid, ts, diff);
}
3 changes: 1 addition & 2 deletions support/ebpf/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -547,8 +547,7 @@ typedef struct Trace {
// origin indicates the source of the trace.
TraceOrigin origin;

// Time in nanosecond for off-cpu profiling,
// for how long the trace was off cpu.
// offtime stores the nanoseconds that the trace was off-cpu for.
u64 offtime;

// The frames of the stack trace.
Expand Down

0 comments on commit 73481bf

Please sign in to comment.