Skip to content

Commit

Permalink
perf top: Move sb_evlist to 'struct perf_top'
Browse files Browse the repository at this point in the history
Where state related to a 'perf top' session is grouped.

Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Song Liu <songliubraving@fb.com>
Link: http://lore.kernel.org/lkml/20200429131106.27974-3-acme@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
  • Loading branch information
Arnaldo Carvalho de Melo committed May 5, 2020
1 parent bc477d7 commit ca6c9c8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions tools/perf/builtin-top.c
Original file line number Diff line number Diff line change
Expand Up @@ -1580,7 +1580,6 @@ int cmd_top(int argc, const char **argv)
OPTS_EVSWITCH(&top.evswitch),
OPT_END()
};
struct evlist *sb_evlist = NULL;
const char * const top_usage[] = {
"perf top [<options>]",
NULL
Expand Down Expand Up @@ -1744,17 +1743,17 @@ int cmd_top(int argc, const char **argv)
}

if (!top.record_opts.no_bpf_event)
bpf_event__add_sb_event(&sb_evlist, &perf_env);
bpf_event__add_sb_event(&top.sb_evlist, &perf_env);

if (perf_evlist__start_sb_thread(sb_evlist, target)) {
if (perf_evlist__start_sb_thread(top.sb_evlist, target)) {
pr_debug("Couldn't start the BPF side band thread:\nBPF programs starting from now on won't be annotatable\n");
opts->no_bpf_event = true;
}

status = __cmd_top(&top);

if (!opts->no_bpf_event)
perf_evlist__stop_sb_thread(sb_evlist);
perf_evlist__stop_sb_thread(top.sb_evlist);

out_delete_evlist:
evlist__delete(top.evlist);
Expand Down
2 changes: 1 addition & 1 deletion tools/perf/util/top.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ struct perf_session;

struct perf_top {
struct perf_tool tool;
struct evlist *evlist;
struct evlist *evlist, *sb_evlist;
struct record_opts record_opts;
struct annotation_options annotation_opts;
struct evswitch evswitch;
Expand Down

0 comments on commit ca6c9c8

Please sign in to comment.