Commit ae737b61 authored by Ian Rogers's avatar Ian Rogers Committed by Arnaldo Carvalho de Melo

perf tool: Add perf_tool__init()

Add init function that behaves like perf_tool__fill_defaults() but
assumes all values haven't been initialized.
Signed-off-by: default avatarIan 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-6-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 564e5cbc
......@@ -230,6 +230,64 @@ static int perf_session__process_compressed_event_stub(struct perf_session *sess
return 0;
}
void perf_tool__init(struct perf_tool *tool, bool ordered_events)
{
tool->ordered_events = ordered_events;
tool->ordering_requires_timestamps = false;
tool->namespace_events = false;
tool->cgroup_events = false;
tool->no_warn = false;
tool->show_feat_hdr = SHOW_FEAT_NO_HEADER;
tool->sample = process_event_sample_stub;
tool->mmap = process_event_stub;
tool->mmap2 = process_event_stub;
tool->comm = process_event_stub;
tool->namespaces = process_event_stub;
tool->cgroup = process_event_stub;
tool->fork = process_event_stub;
tool->exit = process_event_stub;
tool->lost = perf_event__process_lost;
tool->lost_samples = perf_event__process_lost_samples;
tool->aux = perf_event__process_aux;
tool->itrace_start = perf_event__process_itrace_start;
tool->context_switch = perf_event__process_switch;
tool->ksymbol = perf_event__process_ksymbol;
tool->bpf = perf_event__process_bpf;
tool->text_poke = perf_event__process_text_poke;
tool->aux_output_hw_id = perf_event__process_aux_output_hw_id;
tool->read = process_event_sample_stub;
tool->throttle = process_event_stub;
tool->unthrottle = process_event_stub;
tool->attr = process_event_synth_attr_stub;
tool->event_update = process_event_synth_event_update_stub;
tool->tracing_data = process_event_synth_tracing_data_stub;
tool->build_id = process_event_op2_stub;
if (ordered_events)
tool->finished_round = perf_event__process_finished_round;
else
tool->finished_round = process_finished_round_stub;
tool->id_index = process_event_op2_stub;
tool->auxtrace_info = process_event_op2_stub;
tool->auxtrace = process_event_auxtrace_stub;
tool->auxtrace_error = process_event_op2_stub;
tool->thread_map = process_event_thread_map_stub;
tool->cpu_map = process_event_cpu_map_stub;
tool->stat_config = process_event_stat_config_stub;
tool->stat = process_stat_stub;
tool->stat_round = process_stat_round_stub;
tool->time_conv = process_event_time_conv_stub;
tool->feature = process_event_op2_stub;
#ifdef HAVE_ZSTD_SUPPORT
tool->compressed = perf_session__process_compressed_event;
#else
tool->compressed = perf_session__process_compressed_event_stub;
#endif
tool->finished_init = process_event_op2_stub;
}
void perf_tool__fill_defaults(struct perf_tool *tool)
{
if (tool->sample == NULL)
......
......@@ -89,6 +89,7 @@ struct perf_tool {
enum show_feature_header show_feat_hdr;
};
void perf_tool__init(struct perf_tool *tool, bool ordered_events);
void perf_tool__fill_defaults(struct perf_tool *tool);
bool perf_tool__compressed_is_stub(const struct perf_tool *tool);
......
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