mirror of
https://github.com/torvalds/linux.git
synced 2026-05-27 08:33:17 +02:00
perf report: Use perf_tool__init()
Use perf_tool__init() so that more uses of 'struct perf_tool' can be const and not relying on perf_tool__fill_defaults(). Signed-off-by: Ian Rogers <irogers@google.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Anshuman Khandual <anshuman.khandual@arm.com> Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com> Cc: Huacai Chen <chenhuacai@kernel.org> Cc: Ilkka Koskinen <ilkka@os.amperecomputing.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: James Clark <james.clark@arm.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: John Garry <john.g.garry@oracle.com> Cc: Jonathan Cameron <jonathan.cameron@huawei.com> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Leo Yan <leo.yan@linux.dev> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Mike Leach <mike.leach@linaro.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Nick Desaulniers <ndesaulniers@google.com> Cc: Nick Terrell <terrelln@fb.com> Cc: Oliver Upton <oliver.upton@linux.dev> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Song Liu <song@kernel.org> Cc: Sun Haiyong <sunhaiyong@loongson.cn> Cc: Suzuki Poulouse <suzuki.poulose@arm.com> Cc: Will Deacon <will@kernel.org> Cc: Yanteng Si <siyanteng@loongson.cn> Cc: Yicong Yang <yangyicong@hisilicon.com> Cc: linux-arm-kernel@lists.infradead.org Link: https://lore.kernel.org/r/20240812204720.631678-16-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
a37c0436f3
commit
113f614c6d
|
|
@ -799,7 +799,7 @@ static int process_attr(const struct perf_tool *tool __maybe_unused,
|
|||
|
||||
static void stats_setup(struct report *rep)
|
||||
{
|
||||
memset(&rep->tool, 0, sizeof(rep->tool));
|
||||
perf_tool__init(&rep->tool, /*ordered_events=*/false);
|
||||
rep->tool.attr = process_attr;
|
||||
rep->tool.sample = count_sample_event;
|
||||
rep->tool.lost_samples = count_lost_samples_event;
|
||||
|
|
@ -817,8 +817,7 @@ static int stats_print(struct report *rep)
|
|||
|
||||
static void tasks_setup(struct report *rep)
|
||||
{
|
||||
memset(&rep->tool, 0, sizeof(rep->tool));
|
||||
rep->tool.ordered_events = true;
|
||||
perf_tool__init(&rep->tool, /*ordered_events=*/true);
|
||||
if (rep->mmaps_mode) {
|
||||
rep->tool.mmap = perf_event__process_mmap;
|
||||
rep->tool.mmap2 = perf_event__process_mmap2;
|
||||
|
|
@ -1272,30 +1271,6 @@ int cmd_report(int argc, const char **argv)
|
|||
NULL
|
||||
};
|
||||
struct report report = {
|
||||
.tool = {
|
||||
.sample = process_sample_event,
|
||||
.mmap = perf_event__process_mmap,
|
||||
.mmap2 = perf_event__process_mmap2,
|
||||
.comm = perf_event__process_comm,
|
||||
.namespaces = perf_event__process_namespaces,
|
||||
.cgroup = perf_event__process_cgroup,
|
||||
.exit = perf_event__process_exit,
|
||||
.fork = perf_event__process_fork,
|
||||
.lost = perf_event__process_lost,
|
||||
.read = process_read_event,
|
||||
.attr = process_attr,
|
||||
#ifdef HAVE_LIBTRACEEVENT
|
||||
.tracing_data = perf_event__process_tracing_data,
|
||||
#endif
|
||||
.build_id = perf_event__process_build_id,
|
||||
.id_index = perf_event__process_id_index,
|
||||
.auxtrace_info = perf_event__process_auxtrace_info,
|
||||
.auxtrace = perf_event__process_auxtrace,
|
||||
.event_update = perf_event__process_event_update,
|
||||
.feature = process_feature_event,
|
||||
.ordered_events = true,
|
||||
.ordering_requires_timestamps = true,
|
||||
},
|
||||
.max_stack = PERF_MAX_STACK_DEPTH,
|
||||
.pretty_printing_style = "normal",
|
||||
.socket_filter = -1,
|
||||
|
|
@ -1477,6 +1452,7 @@ int cmd_report(int argc, const char **argv)
|
|||
};
|
||||
int ret = hists__init();
|
||||
char sort_tmp[128];
|
||||
bool ordered_events = true;
|
||||
|
||||
if (ret < 0)
|
||||
goto exit;
|
||||
|
|
@ -1531,7 +1507,7 @@ int cmd_report(int argc, const char **argv)
|
|||
report.tasks_mode = true;
|
||||
|
||||
if (dump_trace && report.disable_order)
|
||||
report.tool.ordered_events = false;
|
||||
ordered_events = false;
|
||||
|
||||
if (quiet)
|
||||
perf_quiet_option();
|
||||
|
|
@ -1562,6 +1538,29 @@ int cmd_report(int argc, const char **argv)
|
|||
symbol_conf.skip_empty = report.skip_empty;
|
||||
|
||||
repeat:
|
||||
perf_tool__init(&report.tool, ordered_events);
|
||||
report.tool.sample = process_sample_event;
|
||||
report.tool.mmap = perf_event__process_mmap;
|
||||
report.tool.mmap2 = perf_event__process_mmap2;
|
||||
report.tool.comm = perf_event__process_comm;
|
||||
report.tool.namespaces = perf_event__process_namespaces;
|
||||
report.tool.cgroup = perf_event__process_cgroup;
|
||||
report.tool.exit = perf_event__process_exit;
|
||||
report.tool.fork = perf_event__process_fork;
|
||||
report.tool.lost = perf_event__process_lost;
|
||||
report.tool.read = process_read_event;
|
||||
report.tool.attr = process_attr;
|
||||
#ifdef HAVE_LIBTRACEEVENT
|
||||
report.tool.tracing_data = perf_event__process_tracing_data;
|
||||
#endif
|
||||
report.tool.build_id = perf_event__process_build_id;
|
||||
report.tool.id_index = perf_event__process_id_index;
|
||||
report.tool.auxtrace_info = perf_event__process_auxtrace_info;
|
||||
report.tool.auxtrace = perf_event__process_auxtrace;
|
||||
report.tool.event_update = perf_event__process_event_update;
|
||||
report.tool.feature = process_feature_event;
|
||||
report.tool.ordering_requires_timestamps = true;
|
||||
|
||||
session = perf_session__new(&data, &report.tool);
|
||||
if (IS_ERR(session)) {
|
||||
ret = PTR_ERR(session);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user