Skip to content

Commit e541695

Browse files
liu-song-6acmel
authored andcommitted
perf bpf: Make synthesize_bpf_events() receive perf_session pointer instead of perf_tool
This patch changes the arguments of perf_event__synthesize_bpf_events() to include perf_session* instead of perf_tool*. perf_session will be used in the next patch. Signed-off-by: Song Liu <[email protected]> Reviewed-by: Jiri Olsa <[email protected]> Cc: Alexei Starovoitov <[email protected]> Cc: Daniel Borkmann <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stanislav Fomichev <[email protected]> Cc: [email protected] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent a742258 commit e541695

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

tools/perf/builtin-record.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1114,7 +1114,7 @@ static int record__synthesize(struct record *rec, bool tail)
11141114
return err;
11151115
}
11161116

1117-
err = perf_event__synthesize_bpf_events(tool, process_synthesized_event,
1117+
err = perf_event__synthesize_bpf_events(session, process_synthesized_event,
11181118
machine, opts);
11191119
if (err < 0)
11201120
pr_warning("Couldn't synthesize bpf events.\n");

tools/perf/builtin-top.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1208,7 +1208,7 @@ static int __cmd_top(struct perf_top *top)
12081208

12091209
init_process_thread(top);
12101210

1211-
ret = perf_event__synthesize_bpf_events(&top->tool, perf_event__process,
1211+
ret = perf_event__synthesize_bpf_events(top->session, perf_event__process,
12121212
&top->session->machines.host,
12131213
&top->record_opts);
12141214
if (ret < 0)

tools/perf/util/bpf-event.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "debug.h"
1111
#include "symbol.h"
1212
#include "machine.h"
13+
#include "session.h"
1314

1415
#define ptr_to_u64(ptr) ((__u64)(unsigned long)(ptr))
1516

@@ -42,7 +43,7 @@ int machine__process_bpf_event(struct machine *machine __maybe_unused,
4243
* -1 for failures;
4344
* -2 for lack of kernel support.
4445
*/
45-
static int perf_event__synthesize_one_bpf_prog(struct perf_tool *tool,
46+
static int perf_event__synthesize_one_bpf_prog(struct perf_session *session,
4647
perf_event__handler_t process,
4748
struct machine *machine,
4849
int fd,
@@ -52,6 +53,7 @@ static int perf_event__synthesize_one_bpf_prog(struct perf_tool *tool,
5253
struct ksymbol_event *ksymbol_event = &event->ksymbol_event;
5354
struct bpf_event *bpf_event = &event->bpf_event;
5455
struct bpf_prog_info_linear *info_linear;
56+
struct perf_tool *tool = session->tool;
5557
struct bpf_prog_info *info;
5658
struct btf *btf = NULL;
5759
bool has_btf = false;
@@ -175,7 +177,7 @@ static int perf_event__synthesize_one_bpf_prog(struct perf_tool *tool,
175177
return err ? -1 : 0;
176178
}
177179

178-
int perf_event__synthesize_bpf_events(struct perf_tool *tool,
180+
int perf_event__synthesize_bpf_events(struct perf_session *session,
179181
perf_event__handler_t process,
180182
struct machine *machine,
181183
struct record_opts *opts)
@@ -209,7 +211,7 @@ int perf_event__synthesize_bpf_events(struct perf_tool *tool,
209211
continue;
210212
}
211213

212-
err = perf_event__synthesize_one_bpf_prog(tool, process,
214+
err = perf_event__synthesize_one_bpf_prog(session, process,
213215
machine, fd,
214216
event, opts);
215217
close(fd);

tools/perf/util/bpf-event.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ struct record_opts;
1515
int machine__process_bpf_event(struct machine *machine, union perf_event *event,
1616
struct perf_sample *sample);
1717

18-
int perf_event__synthesize_bpf_events(struct perf_tool *tool,
18+
int perf_event__synthesize_bpf_events(struct perf_session *session,
1919
perf_event__handler_t process,
2020
struct machine *machine,
2121
struct record_opts *opts);
@@ -27,7 +27,7 @@ static inline int machine__process_bpf_event(struct machine *machine __maybe_unu
2727
return 0;
2828
}
2929

30-
static inline int perf_event__synthesize_bpf_events(struct perf_tool *tool __maybe_unused,
30+
static inline int perf_event__synthesize_bpf_events(struct perf_session *session __maybe_unused,
3131
perf_event__handler_t process __maybe_unused,
3232
struct machine *machine __maybe_unused,
3333
struct record_opts *opts __maybe_unused)

0 commit comments

Comments
 (0)