From nobody Wed Dec 17 10:46:21 2025 Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 46D28178398 for ; Fri, 12 Jul 2024 18:12:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720807943; cv=none; b=BsQbP3vWi9bb9Icarvuw8+GsnNwY9xa3A/XpOvmKgpAQ47I7oU6xnBcm3Jncwo3QazL8JEx36ZVh0eZ2Y0ziiSpAedU3USFePRDBXL2XrXWHJR+4JYoyx70JGVPIwv0HpHI5AZwFGr9Aa58r88dpJVvhLneqQkNcL3Zlgt0IkoM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720807943; c=relaxed/simple; bh=3+jemqp+N2P27Sk42oFvJxS+mgFZvwI1zGTCPAgP5V8=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=Ulj2beJw6QrZa9PgGLgg0icLv1ubVQTa7dqqqQTClegItLRUKqwQjck6O+xz2vUOGS4Od0thm5aX2dlbzc09tXt5jeXIroxUKYLYGytRVm7ojlXvC5wpRdKp2pEwH9BO8ZpesE3IIEMhoDAaLpxQzs2/kpEPmhu11S8rM6WF0d8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=lq3hTBN3; arc=none smtp.client-ip=209.85.128.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="lq3hTBN3" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-64c3f08ca52so34512927b3.3 for ; Fri, 12 Jul 2024 11:12:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1720807937; x=1721412737; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=HIWQmor+Scc7M4YcVrFBx0ZUYFreSj97vY86NrMsF4g=; b=lq3hTBN3uF2lDBThUL6XyNns8mD99P97OOUGpDRdHfgBLaSEoCcnXMKeifE2Sm/scu gssl3j4Kh+n0U0sljyfdH9wlaptXvSGxsz/Wn3B2AACkQgpQsh+tEs12QRPiucNEiHIC /Jmhh8vp5hpPQ00gz4dwwNRxzgDpwm42n39bvvHtPmoOTmo8hdX651m5biLJbYtdvuTf 44WjsJxTXWNzop8EEDlg5XugkaRpNYLMn2cwE5jsmvXiu8N8VJ9c/+PqVGIkD5bw2QIG HnW54NhhdCD0TVyqmtFhA66B0d/3z5HcMv8bNbdBhTOliF+GxftvTdrfyUKp4Q4UCF7h s4Eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720807937; x=1721412737; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=HIWQmor+Scc7M4YcVrFBx0ZUYFreSj97vY86NrMsF4g=; b=VAqBQwJazA52K7tUKEJ8OJmYrL7dehv3sd8d+fa3SKDGTqdM5K5p0x2n/q5F8te1II tMZsc5+A9DWcmOW2XKuYzq6kodvHT+pb/p5D5U8qwzSxFPTTbtdBStXFhK1hmIHSTKSW Qphgb8lcXLDJebHD4QF223OJYi/RdXA9wKTzc1moWisNDDGKZML3msz5BXQTH9qE7lKh R/2J6ya2O1tl2hmyQTvniPmDIA0fuoClkJt3xj5+XQOfQ1C6+F6dlY+nfhsiMbMsw4fQ 8q778j1dDssaVBF94FYsZIcmuHQ0ERg9pr+DH75iADWgj7BLI3GOs88Dsc39XmzcRVeo iwMA== X-Forwarded-Encrypted: i=1; AJvYcCXYa7VheW07+aBzCG6S2UdK9C4mrQoj0NKnGlXsr5vzvfFi8HrVmTb3Hd4jo+4hDL3f/1J4CbPHSePqLPfZ7BBN5vysaZzbEjLAc2ow X-Gm-Message-State: AOJu0YzFqhLhpgAZ5YItqvsthb42yKE2qEO43xKbl39Mlk2nfD/FX6Wa UIf35At9WpFGG/4DfZ7/u5A1LkocEWp5jYEf6YYIpFsI8MPGCpWD4TJTIPE+2BuIRxNmRHPek7s RzJQgTg== X-Google-Smtp-Source: AGHT+IHYPTXXmKLWqrt3itHMlToWeCci3onqs4yNbG96uPz1SboBng8Qtoz/+vKU0BY0uMpCh892WFK+D451 X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:2e7d:d47a:a0c6:e3b1]) (user=irogers job=sendgmr) by 2002:a05:690c:724a:b0:646:3ef4:6ad2 with SMTP id 00721157ae682-658f0accfedmr2475237b3.9.1720807937299; Fri, 12 Jul 2024 11:12:17 -0700 (PDT) Date: Fri, 12 Jul 2024 11:10:44 -0700 In-Reply-To: <20240712181108.475336-1-irogers@google.com> Message-Id: <20240712181108.475336-4-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240712181108.475336-1-irogers@google.com> X-Mailer: git-send-email 2.45.2.993.g49e7a77208-goog Subject: [PATCH v5 03/27] perf tool: Constify tool pointers From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Suzuki K Poulose , Yicong Yang , Jonathan Cameron , Nick Terrell , Nick Desaulniers , Oliver Upton , Anshuman Khandual , Song Liu , Ilkka Koskinen , Athira Rajeev , Huacai Chen , Yanteng Si , Sun Haiyong , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The tool pointer (to a struct largely of function pointers) is passed around but is unchanged except at initialization. Change parameter and variable types to be const to lower the possibilities of what could happen with a tool. Signed-off-by: Ian Rogers --- tools/perf/arch/x86/util/event.c | 4 +- tools/perf/bench/synthesize.c | 2 +- tools/perf/builtin-annotate.c | 2 +- tools/perf/builtin-c2c.c | 2 +- tools/perf/builtin-diff.c | 2 +- tools/perf/builtin-inject.c | 70 ++++++++++++------------- tools/perf/builtin-kmem.c | 3 +- tools/perf/builtin-kvm.c | 4 +- tools/perf/builtin-kwork.c | 22 ++++---- tools/perf/builtin-lock.c | 4 +- tools/perf/builtin-mem.c | 4 +- tools/perf/builtin-record.c | 14 ++--- tools/perf/builtin-report.c | 12 ++--- tools/perf/builtin-sched.c | 34 ++++++------ tools/perf/builtin-script.c | 41 ++++++++------- tools/perf/builtin-stat.c | 8 +-- tools/perf/builtin-timechart.c | 8 +-- tools/perf/builtin-top.c | 2 +- tools/perf/builtin-trace.c | 4 +- tools/perf/tests/cpumap.c | 6 +-- tools/perf/tests/dlfilter-test.c | 2 +- tools/perf/tests/dwarf-unwind.c | 2 +- tools/perf/tests/event_update.c | 8 +-- tools/perf/tests/stat.c | 6 +-- tools/perf/tests/thread-map.c | 2 +- tools/perf/util/arm-spe.c | 6 +-- tools/perf/util/auxtrace.c | 12 ++--- tools/perf/util/auxtrace.h | 20 ++++---- tools/perf/util/bpf-event.c | 4 +- tools/perf/util/build-id.c | 4 +- tools/perf/util/build-id.h | 4 +- tools/perf/util/cs-etm.c | 6 +-- tools/perf/util/data-convert-bt.c | 4 +- tools/perf/util/data-convert-json.c | 4 +- tools/perf/util/event.c | 34 ++++++------ tools/perf/util/event.h | 34 ++++++------ tools/perf/util/header.c | 6 +-- tools/perf/util/header.h | 4 +- tools/perf/util/hisi-ptt.c | 6 +-- tools/perf/util/intel-bts.c | 6 +-- tools/perf/util/intel-pt.c | 6 +-- tools/perf/util/jitdump.c | 4 +- tools/perf/util/s390-cpumsf.c | 6 +-- tools/perf/util/session.c | 30 +++++------ tools/perf/util/session.h | 2 +- tools/perf/util/synthetic-events.c | 80 ++++++++++++++--------------- tools/perf/util/synthetic-events.h | 70 ++++++++++++------------- tools/perf/util/tool.h | 8 +-- tools/perf/util/tsc.c | 2 +- 49 files changed, 314 insertions(+), 316 deletions(-) diff --git a/tools/perf/arch/x86/util/event.c b/tools/perf/arch/x86/util/ev= ent.c index e65b7dbe27fb..a0400707180c 100644 --- a/tools/perf/arch/x86/util/event.c +++ b/tools/perf/arch/x86/util/event.c @@ -15,7 +15,7 @@ #if defined(__x86_64__) =20 struct perf_event__synthesize_extra_kmaps_cb_args { - struct perf_tool *tool; + const struct perf_tool *tool; perf_event__handler_t process; struct machine *machine; union perf_event *event; @@ -65,7 +65,7 @@ static int perf_event__synthesize_extra_kmaps_cb(struct m= ap *map, void *data) return 0; } =20 -int perf_event__synthesize_extra_kmaps(struct perf_tool *tool, +int perf_event__synthesize_extra_kmaps(const struct perf_tool *tool, perf_event__handler_t process, struct machine *machine) { diff --git a/tools/perf/bench/synthesize.c b/tools/perf/bench/synthesize.c index 7401ebbac100..9b333276cbdb 100644 --- a/tools/perf/bench/synthesize.c +++ b/tools/perf/bench/synthesize.c @@ -49,7 +49,7 @@ static const char *const bench_usage[] =3D { =20 static atomic_t event_count; =20 -static int process_synthesized_event(struct perf_tool *tool __maybe_unused, +static int process_synthesized_event(const struct perf_tool *tool __maybe_= unused, union perf_event *event __maybe_unused, struct perf_sample *sample __maybe_unused, struct machine *machine __maybe_unused) diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c index b10b7f005658..c0685d2c8de1 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c @@ -279,7 +279,7 @@ static int evsel__add_sample(struct evsel *evsel, struc= t perf_sample *sample, return ret; } =20 -static int process_sample_event(struct perf_tool *tool, +static int process_sample_event(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct evsel *evsel, diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c index c157bd31f2e5..88c131d05186 100644 --- a/tools/perf/builtin-c2c.c +++ b/tools/perf/builtin-c2c.c @@ -273,7 +273,7 @@ static void compute_stats(struct c2c_hist_entry *c2c_he, update_stats(&cstats->load, weight); } =20 -static int process_sample_event(struct perf_tool *tool __maybe_unused, +static int process_sample_event(const struct perf_tool *tool __maybe_unuse= d, union perf_event *event, struct perf_sample *sample, struct evsel *evsel, diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c index 57d300d8e570..4c0567882a7a 100644 --- a/tools/perf/builtin-diff.c +++ b/tools/perf/builtin-diff.c @@ -388,7 +388,7 @@ struct hist_entry_ops block_hist_ops =3D { .free =3D block_hist_free, }; =20 -static int diff__process_sample_event(struct perf_tool *tool, +static int diff__process_sample_event(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct evsel *evsel, diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c index a212678d47be..be74e2bf1f00 100644 --- a/tools/perf/builtin-inject.c +++ b/tools/perf/builtin-inject.c @@ -134,7 +134,7 @@ struct event_entry { union perf_event event[]; }; =20 -static int dso__inject_build_id(struct dso *dso, struct perf_tool *tool, +static int dso__inject_build_id(struct dso *dso, const struct perf_tool *t= ool, struct machine *machine, u8 cpumode, u32 flags); =20 static int output_bytes(struct perf_inject *inject, void *buf, size_t sz) @@ -149,7 +149,7 @@ static int output_bytes(struct perf_inject *inject, voi= d *buf, size_t sz) return 0; } =20 -static int perf_event__repipe_synth(struct perf_tool *tool, +static int perf_event__repipe_synth(const struct perf_tool *tool, union perf_event *event) { struct perf_inject *inject =3D container_of(tool, struct perf_inject, @@ -158,7 +158,7 @@ static int perf_event__repipe_synth(struct perf_tool *t= ool, return output_bytes(inject, event, event->header.size); } =20 -static int perf_event__repipe_oe_synth(struct perf_tool *tool, +static int perf_event__repipe_oe_synth(const struct perf_tool *tool, union perf_event *event, struct ordered_events *oe __maybe_unused) { @@ -166,7 +166,7 @@ static int perf_event__repipe_oe_synth(struct perf_tool= *tool, } =20 #ifdef HAVE_JITDUMP -static int perf_event__drop_oe(struct perf_tool *tool __maybe_unused, +static int perf_event__drop_oe(const struct perf_tool *tool __maybe_unused, union perf_event *event __maybe_unused, struct ordered_events *oe __maybe_unused) { @@ -188,7 +188,7 @@ static int perf_event__repipe_op4_synth(struct perf_ses= sion *session, return perf_event__repipe_synth(session->tool, event); } =20 -static int perf_event__repipe_attr(struct perf_tool *tool, +static int perf_event__repipe_attr(const struct perf_tool *tool, union perf_event *event, struct evlist **pevlist) { @@ -206,7 +206,7 @@ static int perf_event__repipe_attr(struct perf_tool *to= ol, return perf_event__repipe_synth(tool, event); } =20 -static int perf_event__repipe_event_update(struct perf_tool *tool, +static int perf_event__repipe_event_update(const struct perf_tool *tool, union perf_event *event, struct evlist **pevlist __maybe_unused) { @@ -237,7 +237,7 @@ static int copy_bytes(struct perf_inject *inject, struc= t perf_data *data, off_t static s64 perf_event__repipe_auxtrace(struct perf_session *session, union perf_event *event) { - struct perf_tool *tool =3D session->tool; + const struct perf_tool *tool =3D session->tool; struct perf_inject *inject =3D container_of(tool, struct perf_inject, tool); int ret; @@ -284,7 +284,7 @@ perf_event__repipe_auxtrace(struct perf_session *sessio= n __maybe_unused, =20 #endif =20 -static int perf_event__repipe(struct perf_tool *tool, +static int perf_event__repipe(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample __maybe_unused, struct machine *machine __maybe_unused) @@ -292,7 +292,7 @@ static int perf_event__repipe(struct perf_tool *tool, return perf_event__repipe_synth(tool, event); } =20 -static int perf_event__drop(struct perf_tool *tool __maybe_unused, +static int perf_event__drop(const struct perf_tool *tool __maybe_unused, union perf_event *event __maybe_unused, struct perf_sample *sample __maybe_unused, struct machine *machine __maybe_unused) @@ -300,7 +300,7 @@ static int perf_event__drop(struct perf_tool *tool __ma= ybe_unused, return 0; } =20 -static int perf_event__drop_aux(struct perf_tool *tool, +static int perf_event__drop_aux(const struct perf_tool *tool, union perf_event *event __maybe_unused, struct perf_sample *sample, struct machine *machine __maybe_unused) @@ -341,13 +341,13 @@ perf_inject__cut_auxtrace_sample(struct perf_inject *= inject, return ev; } =20 -typedef int (*inject_handler)(struct perf_tool *tool, +typedef int (*inject_handler)(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct evsel *evsel, struct machine *machine); =20 -static int perf_event__repipe_sample(struct perf_tool *tool, +static int perf_event__repipe_sample(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct evsel *evsel, @@ -372,7 +372,7 @@ static int perf_event__repipe_sample(struct perf_tool *= tool, return perf_event__repipe_synth(tool, event); } =20 -static int perf_event__repipe_mmap(struct perf_tool *tool, +static int perf_event__repipe_mmap(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine) @@ -386,7 +386,7 @@ static int perf_event__repipe_mmap(struct perf_tool *to= ol, } =20 #ifdef HAVE_JITDUMP -static int perf_event__jit_repipe_mmap(struct perf_tool *tool, +static int perf_event__jit_repipe_mmap(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine) @@ -455,7 +455,7 @@ static struct dso *findnew_dso(int pid, int tid, const = char *filename, return dso; } =20 -static int perf_event__repipe_buildid_mmap(struct perf_tool *tool, +static int perf_event__repipe_buildid_mmap(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine) @@ -474,7 +474,7 @@ static int perf_event__repipe_buildid_mmap(struct perf_= tool *tool, return perf_event__repipe(tool, event, sample, machine); } =20 -static int perf_event__repipe_mmap2(struct perf_tool *tool, +static int perf_event__repipe_mmap2(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine) @@ -500,7 +500,7 @@ static int perf_event__repipe_mmap2(struct perf_tool *t= ool, } =20 #ifdef HAVE_JITDUMP -static int perf_event__jit_repipe_mmap2(struct perf_tool *tool, +static int perf_event__jit_repipe_mmap2(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine) @@ -524,7 +524,7 @@ static int perf_event__jit_repipe_mmap2(struct perf_too= l *tool, } #endif =20 -static int perf_event__repipe_buildid_mmap2(struct perf_tool *tool, +static int perf_event__repipe_buildid_mmap2(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine) @@ -565,7 +565,7 @@ static int perf_event__repipe_buildid_mmap2(struct perf= _tool *tool, return 0; } =20 -static int perf_event__repipe_fork(struct perf_tool *tool, +static int perf_event__repipe_fork(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine) @@ -578,7 +578,7 @@ static int perf_event__repipe_fork(struct perf_tool *to= ol, return err; } =20 -static int perf_event__repipe_comm(struct perf_tool *tool, +static int perf_event__repipe_comm(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine) @@ -591,7 +591,7 @@ static int perf_event__repipe_comm(struct perf_tool *to= ol, return err; } =20 -static int perf_event__repipe_namespaces(struct perf_tool *tool, +static int perf_event__repipe_namespaces(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine) @@ -603,7 +603,7 @@ static int perf_event__repipe_namespaces(struct perf_to= ol *tool, return err; } =20 -static int perf_event__repipe_exit(struct perf_tool *tool, +static int perf_event__repipe_exit(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine) @@ -712,7 +712,7 @@ static bool perf_inject__lookup_known_build_id(struct p= erf_inject *inject, return false; } =20 -static int dso__inject_build_id(struct dso *dso, struct perf_tool *tool, +static int dso__inject_build_id(struct dso *dso, const struct perf_tool *t= ool, struct machine *machine, u8 cpumode, u32 flags) { struct perf_inject *inject =3D container_of(tool, struct perf_inject, @@ -743,7 +743,7 @@ static int dso__inject_build_id(struct dso *dso, struct= perf_tool *tool, return 0; } =20 -int perf_event__inject_buildid(struct perf_tool *tool, union perf_event *e= vent, +int perf_event__inject_buildid(const struct perf_tool *tool, union perf_ev= ent *event, struct perf_sample *sample, struct evsel *evsel __maybe_unused, struct machine *machine) @@ -776,7 +776,7 @@ int perf_event__inject_buildid(struct perf_tool *tool, = union perf_event *event, return 0; } =20 -static int perf_inject__sched_process_exit(struct perf_tool *tool, +static int perf_inject__sched_process_exit(const struct perf_tool *tool, union perf_event *event __maybe_unused, struct perf_sample *sample, struct evsel *evsel __maybe_unused, @@ -796,7 +796,7 @@ static int perf_inject__sched_process_exit(struct perf_= tool *tool, return 0; } =20 -static int perf_inject__sched_switch(struct perf_tool *tool, +static int perf_inject__sched_switch(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct evsel *evsel, @@ -821,7 +821,7 @@ static int perf_inject__sched_switch(struct perf_tool *= tool, } =20 #ifdef HAVE_LIBTRACEEVENT -static int perf_inject__sched_stat(struct perf_tool *tool, +static int perf_inject__sched_stat(const struct perf_tool *tool, union perf_event *event __maybe_unused, struct perf_sample *sample, struct evsel *evsel, @@ -866,7 +866,7 @@ static int guest_session__output_bytes(struct guest_ses= sion *gs, void *buf, size return ret < 0 ? ret : 0; } =20 -static int guest_session__repipe(struct perf_tool *tool, +static int guest_session__repipe(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample __maybe_unused, struct machine *machine __maybe_unused) @@ -1032,7 +1032,7 @@ static struct guest_id *guest_session__lookup_id(stru= ct guest_session *gs, u64 i return NULL; } =20 -static int process_attr(struct perf_tool *tool, union perf_event *event, +static int process_attr(const struct perf_tool *tool, union perf_event *ev= ent, struct perf_sample *sample __maybe_unused, struct machine *machine __maybe_unused) { @@ -1160,7 +1160,7 @@ static u64 evlist__first_id(struct evlist *evlist) return 0; } =20 -static int process_build_id(struct perf_tool *tool, +static int process_build_id(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample __maybe_unused, struct machine *machine __maybe_unused) @@ -1210,7 +1210,7 @@ static int guest_session__add_build_ids(struct guest_= session *gs) gs); } =20 -static int guest_session__ksymbol_event(struct perf_tool *tool, +static int guest_session__ksymbol_event(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample __maybe_unused, struct machine *machine __maybe_unused) @@ -1574,7 +1574,7 @@ static int guest_session__flush_events(struct guest_s= ession *gs) return guest_session__inject_events(gs, -1); } =20 -static int host__repipe(struct perf_tool *tool, +static int host__repipe(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine) @@ -1647,7 +1647,7 @@ static int host__finished_init(struct perf_session *s= ession, union perf_event *e * guest events up to the same time. Finally write out the FINISHED_ROUND = event * itself. */ -static int host__finished_round(struct perf_tool *tool, +static int host__finished_round(const struct perf_tool *tool, union perf_event *event, struct ordered_events *oe) { @@ -1665,7 +1665,7 @@ static int host__finished_round(struct perf_tool *too= l, return perf_event__repipe_oe_synth(tool, event, oe); } =20 -static int host__context_switch(struct perf_tool *tool, +static int host__context_switch(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine) @@ -1719,7 +1719,7 @@ static int evsel__check_stype(struct evsel *evsel, u6= 4 sample_type, const char * return 0; } =20 -static int drop_sample(struct perf_tool *tool __maybe_unused, +static int drop_sample(const struct perf_tool *tool __maybe_unused, union perf_event *event __maybe_unused, struct perf_sample *sample __maybe_unused, struct evsel *evsel __maybe_unused, diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c index 6fd95be5032b..859ff018eace 100644 --- a/tools/perf/builtin-kmem.c +++ b/tools/perf/builtin-kmem.c @@ -955,7 +955,7 @@ static bool perf_kmem__skip_sample(struct perf_sample *= sample) typedef int (*tracepoint_handler)(struct evsel *evsel, struct perf_sample *sample); =20 -static int process_sample_event(struct perf_tool *tool __maybe_unused, +static int process_sample_event(const struct perf_tool *tool __maybe_unuse= d, union perf_event *event, struct perf_sample *sample, struct evsel *evsel, @@ -2061,4 +2061,3 @@ int cmd_kmem(int argc, const char **argv) =20 return ret; } - diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c index 71165036e4ca..a3b903cf4311 100644 --- a/tools/perf/builtin-kvm.c +++ b/tools/perf/builtin-kvm.c @@ -1166,7 +1166,7 @@ static void print_result(struct perf_kvm_stat *kvm) } =20 #if defined(HAVE_TIMERFD_SUPPORT) && defined(HAVE_LIBTRACEEVENT) -static int process_lost_event(struct perf_tool *tool, +static int process_lost_event(const struct perf_tool *tool, union perf_event *event __maybe_unused, struct perf_sample *sample __maybe_unused, struct machine *machine __maybe_unused) @@ -1187,7 +1187,7 @@ static bool skip_sample(struct perf_kvm_stat *kvm, return false; } =20 -static int process_sample_event(struct perf_tool *tool, +static int process_sample_event(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct evsel *evsel, diff --git a/tools/perf/builtin-kwork.c b/tools/perf/builtin-kwork.c index 56e3f3a5e03a..8ffaa80a2d1d 100644 --- a/tools/perf/builtin-kwork.c +++ b/tools/perf/builtin-kwork.c @@ -958,7 +958,7 @@ static int top_sched_switch_event(struct perf_kwork *kw= ork, } =20 static struct kwork_class kwork_irq; -static int process_irq_handler_entry_event(struct perf_tool *tool, +static int process_irq_handler_entry_event(const struct perf_tool *tool, struct evsel *evsel, struct perf_sample *sample, struct machine *machine) @@ -971,7 +971,7 @@ static int process_irq_handler_entry_event(struct perf_= tool *tool, return 0; } =20 -static int process_irq_handler_exit_event(struct perf_tool *tool, +static int process_irq_handler_exit_event(const struct perf_tool *tool, struct evsel *evsel, struct perf_sample *sample, struct machine *machine) @@ -1037,7 +1037,7 @@ static struct kwork_class kwork_irq =3D { }; =20 static struct kwork_class kwork_softirq; -static int process_softirq_raise_event(struct perf_tool *tool, +static int process_softirq_raise_event(const struct perf_tool *tool, struct evsel *evsel, struct perf_sample *sample, struct machine *machine) @@ -1051,7 +1051,7 @@ static int process_softirq_raise_event(struct perf_to= ol *tool, return 0; } =20 -static int process_softirq_entry_event(struct perf_tool *tool, +static int process_softirq_entry_event(const struct perf_tool *tool, struct evsel *evsel, struct perf_sample *sample, struct machine *machine) @@ -1065,7 +1065,7 @@ static int process_softirq_entry_event(struct perf_to= ol *tool, return 0; } =20 -static int process_softirq_exit_event(struct perf_tool *tool, +static int process_softirq_exit_event(const struct perf_tool *tool, struct evsel *evsel, struct perf_sample *sample, struct machine *machine) @@ -1167,7 +1167,7 @@ static struct kwork_class kwork_softirq =3D { }; =20 static struct kwork_class kwork_workqueue; -static int process_workqueue_activate_work_event(struct perf_tool *tool, +static int process_workqueue_activate_work_event(const struct perf_tool *t= ool, struct evsel *evsel, struct perf_sample *sample, struct machine *machine) @@ -1181,7 +1181,7 @@ static int process_workqueue_activate_work_event(stru= ct perf_tool *tool, return 0; } =20 -static int process_workqueue_execute_start_event(struct perf_tool *tool, +static int process_workqueue_execute_start_event(const struct perf_tool *t= ool, struct evsel *evsel, struct perf_sample *sample, struct machine *machine) @@ -1195,7 +1195,7 @@ static int process_workqueue_execute_start_event(stru= ct perf_tool *tool, return 0; } =20 -static int process_workqueue_execute_end_event(struct perf_tool *tool, +static int process_workqueue_execute_end_event(const struct perf_tool *too= l, struct evsel *evsel, struct perf_sample *sample, struct machine *machine) @@ -1266,7 +1266,7 @@ static struct kwork_class kwork_workqueue =3D { }; =20 static struct kwork_class kwork_sched; -static int process_sched_switch_event(struct perf_tool *tool, +static int process_sched_switch_event(const struct perf_tool *tool, struct evsel *evsel, struct perf_sample *sample, struct machine *machine) @@ -1945,12 +1945,12 @@ static int perf_kwork__report(struct perf_kwork *kw= ork) return 0; } =20 -typedef int (*tracepoint_handler)(struct perf_tool *tool, +typedef int (*tracepoint_handler)(const struct perf_tool *tool, struct evsel *evsel, struct perf_sample *sample, struct machine *machine); =20 -static int perf_kwork__process_tracepoint_sample(struct perf_tool *tool, +static int perf_kwork__process_tracepoint_sample(const struct perf_tool *t= ool, union perf_event *event __maybe_unused, struct perf_sample *sample, struct evsel *evsel, diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c index 0253184b3b58..6efa9d646637 100644 --- a/tools/perf/builtin-lock.c +++ b/tools/perf/builtin-lock.c @@ -1501,7 +1501,7 @@ static const struct evsel_str_handler contention_trac= epoints[] =3D { { "lock:contention_end", evsel__process_contention_end, }, }; =20 -static int process_event_update(struct perf_tool *tool, +static int process_event_update(const struct perf_tool *tool, union perf_event *event, struct evlist **pevlist) { @@ -1520,7 +1520,7 @@ static int process_event_update(struct perf_tool *too= l, typedef int (*tracepoint_handler)(struct evsel *evsel, struct perf_sample *sample); =20 -static int process_sample_event(struct perf_tool *tool __maybe_unused, +static int process_sample_event(const struct perf_tool *tool __maybe_unuse= d, union perf_event *event, struct perf_sample *sample, struct evsel *evsel, diff --git a/tools/perf/builtin-mem.c b/tools/perf/builtin-mem.c index 863fcd735dae..c2038a32543c 100644 --- a/tools/perf/builtin-mem.c +++ b/tools/perf/builtin-mem.c @@ -188,7 +188,7 @@ static int __cmd_record(int argc, const char **argv, st= ruct perf_mem *mem) } =20 static int -dump_raw_samples(struct perf_tool *tool, +dump_raw_samples(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine) @@ -262,7 +262,7 @@ dump_raw_samples(struct perf_tool *tool, return 0; } =20 -static int process_sample_event(struct perf_tool *tool, +static int process_sample_event(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct evsel *evsel __maybe_unused, diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index a94516e8c522..f27f725913d7 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -608,7 +608,7 @@ static int record__comp_enabled(struct record *rec) return rec->opts.comp_level > 0; } =20 -static int process_synthesized_event(struct perf_tool *tool, +static int process_synthesized_event(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample __maybe_unused, struct machine *machine __maybe_unused) @@ -619,7 +619,7 @@ static int process_synthesized_event(struct perf_tool *= tool, =20 static struct mutex synth_lock; =20 -static int process_locked_synthesized_event(struct perf_tool *tool, +static int process_locked_synthesized_event(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample __maybe_unused, struct machine *machine __maybe_unused) @@ -704,7 +704,7 @@ static void record__sig_exit(void) =20 #ifdef HAVE_AUXTRACE_SUPPORT =20 -static int record__process_auxtrace(struct perf_tool *tool, +static int record__process_auxtrace(const struct perf_tool *tool, struct mmap *map, union perf_event *event, void *data1, size_t len1, void *data2, size_t len2) @@ -1416,7 +1416,7 @@ static void set_timestamp_boundary(struct record *rec= , u64 sample_time) rec->evlist->last_sample_time =3D sample_time; } =20 -static int process_sample_event(struct perf_tool *tool, +static int process_sample_event(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct evsel *evsel, @@ -3243,7 +3243,7 @@ static const char * const __record_usage[] =3D { }; const char * const *record_usage =3D __record_usage; =20 -static int build_id__process_mmap(struct perf_tool *tool, union perf_event= *event, +static int build_id__process_mmap(const struct perf_tool *tool, union perf= _event *event, struct perf_sample *sample, struct machine *machine) { /* @@ -3255,7 +3255,7 @@ static int build_id__process_mmap(struct perf_tool *t= ool, union perf_event *even return perf_event__process_mmap(tool, event, sample, machine); } =20 -static int build_id__process_mmap2(struct perf_tool *tool, union perf_even= t *event, +static int build_id__process_mmap2(const struct perf_tool *tool, union per= f_event *event, struct perf_sample *sample, struct machine *machine) { /* @@ -3268,7 +3268,7 @@ static int build_id__process_mmap2(struct perf_tool *= tool, union perf_event *eve return perf_event__process_mmap2(tool, event, sample, machine); } =20 -static int process_timestamp_boundary(struct perf_tool *tool, +static int process_timestamp_boundary(const struct perf_tool *tool, union perf_event *event __maybe_unused, struct perf_sample *sample, struct machine *machine __maybe_unused) diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 6edc0d4ce6fb..c402d9b3dca6 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c @@ -263,7 +263,7 @@ static int process_feature_event(struct perf_session *s= ession, return 0; } =20 -static int process_sample_event(struct perf_tool *tool, +static int process_sample_event(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct evsel *evsel, @@ -339,7 +339,7 @@ static int process_sample_event(struct perf_tool *tool, return ret; } =20 -static int process_read_event(struct perf_tool *tool, +static int process_read_event(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample __maybe_unused, struct evsel *evsel, @@ -765,7 +765,7 @@ static void report__output_resort(struct report *rep) ui_progress__finish(); } =20 -static int count_sample_event(struct perf_tool *tool __maybe_unused, +static int count_sample_event(const struct perf_tool *tool __maybe_unused, union perf_event *event __maybe_unused, struct perf_sample *sample __maybe_unused, struct evsel *evsel, @@ -777,7 +777,7 @@ static int count_sample_event(struct perf_tool *tool __= maybe_unused, return 0; } =20 -static int count_lost_samples_event(struct perf_tool *tool, +static int count_lost_samples_event(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine __maybe_unused) @@ -793,7 +793,7 @@ static int count_lost_samples_event(struct perf_tool *t= ool, return 0; } =20 -static int process_attr(struct perf_tool *tool __maybe_unused, +static int process_attr(const struct perf_tool *tool __maybe_unused, union perf_event *event, struct evlist **pevlist); =20 @@ -1233,7 +1233,7 @@ parse_percent_limit(const struct option *opt, const c= har *str, return 0; } =20 -static int process_attr(struct perf_tool *tool __maybe_unused, +static int process_attr(const struct perf_tool *tool __maybe_unused, union perf_event *event, struct evlist **pevlist) { diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index 8750b5f2d49b..2c60bd3a8149 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c @@ -1489,7 +1489,7 @@ static void perf_sched__sort_lat(struct perf_sched *s= ched) } } =20 -static int process_sched_wakeup_event(struct perf_tool *tool, +static int process_sched_wakeup_event(const struct perf_tool *tool, struct evsel *evsel, struct perf_sample *sample, struct machine *machine) @@ -1502,7 +1502,7 @@ static int process_sched_wakeup_event(struct perf_too= l *tool, return 0; } =20 -static int process_sched_wakeup_ignore(struct perf_tool *tool __maybe_unus= ed, +static int process_sched_wakeup_ignore(const struct perf_tool *tool __mayb= e_unused, struct evsel *evsel __maybe_unused, struct perf_sample *sample __maybe_unused, struct machine *machine __maybe_unused) @@ -1770,7 +1770,7 @@ static int map_switch_event(struct perf_sched *sched,= struct evsel *evsel, return 0; } =20 -static int process_sched_switch_event(struct perf_tool *tool, +static int process_sched_switch_event(const struct perf_tool *tool, struct evsel *evsel, struct perf_sample *sample, struct machine *machine) @@ -1796,7 +1796,7 @@ static int process_sched_switch_event(struct perf_too= l *tool, return err; } =20 -static int process_sched_runtime_event(struct perf_tool *tool, +static int process_sched_runtime_event(const struct perf_tool *tool, struct evsel *evsel, struct perf_sample *sample, struct machine *machine) @@ -1809,7 +1809,7 @@ static int process_sched_runtime_event(struct perf_to= ol *tool, return 0; } =20 -static int perf_sched__process_fork_event(struct perf_tool *tool, +static int perf_sched__process_fork_event(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine) @@ -1826,7 +1826,7 @@ static int perf_sched__process_fork_event(struct perf= _tool *tool, return 0; } =20 -static int process_sched_migrate_task_event(struct perf_tool *tool, +static int process_sched_migrate_task_event(const struct perf_tool *tool, struct evsel *evsel, struct perf_sample *sample, struct machine *machine) @@ -1839,12 +1839,12 @@ static int process_sched_migrate_task_event(struct = perf_tool *tool, return 0; } =20 -typedef int (*tracepoint_handler)(struct perf_tool *tool, +typedef int (*tracepoint_handler)(const struct perf_tool *tool, struct evsel *evsel, struct perf_sample *sample, struct machine *machine); =20 -static int perf_sched__process_tracepoint_sample(struct perf_tool *tool __= maybe_unused, +static int perf_sched__process_tracepoint_sample(const struct perf_tool *t= ool __maybe_unused, union perf_event *event __maybe_unused, struct perf_sample *sample, struct evsel *evsel, @@ -1860,7 +1860,7 @@ static int perf_sched__process_tracepoint_sample(stru= ct perf_tool *tool __maybe_ return err; } =20 -static int perf_sched__process_comm(struct perf_tool *tool __maybe_unused, +static int perf_sched__process_comm(const struct perf_tool *tool __maybe_u= nused, union perf_event *event, struct perf_sample *sample, struct machine *machine) @@ -2506,7 +2506,7 @@ static void timehist_print_wakeup_event(struct perf_s= ched *sched, printf("\n"); } =20 -static int timehist_sched_wakeup_ignore(struct perf_tool *tool __maybe_unu= sed, +static int timehist_sched_wakeup_ignore(const struct perf_tool *tool __may= be_unused, union perf_event *event __maybe_unused, struct evsel *evsel __maybe_unused, struct perf_sample *sample __maybe_unused, @@ -2515,7 +2515,7 @@ static int timehist_sched_wakeup_ignore(struct perf_t= ool *tool __maybe_unused, return 0; } =20 -static int timehist_sched_wakeup_event(struct perf_tool *tool, +static int timehist_sched_wakeup_event(const struct perf_tool *tool, union perf_event *event __maybe_unused, struct evsel *evsel, struct perf_sample *sample, @@ -2599,7 +2599,7 @@ static void timehist_print_migration_event(struct per= f_sched *sched, printf("\n"); } =20 -static int timehist_migrate_task_event(struct perf_tool *tool, +static int timehist_migrate_task_event(const struct perf_tool *tool, union perf_event *event __maybe_unused, struct evsel *evsel, struct perf_sample *sample, @@ -2627,7 +2627,7 @@ static int timehist_migrate_task_event(struct perf_to= ol *tool, return 0; } =20 -static int timehist_sched_change_event(struct perf_tool *tool, +static int timehist_sched_change_event(const struct perf_tool *tool, union perf_event *event, struct evsel *evsel, struct perf_sample *sample, @@ -2758,7 +2758,7 @@ static int timehist_sched_change_event(struct perf_to= ol *tool, return rc; } =20 -static int timehist_sched_switch_event(struct perf_tool *tool, +static int timehist_sched_switch_event(const struct perf_tool *tool, union perf_event *event, struct evsel *evsel, struct perf_sample *sample, @@ -2767,7 +2767,7 @@ static int timehist_sched_switch_event(struct perf_to= ol *tool, return timehist_sched_change_event(tool, event, evsel, sample, machine); } =20 -static int process_lost(struct perf_tool *tool __maybe_unused, +static int process_lost(const struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample, struct machine *machine __maybe_unused) @@ -3010,13 +3010,13 @@ static void timehist_print_summary(struct perf_sche= d *sched, printf(" (x %d)\n", sched->max_cpu.cpu); } =20 -typedef int (*sched_handler)(struct perf_tool *tool, +typedef int (*sched_handler)(const struct perf_tool *tool, union perf_event *event, struct evsel *evsel, struct perf_sample *sample, struct machine *machine); =20 -static int perf_timehist__process_sample(struct perf_tool *tool, +static int perf_timehist__process_sample(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct evsel *evsel, diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index c16224b1fef3..394bce9f5338 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c @@ -2399,7 +2399,7 @@ static bool filter_cpu(struct perf_sample *sample) return false; } =20 -static int process_sample_event(struct perf_tool *tool, +static int process_sample_event(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct evsel *evsel, @@ -2486,7 +2486,7 @@ static int process_sample_event(struct perf_tool *too= l, // Used when scr->per_event_dump is not set static struct evsel_script es_stdout; =20 -static int process_attr(struct perf_tool *tool, union perf_event *event, +static int process_attr(const struct perf_tool *tool, union perf_event *ev= ent, struct evlist **pevlist) { struct perf_script *scr =3D container_of(tool, struct perf_script, tool); @@ -2552,7 +2552,7 @@ static int process_attr(struct perf_tool *tool, union= perf_event *event, return 0; } =20 -static int print_event_with_time(struct perf_tool *tool, +static int print_event_with_time(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine, @@ -2588,14 +2588,14 @@ static int print_event_with_time(struct perf_tool *= tool, return 0; } =20 -static int print_event(struct perf_tool *tool, union perf_event *event, +static int print_event(const struct perf_tool *tool, union perf_event *eve= nt, struct perf_sample *sample, struct machine *machine, pid_t pid, pid_t tid) { return print_event_with_time(tool, event, sample, machine, pid, tid, 0); } =20 -static int process_comm_event(struct perf_tool *tool, +static int process_comm_event(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine) @@ -2607,7 +2607,7 @@ static int process_comm_event(struct perf_tool *tool, event->comm.tid); } =20 -static int process_namespaces_event(struct perf_tool *tool, +static int process_namespaces_event(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine) @@ -2619,7 +2619,7 @@ static int process_namespaces_event(struct perf_tool = *tool, event->namespaces.tid); } =20 -static int process_cgroup_event(struct perf_tool *tool, +static int process_cgroup_event(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine) @@ -2631,7 +2631,7 @@ static int process_cgroup_event(struct perf_tool *too= l, sample->tid); } =20 -static int process_fork_event(struct perf_tool *tool, +static int process_fork_event(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine) @@ -2643,7 +2643,7 @@ static int process_fork_event(struct perf_tool *tool, event->fork.pid, event->fork.tid, event->fork.time); } -static int process_exit_event(struct perf_tool *tool, +static int process_exit_event(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine) @@ -2656,7 +2656,7 @@ static int process_exit_event(struct perf_tool *tool, return perf_event__process_exit(tool, event, sample, machine); } =20 -static int process_mmap_event(struct perf_tool *tool, +static int process_mmap_event(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine) @@ -2668,7 +2668,7 @@ static int process_mmap_event(struct perf_tool *tool, event->mmap.tid); } =20 -static int process_mmap2_event(struct perf_tool *tool, +static int process_mmap2_event(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine) @@ -2680,7 +2680,7 @@ static int process_mmap2_event(struct perf_tool *tool, event->mmap2.tid); } =20 -static int process_switch_event(struct perf_tool *tool, +static int process_switch_event(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine) @@ -2712,7 +2712,7 @@ static int process_auxtrace_error(struct perf_session= *session, } =20 static int -process_lost_event(struct perf_tool *tool, +process_lost_event(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine) @@ -2722,7 +2722,7 @@ process_lost_event(struct perf_tool *tool, } =20 static int -process_throttle_event(struct perf_tool *tool __maybe_unused, +process_throttle_event(const struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample, struct machine *machine) @@ -2733,7 +2733,7 @@ process_throttle_event(struct perf_tool *tool __maybe= _unused, } =20 static int -process_finished_round_event(struct perf_tool *tool __maybe_unused, +process_finished_round_event(const struct perf_tool *tool __maybe_unused, union perf_event *event, struct ordered_events *oe __maybe_unused) =20 @@ -2743,7 +2743,7 @@ process_finished_round_event(struct perf_tool *tool _= _maybe_unused, } =20 static int -process_bpf_events(struct perf_tool *tool __maybe_unused, +process_bpf_events(const struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample, struct machine *machine) @@ -2755,7 +2755,7 @@ process_bpf_events(struct perf_tool *tool __maybe_unu= sed, sample->tid); } =20 -static int process_text_poke_events(struct perf_tool *tool, +static int process_text_poke_events(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine) @@ -3757,7 +3757,7 @@ static int process_thread_map_event(struct perf_session *session, union perf_event *event) { - struct perf_tool *tool =3D session->tool; + const struct perf_tool *tool =3D session->tool; struct perf_script *script =3D container_of(tool, struct perf_script, too= l); =20 if (dump_trace) @@ -3779,7 +3779,7 @@ static int process_cpu_map_event(struct perf_session *session, union perf_event *event) { - struct perf_tool *tool =3D session->tool; + const struct perf_tool *tool =3D session->tool; struct perf_script *script =3D container_of(tool, struct perf_script, too= l); =20 if (dump_trace) @@ -3809,11 +3809,10 @@ static int process_feature_event(struct perf_sessio= n *session, static int perf_script__process_auxtrace_info(struct perf_session *session, union perf_event *event) { - struct perf_tool *tool =3D session->tool; - int ret =3D perf_event__process_auxtrace_info(session, event); =20 if (ret =3D=3D 0) { + const struct perf_tool *tool =3D session->tool; struct perf_script *script =3D container_of(tool, struct perf_script, to= ol); =20 ret =3D perf_script__setup_per_event_dump(script); diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 661832756a24..d460c46f15fd 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -248,7 +248,7 @@ static void perf_stat__reset_stats(void) perf_stat__reset_shadow_stats(); } =20 -static int process_synthesized_event(struct perf_tool *tool __maybe_unused, +static int process_synthesized_event(const struct perf_tool *tool __maybe_= unused, union perf_event *event, struct perf_sample *sample __maybe_unused, struct machine *machine __maybe_unused) @@ -2180,7 +2180,7 @@ static int process_stat_config_event(struct perf_session *session, union perf_event *event) { - struct perf_tool *tool =3D session->tool; + const struct perf_tool *tool =3D session->tool; struct perf_stat *st =3D container_of(tool, struct perf_stat, tool); =20 perf_event__read_stat_config(&stat_config, &event->stat_config); @@ -2229,7 +2229,7 @@ static int process_thread_map_event(struct perf_session *session, union perf_event *event) { - struct perf_tool *tool =3D session->tool; + const struct perf_tool *tool =3D session->tool; struct perf_stat *st =3D container_of(tool, struct perf_stat, tool); =20 if (st->threads) { @@ -2248,7 +2248,7 @@ static int process_cpu_map_event(struct perf_session *session, union perf_event *event) { - struct perf_tool *tool =3D session->tool; + const struct perf_tool *tool =3D session->tool; struct perf_stat *st =3D container_of(tool, struct perf_stat, tool); struct perf_cpu_map *cpus; =20 diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c index 19d4542ea18a..5bf818baa662 100644 --- a/tools/perf/builtin-timechart.c +++ b/tools/perf/builtin-timechart.c @@ -320,7 +320,7 @@ static int *cpus_cstate_state; static u64 *cpus_pstate_start_times; static u64 *cpus_pstate_state; =20 -static int process_comm_event(struct perf_tool *tool, +static int process_comm_event(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample __maybe_unused, struct machine *machine __maybe_unused) @@ -330,7 +330,7 @@ static int process_comm_event(struct perf_tool *tool, return 0; } =20 -static int process_fork_event(struct perf_tool *tool, +static int process_fork_event(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample __maybe_unused, struct machine *machine __maybe_unused) @@ -340,7 +340,7 @@ static int process_fork_event(struct perf_tool *tool, return 0; } =20 -static int process_exit_event(struct perf_tool *tool, +static int process_exit_event(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample __maybe_unused, struct machine *machine __maybe_unused) @@ -571,7 +571,7 @@ typedef int (*tracepoint_handler)(struct timechart *tch= art, struct perf_sample *sample, const char *backtrace); =20 -static int process_sample_event(struct perf_tool *tool, +static int process_sample_event(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct evsel *evsel, diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index e8cbbf10d361..d6fcc6c122da 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c @@ -740,7 +740,7 @@ static int hist_iter__top_callback(struct hist_entry_it= er *iter, return 0; } =20 -static void perf_event__process_sample(struct perf_tool *tool, +static void perf_event__process_sample(const struct perf_tool *tool, const union perf_event *event, struct evsel *evsel, struct perf_sample *sample, diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index a547ccfa92c9..e39469808ef5 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c @@ -1637,7 +1637,7 @@ static int trace__process_event(struct trace *trace, = struct machine *machine, return ret; } =20 -static int trace__tool_process(struct perf_tool *tool, +static int trace__tool_process(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine) @@ -3009,7 +3009,7 @@ static void trace__set_base_time(struct trace *trace, trace->base_time =3D sample->time; } =20 -static int trace__process_sample(struct perf_tool *tool, +static int trace__process_sample(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct evsel *evsel, diff --git a/tools/perf/tests/cpumap.c b/tools/perf/tests/cpumap.c index bd8e396f3e57..2f0168b2a5a9 100644 --- a/tools/perf/tests/cpumap.c +++ b/tools/perf/tests/cpumap.c @@ -11,7 +11,7 @@ =20 struct machine; =20 -static int process_event_mask(struct perf_tool *tool __maybe_unused, +static int process_event_mask(const struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample __maybe_unused, struct machine *machine __maybe_unused) @@ -47,7 +47,7 @@ static int process_event_mask(struct perf_tool *tool __ma= ybe_unused, return 0; } =20 -static int process_event_cpus(struct perf_tool *tool __maybe_unused, +static int process_event_cpus(const struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample __maybe_unused, struct machine *machine __maybe_unused) @@ -73,7 +73,7 @@ static int process_event_cpus(struct perf_tool *tool __ma= ybe_unused, return 0; } =20 -static int process_event_range_cpus(struct perf_tool *tool __maybe_unused, +static int process_event_range_cpus(const struct perf_tool *tool __maybe_u= nused, union perf_event *event, struct perf_sample *sample __maybe_unused, struct machine *machine __maybe_unused) diff --git a/tools/perf/tests/dlfilter-test.c b/tools/perf/tests/dlfilter-t= est.c index da3a9b50b1b1..54f59d1246bc 100644 --- a/tools/perf/tests/dlfilter-test.c +++ b/tools/perf/tests/dlfilter-test.c @@ -62,7 +62,7 @@ static int test_result(const char *msg, int ret) return ret; } =20 -static int process(struct perf_tool *tool, union perf_event *event, +static int process(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample __maybe_unused, struct machine *machine __maybe_unused) { diff --git a/tools/perf/tests/dwarf-unwind.c b/tools/perf/tests/dwarf-unwin= d.c index d01aa931fe81..f85d391ced98 100644 --- a/tools/perf/tests/dwarf-unwind.c +++ b/tools/perf/tests/dwarf-unwind.c @@ -37,7 +37,7 @@ #define NO_TAIL_CALL_BARRIER __asm__ __volatile__("" : : : "memory"); #endif =20 -static int mmap_handler(struct perf_tool *tool __maybe_unused, +static int mmap_handler(const struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample, struct machine *machine) diff --git a/tools/perf/tests/event_update.c b/tools/perf/tests/event_updat= e.c index d093a9b878d1..fdecad920f59 100644 --- a/tools/perf/tests/event_update.c +++ b/tools/perf/tests/event_update.c @@ -12,7 +12,7 @@ #include "tests.h" #include "debug.h" =20 -static int process_event_unit(struct perf_tool *tool __maybe_unused, +static int process_event_unit(const struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample __maybe_unused, struct machine *machine __maybe_unused) @@ -25,7 +25,7 @@ static int process_event_unit(struct perf_tool *tool __ma= ybe_unused, return 0; } =20 -static int process_event_scale(struct perf_tool *tool __maybe_unused, +static int process_event_scale(const struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample __maybe_unused, struct machine *machine __maybe_unused) @@ -43,7 +43,7 @@ struct event_name { const char *name; }; =20 -static int process_event_name(struct perf_tool *tool, +static int process_event_name(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample __maybe_unused, struct machine *machine __maybe_unused) @@ -57,7 +57,7 @@ static int process_event_name(struct perf_tool *tool, return 0; } =20 -static int process_event_cpus(struct perf_tool *tool __maybe_unused, +static int process_event_cpus(const struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample __maybe_unused, struct machine *machine __maybe_unused) diff --git a/tools/perf/tests/stat.c b/tools/perf/tests/stat.c index 706780fb5695..6468cc0d0204 100644 --- a/tools/perf/tests/stat.c +++ b/tools/perf/tests/stat.c @@ -21,7 +21,7 @@ static bool has_term(struct perf_record_stat_config *conf= ig, return false; } =20 -static int process_stat_config_event(struct perf_tool *tool __maybe_unused, +static int process_stat_config_event(const struct perf_tool *tool __maybe_= unused, union perf_event *event, struct perf_sample *sample __maybe_unused, struct machine *machine __maybe_unused) @@ -62,7 +62,7 @@ static int test__synthesize_stat_config(struct test_suite= *test __maybe_unused, return 0; } =20 -static int process_stat_event(struct perf_tool *tool __maybe_unused, +static int process_stat_event(const struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample __maybe_unused, struct machine *machine __maybe_unused) @@ -93,7 +93,7 @@ static int test__synthesize_stat(struct test_suite *test = __maybe_unused, int sub return 0; } =20 -static int process_stat_round_event(struct perf_tool *tool __maybe_unused, +static int process_stat_round_event(const struct perf_tool *tool __maybe_u= nused, union perf_event *event, struct perf_sample *sample __maybe_unused, struct machine *machine __maybe_unused) diff --git a/tools/perf/tests/thread-map.c b/tools/perf/tests/thread-map.c index 74308c1368fe..1fe521466bf4 100644 --- a/tools/perf/tests/thread-map.c +++ b/tools/perf/tests/thread-map.c @@ -60,7 +60,7 @@ static int test__thread_map(struct test_suite *test __may= be_unused, int subtest return 0; } =20 -static int process_event(struct perf_tool *tool __maybe_unused, +static int process_event(const struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample __maybe_unused, struct machine *machine __maybe_unused) diff --git a/tools/perf/util/arm-spe.c b/tools/perf/util/arm-spe.c index fa40f3cb6266..138ffc71b32d 100644 --- a/tools/perf/util/arm-spe.c +++ b/tools/perf/util/arm-spe.c @@ -899,7 +899,7 @@ static int arm_spe_context_switch(struct arm_spe *spe, = union perf_event *event, static int arm_spe_process_event(struct perf_session *session, union perf_event *event, struct perf_sample *sample, - struct perf_tool *tool) + const struct perf_tool *tool) { int err =3D 0; u64 timestamp; @@ -947,7 +947,7 @@ static int arm_spe_process_event(struct perf_session *s= ession, =20 static int arm_spe_process_auxtrace_event(struct perf_session *session, union perf_event *event, - struct perf_tool *tool __maybe_unused) + const struct perf_tool *tool __maybe_unused) { struct arm_spe *spe =3D container_of(session->auxtrace, struct arm_spe, auxtrace); @@ -985,7 +985,7 @@ static int arm_spe_process_auxtrace_event(struct perf_s= ession *session, } =20 static int arm_spe_flush(struct perf_session *session __maybe_unused, - struct perf_tool *tool __maybe_unused) + const struct perf_tool *tool __maybe_unused) { struct arm_spe *spe =3D container_of(session->auxtrace, struct arm_spe, auxtrace); diff --git a/tools/perf/util/auxtrace.c b/tools/perf/util/auxtrace.c index e2f317063eec..cbb773ed6f1a 100644 --- a/tools/perf/util/auxtrace.c +++ b/tools/perf/util/auxtrace.c @@ -1240,7 +1240,7 @@ void auxtrace_synth_error(struct perf_record_auxtrace= _error *auxtrace_error, int } =20 int perf_event__synthesize_auxtrace_info(struct auxtrace_record *itr, - struct perf_tool *tool, + const struct perf_tool *tool, struct perf_session *session, perf_event__handler_t process) { @@ -1831,7 +1831,7 @@ int __weak compat_auxtrace_mmap__write_tail(struct au= xtrace_mmap *mm, u64 tail) =20 static int __auxtrace_mmap__read(struct mmap *map, struct auxtrace_record *itr, - struct perf_tool *tool, process_auxtrace_t fn, + const struct perf_tool *tool, process_auxtrace_t fn, bool snapshot, size_t snapshot_size) { struct auxtrace_mmap *mm =3D &map->auxtrace_mmap; @@ -1942,14 +1942,14 @@ static int __auxtrace_mmap__read(struct mmap *map, } =20 int auxtrace_mmap__read(struct mmap *map, struct auxtrace_record *itr, - struct perf_tool *tool, process_auxtrace_t fn) + const struct perf_tool *tool, process_auxtrace_t fn) { return __auxtrace_mmap__read(map, itr, tool, fn, false, 0); } =20 int auxtrace_mmap__read_snapshot(struct mmap *map, struct auxtrace_record *itr, - struct perf_tool *tool, process_auxtrace_t fn, + const struct perf_tool *tool, process_auxtrace_t fn, size_t snapshot_size) { return __auxtrace_mmap__read(map, itr, tool, fn, true, snapshot_size); @@ -2829,7 +2829,7 @@ int auxtrace_parse_filters(struct evlist *evlist) } =20 int auxtrace__process_event(struct perf_session *session, union perf_event= *event, - struct perf_sample *sample, struct perf_tool *tool) + struct perf_sample *sample, const struct perf_tool *tool) { if (!session->auxtrace) return 0; @@ -2847,7 +2847,7 @@ void auxtrace__dump_auxtrace_sample(struct perf_sessi= on *session, session->auxtrace->dump_auxtrace_sample(session, sample); } =20 -int auxtrace__flush_events(struct perf_session *session, struct perf_tool = *tool) +int auxtrace__flush_events(struct perf_session *session, const struct perf= _tool *tool) { if (!session->auxtrace) return 0; diff --git a/tools/perf/util/auxtrace.h b/tools/perf/util/auxtrace.h index 8a6ec9565835..d405efcd8708 100644 --- a/tools/perf/util/auxtrace.h +++ b/tools/perf/util/auxtrace.h @@ -208,17 +208,17 @@ struct auxtrace { int (*process_event)(struct perf_session *session, union perf_event *event, struct perf_sample *sample, - struct perf_tool *tool); + const struct perf_tool *tool); int (*process_auxtrace_event)(struct perf_session *session, union perf_event *event, - struct perf_tool *tool); + const struct perf_tool *tool); int (*queue_data)(struct perf_session *session, struct perf_sample *sample, union perf_event *event, u64 data_offset); void (*dump_auxtrace_sample)(struct perf_session *session, struct perf_sample *sample); int (*flush_events)(struct perf_session *session, - struct perf_tool *tool); + const struct perf_tool *tool); void (*free_events)(struct perf_session *session); void (*free)(struct perf_session *session); bool (*evsel_is_auxtrace)(struct perf_session *session, @@ -508,17 +508,17 @@ void auxtrace_mmap_params__set_idx(struct auxtrace_mm= ap_params *mp, struct evlist *evlist, struct evsel *evsel, int idx); =20 -typedef int (*process_auxtrace_t)(struct perf_tool *tool, +typedef int (*process_auxtrace_t)(const struct perf_tool *tool, struct mmap *map, union perf_event *event, void *data1, size_t len1, void *data2, size_t len2); =20 int auxtrace_mmap__read(struct mmap *map, struct auxtrace_record *itr, - struct perf_tool *tool, process_auxtrace_t fn); + const struct perf_tool *tool, process_auxtrace_t fn); =20 int auxtrace_mmap__read_snapshot(struct mmap *map, struct auxtrace_record *itr, - struct perf_tool *tool, process_auxtrace_t fn, + const struct perf_tool *tool, process_auxtrace_t fn, size_t snapshot_size); =20 int auxtrace_queues__init_nr(struct auxtrace_queues *queues, int nr_queues= ); @@ -639,10 +639,10 @@ int addr_filters__parse_bare_filter(struct addr_filte= rs *filts, int auxtrace_parse_filters(struct evlist *evlist); =20 int auxtrace__process_event(struct perf_session *session, union perf_event= *event, - struct perf_sample *sample, struct perf_tool *tool); + struct perf_sample *sample, const struct perf_tool *tool); void auxtrace__dump_auxtrace_sample(struct perf_session *session, struct perf_sample *sample); -int auxtrace__flush_events(struct perf_session *session, struct perf_tool = *tool); +int auxtrace__flush_events(struct perf_session *session, const struct perf= _tool *tool); void auxtrace__free_events(struct perf_session *session); void auxtrace__free(struct perf_session *session); bool auxtrace__evsel_is_auxtrace(struct perf_session *session, @@ -809,7 +809,7 @@ static inline int auxtrace__process_event(struct perf_session *session __maybe_unused, union perf_event *event __maybe_unused, struct perf_sample *sample __maybe_unused, - struct perf_tool *tool __maybe_unused) + const struct perf_tool *tool __maybe_unused) { return 0; } @@ -822,7 +822,7 @@ void auxtrace__dump_auxtrace_sample(struct perf_session= *session __maybe_unused, =20 static inline int auxtrace__flush_events(struct perf_session *session __maybe_unused, - struct perf_tool *tool __maybe_unused) + const struct perf_tool *tool __maybe_unused) { return 0; } diff --git a/tools/perf/util/bpf-event.c b/tools/perf/util/bpf-event.c index 827695cd0408..13608237c50e 100644 --- a/tools/perf/util/bpf-event.c +++ b/tools/perf/util/bpf-event.c @@ -170,7 +170,7 @@ static int perf_event__synthesize_one_bpf_prog(struct p= erf_session *session, { struct perf_record_ksymbol *ksymbol_event =3D &event->ksymbol; struct perf_record_bpf_event *bpf_event =3D &event->bpf; - struct perf_tool *tool =3D session->tool; + const struct perf_tool *tool =3D session->tool; struct bpf_prog_info_node *info_node; struct perf_bpil *info_linear; struct bpf_prog_info *info; @@ -310,7 +310,7 @@ struct kallsyms_parse { union perf_event *event; perf_event__handler_t process; struct machine *machine; - struct perf_tool *tool; + const struct perf_tool *tool; }; =20 static int diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c index 83a1581e8cf1..098fcc625d91 100644 --- a/tools/perf/util/build-id.c +++ b/tools/perf/util/build-id.c @@ -42,7 +42,7 @@ =20 static bool no_buildid_cache; =20 -int build_id__mark_dso_hit(struct perf_tool *tool __maybe_unused, +int build_id__mark_dso_hit(const struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample, struct evsel *evsel __maybe_unused, @@ -67,7 +67,7 @@ int build_id__mark_dso_hit(struct perf_tool *tool __maybe= _unused, return 0; } =20 -static int perf_event__exit_del_thread(struct perf_tool *tool __maybe_unus= ed, +static int perf_event__exit_del_thread(const struct perf_tool *tool __mayb= e_unused, union perf_event *event, struct perf_sample *sample __maybe_unused, diff --git a/tools/perf/util/build-id.h b/tools/perf/util/build-id.h index 3fa8bffb07ca..ae87c4c58d5b 100644 --- a/tools/perf/util/build-id.h +++ b/tools/perf/util/build-id.h @@ -35,11 +35,11 @@ char *dso__build_id_filename(const struct dso *dso, cha= r *bf, size_t size, char *__dso__build_id_filename(const struct dso *dso, char *bf, size_t siz= e, bool is_debug, bool is_kallsyms); =20 -int build_id__mark_dso_hit(struct perf_tool *tool, union perf_event *event, +int build_id__mark_dso_hit(const struct perf_tool *tool, union perf_event = *event, struct perf_sample *sample, struct evsel *evsel, struct machine *machine); =20 -int perf_event__inject_buildid(struct perf_tool *tool, union perf_event *e= vent, +int perf_event__inject_buildid(const struct perf_tool *tool, union perf_ev= ent *event, struct perf_sample *sample, struct evsel *evsel, struct machine *machine); =20 diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c index 7fd976ea954b..21023d2a58ee 100644 --- a/tools/perf/util/cs-etm.c +++ b/tools/perf/util/cs-etm.c @@ -788,7 +788,7 @@ static void cs_etm__dump_event(struct cs_etm_queue *etm= q, } =20 static int cs_etm__flush_events(struct perf_session *session, - struct perf_tool *tool) + const struct perf_tool *tool) { struct cs_etm_auxtrace *etm =3D container_of(session->auxtrace, struct cs_etm_auxtrace, @@ -2711,7 +2711,7 @@ static int cs_etm__process_switch_cpu_wide(struct cs_= etm_auxtrace *etm, static int cs_etm__process_event(struct perf_session *session, union perf_event *event, struct perf_sample *sample, - struct perf_tool *tool) + const struct perf_tool *tool) { struct cs_etm_auxtrace *etm =3D container_of(session->auxtrace, struct cs_etm_auxtrace, @@ -2781,7 +2781,7 @@ static void dump_queued_data(struct cs_etm_auxtrace *= etm, =20 static int cs_etm__process_auxtrace_event(struct perf_session *session, union perf_event *event, - struct perf_tool *tool __maybe_unused) + const struct perf_tool *tool __maybe_unused) { struct cs_etm_auxtrace *etm =3D container_of(session->auxtrace, struct cs_etm_auxtrace, diff --git a/tools/perf/util/data-convert-bt.c b/tools/perf/util/data-conve= rt-bt.c index 2b732bccabad..9e2170604b66 100644 --- a/tools/perf/util/data-convert-bt.c +++ b/tools/perf/util/data-convert-bt.c @@ -792,7 +792,7 @@ static bool is_flush_needed(struct ctf_stream *cs) return cs->count >=3D STREAM_FLUSH_COUNT; } =20 -static int process_sample_event(struct perf_tool *tool, +static int process_sample_event(const struct perf_tool *tool, union perf_event *_event, struct perf_sample *sample, struct evsel *evsel, @@ -871,7 +871,7 @@ do { \ } while(0) =20 #define __FUNC_PROCESS_NON_SAMPLE(_name, body) \ -static int process_##_name##_event(struct perf_tool *tool, \ +static int process_##_name##_event(const struct perf_tool *tool, \ union perf_event *_event, \ struct perf_sample *sample, \ struct machine *machine) \ diff --git a/tools/perf/util/data-convert-json.c b/tools/perf/util/data-con= vert-json.c index 3cf64f5b23ee..905ea9823f9d 100644 --- a/tools/perf/util/data-convert-json.c +++ b/tools/perf/util/data-convert-json.c @@ -118,7 +118,7 @@ static void output_json_key_format(FILE *out, bool comm= a, int depth, va_end(args); } =20 -static void output_sample_callchain_entry(struct perf_tool *tool, +static void output_sample_callchain_entry(const struct perf_tool *tool, u64 ip, struct addr_location *al) { struct convert_json *c =3D container_of(tool, struct convert_json, tool); @@ -146,7 +146,7 @@ static void output_sample_callchain_entry(struct perf_t= ool *tool, output_json_format(out, false, 4, "}"); } =20 -static int process_sample_event(struct perf_tool *tool, +static int process_sample_event(const struct perf_tool *tool, union perf_event *event __maybe_unused, struct perf_sample *sample, struct evsel *evsel __maybe_unused, diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index f32f9abf6344..c2f0e7f40ad5 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c @@ -216,7 +216,7 @@ size_t perf_event__fprintf_cgroup(union perf_event *eve= nt, FILE *fp) event->cgroup.id, event->cgroup.path); } =20 -int perf_event__process_comm(struct perf_tool *tool __maybe_unused, +int perf_event__process_comm(const struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample, struct machine *machine) @@ -224,7 +224,7 @@ int perf_event__process_comm(struct perf_tool *tool __m= aybe_unused, return machine__process_comm_event(machine, event, sample); } =20 -int perf_event__process_namespaces(struct perf_tool *tool __maybe_unused, +int perf_event__process_namespaces(const struct perf_tool *tool __maybe_un= used, union perf_event *event, struct perf_sample *sample, struct machine *machine) @@ -232,7 +232,7 @@ int perf_event__process_namespaces(struct perf_tool *to= ol __maybe_unused, return machine__process_namespaces_event(machine, event, sample); } =20 -int perf_event__process_cgroup(struct perf_tool *tool __maybe_unused, +int perf_event__process_cgroup(const struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample, struct machine *machine) @@ -240,7 +240,7 @@ int perf_event__process_cgroup(struct perf_tool *tool _= _maybe_unused, return machine__process_cgroup_event(machine, event, sample); } =20 -int perf_event__process_lost(struct perf_tool *tool __maybe_unused, +int perf_event__process_lost(const struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample, struct machine *machine) @@ -248,7 +248,7 @@ int perf_event__process_lost(struct perf_tool *tool __m= aybe_unused, return machine__process_lost_event(machine, event, sample); } =20 -int perf_event__process_aux(struct perf_tool *tool __maybe_unused, +int perf_event__process_aux(const struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample __maybe_unused, struct machine *machine) @@ -256,7 +256,7 @@ int perf_event__process_aux(struct perf_tool *tool __ma= ybe_unused, return machine__process_aux_event(machine, event); } =20 -int perf_event__process_itrace_start(struct perf_tool *tool __maybe_unused, +int perf_event__process_itrace_start(const struct perf_tool *tool __maybe_= unused, union perf_event *event, struct perf_sample *sample __maybe_unused, struct machine *machine) @@ -264,7 +264,7 @@ int perf_event__process_itrace_start(struct perf_tool *= tool __maybe_unused, return machine__process_itrace_start_event(machine, event); } =20 -int perf_event__process_aux_output_hw_id(struct perf_tool *tool __maybe_un= used, +int perf_event__process_aux_output_hw_id(const struct perf_tool *tool __ma= ybe_unused, union perf_event *event, struct perf_sample *sample __maybe_unused, struct machine *machine) @@ -272,7 +272,7 @@ int perf_event__process_aux_output_hw_id(struct perf_to= ol *tool __maybe_unused, return machine__process_aux_output_hw_id_event(machine, event); } =20 -int perf_event__process_lost_samples(struct perf_tool *tool __maybe_unused, +int perf_event__process_lost_samples(const struct perf_tool *tool __maybe_= unused, union perf_event *event, struct perf_sample *sample, struct machine *machine) @@ -280,7 +280,7 @@ int perf_event__process_lost_samples(struct perf_tool *= tool __maybe_unused, return machine__process_lost_samples_event(machine, event, sample); } =20 -int perf_event__process_switch(struct perf_tool *tool __maybe_unused, +int perf_event__process_switch(const struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample __maybe_unused, struct machine *machine) @@ -288,7 +288,7 @@ int perf_event__process_switch(struct perf_tool *tool _= _maybe_unused, return machine__process_switch_event(machine, event); } =20 -int perf_event__process_ksymbol(struct perf_tool *tool __maybe_unused, +int perf_event__process_ksymbol(const struct perf_tool *tool __maybe_unuse= d, union perf_event *event, struct perf_sample *sample __maybe_unused, struct machine *machine) @@ -296,7 +296,7 @@ int perf_event__process_ksymbol(struct perf_tool *tool = __maybe_unused, return machine__process_ksymbol(machine, event, sample); } =20 -int perf_event__process_bpf(struct perf_tool *tool __maybe_unused, +int perf_event__process_bpf(const struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample, struct machine *machine) @@ -304,7 +304,7 @@ int perf_event__process_bpf(struct perf_tool *tool __ma= ybe_unused, return machine__process_bpf(machine, event, sample); } =20 -int perf_event__process_text_poke(struct perf_tool *tool __maybe_unused, +int perf_event__process_text_poke(const struct perf_tool *tool __maybe_unu= sed, union perf_event *event, struct perf_sample *sample, struct machine *machine) @@ -387,7 +387,7 @@ size_t perf_event__fprintf_cpu_map(union perf_event *ev= ent, FILE *fp) return ret; } =20 -int perf_event__process_mmap(struct perf_tool *tool __maybe_unused, +int perf_event__process_mmap(const struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample, struct machine *machine) @@ -395,7 +395,7 @@ int perf_event__process_mmap(struct perf_tool *tool __m= aybe_unused, return machine__process_mmap_event(machine, event, sample); } =20 -int perf_event__process_mmap2(struct perf_tool *tool __maybe_unused, +int perf_event__process_mmap2(const struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample, struct machine *machine) @@ -410,7 +410,7 @@ size_t perf_event__fprintf_task(union perf_event *event= , FILE *fp) event->fork.ppid, event->fork.ptid); } =20 -int perf_event__process_fork(struct perf_tool *tool __maybe_unused, +int perf_event__process_fork(const struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample, struct machine *machine) @@ -418,7 +418,7 @@ int perf_event__process_fork(struct perf_tool *tool __m= aybe_unused, return machine__process_fork_event(machine, event, sample); } =20 -int perf_event__process_exit(struct perf_tool *tool __maybe_unused, +int perf_event__process_exit(const struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample, struct machine *machine) @@ -587,7 +587,7 @@ size_t perf_event__fprintf(union perf_event *event, str= uct machine *machine, FIL return ret; } =20 -int perf_event__process(struct perf_tool *tool __maybe_unused, +int perf_event__process(const struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample, struct machine *machine) diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h index d8bcee2e9b93..4b24f1c580fd 100644 --- a/tools/perf/util/event.h +++ b/tools/perf/util/event.h @@ -267,71 +267,71 @@ struct perf_tool; void perf_event__read_stat_config(struct perf_stat_config *config, struct perf_record_stat_config *event); =20 -int perf_event__process_comm(struct perf_tool *tool, +int perf_event__process_comm(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine); -int perf_event__process_lost(struct perf_tool *tool, +int perf_event__process_lost(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine); -int perf_event__process_lost_samples(struct perf_tool *tool, +int perf_event__process_lost_samples(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine); -int perf_event__process_aux(struct perf_tool *tool, +int perf_event__process_aux(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine); -int perf_event__process_itrace_start(struct perf_tool *tool, +int perf_event__process_itrace_start(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine); -int perf_event__process_aux_output_hw_id(struct perf_tool *tool, +int perf_event__process_aux_output_hw_id(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine); -int perf_event__process_switch(struct perf_tool *tool, +int perf_event__process_switch(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine); -int perf_event__process_namespaces(struct perf_tool *tool, +int perf_event__process_namespaces(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine); -int perf_event__process_cgroup(struct perf_tool *tool, +int perf_event__process_cgroup(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine); -int perf_event__process_mmap(struct perf_tool *tool, +int perf_event__process_mmap(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine); -int perf_event__process_mmap2(struct perf_tool *tool, +int perf_event__process_mmap2(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine); -int perf_event__process_fork(struct perf_tool *tool, +int perf_event__process_fork(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine); -int perf_event__process_exit(struct perf_tool *tool, +int perf_event__process_exit(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine); -int perf_event__process_ksymbol(struct perf_tool *tool, +int perf_event__process_ksymbol(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine); -int perf_event__process_bpf(struct perf_tool *tool, +int perf_event__process_bpf(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine); -int perf_event__process_text_poke(struct perf_tool *tool, +int perf_event__process_text_poke(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine); -int perf_event__process(struct perf_tool *tool, +int perf_event__process(const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine); diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index 55e9553861d0..3309fe7f1d12 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c @@ -4326,7 +4326,7 @@ int perf_session__read_header(struct perf_session *se= ssion, int repipe_fd) int perf_event__process_feature(struct perf_session *session, union perf_event *event) { - struct perf_tool *tool =3D session->tool; + const struct perf_tool *tool =3D session->tool; struct feat_fd ff =3D { .fd =3D 0 }; struct perf_record_header_feature *fe =3D (struct perf_record_header_feat= ure *)event; int type =3D fe->header.type; @@ -4405,7 +4405,7 @@ size_t perf_event__fprintf_event_update(union perf_ev= ent *event, FILE *fp) return ret; } =20 -int perf_event__process_attr(struct perf_tool *tool __maybe_unused, +int perf_event__process_attr(const struct perf_tool *tool __maybe_unused, union perf_event *event, struct evlist **pevlist) { @@ -4444,7 +4444,7 @@ int perf_event__process_attr(struct perf_tool *tool _= _maybe_unused, return 0; } =20 -int perf_event__process_event_update(struct perf_tool *tool __maybe_unused, +int perf_event__process_event_update(const struct perf_tool *tool __maybe_= unused, union perf_event *event, struct evlist **pevlist) { diff --git a/tools/perf/util/header.h b/tools/perf/util/header.h index 7c16a250e738..07ff647197ff 100644 --- a/tools/perf/util/header.h +++ b/tools/perf/util/header.h @@ -156,9 +156,9 @@ int perf_header__fprintf_info(struct perf_session *s, F= ILE *fp, bool full); =20 int perf_event__process_feature(struct perf_session *session, union perf_event *event); -int perf_event__process_attr(struct perf_tool *tool, union perf_event *eve= nt, +int perf_event__process_attr(const struct perf_tool *tool, union perf_even= t *event, struct evlist **pevlist); -int perf_event__process_event_update(struct perf_tool *tool, +int perf_event__process_event_update(const struct perf_tool *tool, union perf_event *event, struct evlist **pevlist); size_t perf_event__fprintf_event_update(union perf_event *event, FILE *fp); diff --git a/tools/perf/util/hisi-ptt.c b/tools/perf/util/hisi-ptt.c index 37ea987017f6..e4cc4785f744 100644 --- a/tools/perf/util/hisi-ptt.c +++ b/tools/perf/util/hisi-ptt.c @@ -79,14 +79,14 @@ static void hisi_ptt_dump_event(struct hisi_ptt *ptt, u= nsigned char *buf, static int hisi_ptt_process_event(struct perf_session *session __maybe_unu= sed, union perf_event *event __maybe_unused, struct perf_sample *sample __maybe_unused, - struct perf_tool *tool __maybe_unused) + const struct perf_tool *tool __maybe_unused) { return 0; } =20 static int hisi_ptt_process_auxtrace_event(struct perf_session *session, union perf_event *event, - struct perf_tool *tool __maybe_unused) + const struct perf_tool *tool __maybe_unused) { struct hisi_ptt *ptt =3D container_of(session->auxtrace, struct hisi_ptt, auxtrace); @@ -123,7 +123,7 @@ static int hisi_ptt_process_auxtrace_event(struct perf_= session *session, } =20 static int hisi_ptt_flush(struct perf_session *session __maybe_unused, - struct perf_tool *tool __maybe_unused) + const struct perf_tool *tool __maybe_unused) { return 0; } diff --git a/tools/perf/util/intel-bts.c b/tools/perf/util/intel-bts.c index 160d346cb450..27d9b5c9fec8 100644 --- a/tools/perf/util/intel-bts.c +++ b/tools/perf/util/intel-bts.c @@ -591,7 +591,7 @@ static int intel_bts_process_queues(struct intel_bts *b= ts, u64 timestamp) static int intel_bts_process_event(struct perf_session *session, union perf_event *event, struct perf_sample *sample, - struct perf_tool *tool) + const struct perf_tool *tool) { struct intel_bts *bts =3D container_of(session->auxtrace, struct intel_bt= s, auxtrace); @@ -634,7 +634,7 @@ static int intel_bts_process_event(struct perf_session = *session, =20 static int intel_bts_process_auxtrace_event(struct perf_session *session, union perf_event *event, - struct perf_tool *tool __maybe_unused) + const struct perf_tool *tool __maybe_unused) { struct intel_bts *bts =3D container_of(session->auxtrace, struct intel_bt= s, auxtrace); @@ -675,7 +675,7 @@ static int intel_bts_process_auxtrace_event(struct perf= _session *session, } =20 static int intel_bts_flush(struct perf_session *session, - struct perf_tool *tool __maybe_unused) + const struct perf_tool *tool __maybe_unused) { struct intel_bts *bts =3D container_of(session->auxtrace, struct intel_bt= s, auxtrace); diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c index 1fc03bfd14c3..fd2597613f3d 100644 --- a/tools/perf/util/intel-pt.c +++ b/tools/perf/util/intel-pt.c @@ -3449,7 +3449,7 @@ static int intel_pt_text_poke(struct intel_pt *pt, un= ion perf_event *event) static int intel_pt_process_event(struct perf_session *session, union perf_event *event, struct perf_sample *sample, - struct perf_tool *tool) + const struct perf_tool *tool) { struct intel_pt *pt =3D container_of(session->auxtrace, struct intel_pt, auxtrace); @@ -3533,7 +3533,7 @@ static int intel_pt_process_event(struct perf_session= *session, return err; } =20 -static int intel_pt_flush(struct perf_session *session, struct perf_tool *= tool) +static int intel_pt_flush(struct perf_session *session, const struct perf_= tool *tool) { struct intel_pt *pt =3D container_of(session->auxtrace, struct intel_pt, auxtrace); @@ -3600,7 +3600,7 @@ static bool intel_pt_evsel_is_auxtrace(struct perf_se= ssion *session, =20 static int intel_pt_process_auxtrace_event(struct perf_session *session, union perf_event *event, - struct perf_tool *tool __maybe_unused) + const struct perf_tool *tool __maybe_unused) { struct intel_pt *pt =3D container_of(session->auxtrace, struct intel_pt, auxtrace); diff --git a/tools/perf/util/jitdump.c b/tools/perf/util/jitdump.c index 1f657ef8975f..5ce13653512b 100644 --- a/tools/perf/util/jitdump.c +++ b/tools/perf/util/jitdump.c @@ -424,7 +424,7 @@ static int jit_repipe_code_load(struct jit_buf_desc *jd= , union jr_entry *jr) { struct perf_sample sample; union perf_event *event; - struct perf_tool *tool =3D jd->session->tool; + const struct perf_tool *tool =3D jd->session->tool; uint64_t code, addr; uintptr_t uaddr; char *filename; @@ -543,7 +543,7 @@ static int jit_repipe_code_move(struct jit_buf_desc *jd= , union jr_entry *jr) { struct perf_sample sample; union perf_event *event; - struct perf_tool *tool =3D jd->session->tool; + const struct perf_tool *tool =3D jd->session->tool; char *filename; size_t size; struct stat st; diff --git a/tools/perf/util/s390-cpumsf.c b/tools/perf/util/s390-cpumsf.c index 4ec583e511af..73846b73d0cf 100644 --- a/tools/perf/util/s390-cpumsf.c +++ b/tools/perf/util/s390-cpumsf.c @@ -912,7 +912,7 @@ static int s390_cpumsf_process_event(struct perf_session *session, union perf_event *event, struct perf_sample *sample, - struct perf_tool *tool) + const struct perf_tool *tool) { struct s390_cpumsf *sf =3D container_of(session->auxtrace, struct s390_cpumsf, @@ -955,7 +955,7 @@ s390_cpumsf_process_event(struct perf_session *session, static int s390_cpumsf_process_auxtrace_event(struct perf_session *session, union perf_event *event __maybe_unused, - struct perf_tool *tool __maybe_unused) + const struct perf_tool *tool __maybe_unused) { struct s390_cpumsf *sf =3D container_of(session->auxtrace, struct s390_cpumsf, @@ -998,7 +998,7 @@ static void s390_cpumsf_free_events(struct perf_session= *session __maybe_unused) } =20 static int s390_cpumsf_flush(struct perf_session *session __maybe_unused, - struct perf_tool *tool __maybe_unused) + const struct perf_tool *tool __maybe_unused) { return 0; } diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 18a8f4a84045..7e9827e61d1b 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c @@ -102,7 +102,7 @@ static int perf_session__process_compressed_event(struc= t perf_session *session, =20 static int perf_session__deliver_event(struct perf_session *session, union perf_event *event, - struct perf_tool *tool, + const struct perf_tool *tool, u64 file_offset, const char *file_path); =20 @@ -328,7 +328,7 @@ static int process_event_synth_tracing_data_stub(struct= perf_session *session return 0; } =20 -static int process_event_synth_attr_stub(struct perf_tool *tool __maybe_un= used, +static int process_event_synth_attr_stub(const struct perf_tool *tool __ma= ybe_unused, union perf_event *event __maybe_unused, struct evlist **pevlist __maybe_unused) @@ -337,7 +337,7 @@ static int process_event_synth_attr_stub(struct perf_to= ol *tool __maybe_unused, return 0; } =20 -static int process_event_synth_event_update_stub(struct perf_tool *tool __= maybe_unused, +static int process_event_synth_event_update_stub(const struct perf_tool *t= ool __maybe_unused, union perf_event *event __maybe_unused, struct evlist **pevlist __maybe_unused) @@ -349,7 +349,7 @@ static int process_event_synth_event_update_stub(struct= perf_tool *tool __maybe_ return 0; } =20 -static int process_event_sample_stub(struct perf_tool *tool __maybe_unused, +static int process_event_sample_stub(const struct perf_tool *tool __maybe_= unused, union perf_event *event __maybe_unused, struct perf_sample *sample __maybe_unused, struct evsel *evsel __maybe_unused, @@ -359,7 +359,7 @@ static int process_event_sample_stub(struct perf_tool *= tool __maybe_unused, return 0; } =20 -static int process_event_stub(struct perf_tool *tool __maybe_unused, +static int process_event_stub(const struct perf_tool *tool __maybe_unused, union perf_event *event __maybe_unused, struct perf_sample *sample __maybe_unused, struct machine *machine __maybe_unused) @@ -368,7 +368,7 @@ static int process_event_stub(struct perf_tool *tool __= maybe_unused, return 0; } =20 -static int process_finished_round_stub(struct perf_tool *tool __maybe_unus= ed, +static int process_finished_round_stub(const struct perf_tool *tool __mayb= e_unused, union perf_event *event __maybe_unused, struct ordered_events *oe __maybe_unused) { @@ -1076,7 +1076,7 @@ static perf_event__swap_op perf_event__swap_ops[] =3D= { * Flush every events below timestamp 7 * etc... */ -int perf_event__process_finished_round(struct perf_tool *tool __maybe_unus= ed, +int perf_event__process_finished_round(const struct perf_tool *tool __mayb= e_unused, union perf_event *event __maybe_unused, struct ordered_events *oe) { @@ -1470,7 +1470,7 @@ static struct machine *machines__find_for_cpumode(str= uct machines *machines, } =20 static int deliver_sample_value(struct evlist *evlist, - struct perf_tool *tool, + const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct sample_read_value *v, @@ -1502,7 +1502,7 @@ static int deliver_sample_value(struct evlist *evlist, } =20 static int deliver_sample_group(struct evlist *evlist, - struct perf_tool *tool, + const struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine, @@ -1521,7 +1521,7 @@ static int deliver_sample_group(struct evlist *evlist, return ret; } =20 -static int evlist__deliver_sample(struct evlist *evlist, struct perf_tool = *tool, +static int evlist__deliver_sample(struct evlist *evlist, const struct perf= _tool *tool, union perf_event *event, struct perf_sample *sample, struct evsel *evsel, struct machine *machine) { @@ -1546,7 +1546,7 @@ static int machines__deliver_event(struct machines *m= achines, struct evlist *evlist, union perf_event *event, struct perf_sample *sample, - struct perf_tool *tool, u64 file_offset, + const struct perf_tool *tool, u64 file_offset, const char *file_path) { struct evsel *evsel; @@ -1634,7 +1634,7 @@ static int machines__deliver_event(struct machines *m= achines, =20 static int perf_session__deliver_event(struct perf_session *session, union perf_event *event, - struct perf_tool *tool, + const struct perf_tool *tool, u64 file_offset, const char *file_path) { @@ -1667,7 +1667,7 @@ static s64 perf_session__process_user_event(struct pe= rf_session *session, const char *file_path) { struct ordered_events *oe =3D &session->ordered_events; - struct perf_tool *tool =3D session->tool; + const struct perf_tool *tool =3D session->tool; struct perf_sample sample =3D { .time =3D 0, }; int fd =3D perf_data__fd(session->data); int err; @@ -1754,7 +1754,7 @@ int perf_session__deliver_synth_event(struct perf_ses= sion *session, struct perf_sample *sample) { struct evlist *evlist =3D session->evlist; - struct perf_tool *tool =3D session->tool; + const struct perf_tool *tool =3D session->tool; =20 events_stats__inc(&evlist->stats, event->header.type); =20 @@ -1886,7 +1886,7 @@ static s64 perf_session__process_event(struct perf_se= ssion *session, const char *file_path) { struct evlist *evlist =3D session->evlist; - struct perf_tool *tool =3D session->tool; + const struct perf_tool *tool =3D session->tool; int ret; =20 if (session->header.needs_swap) diff --git a/tools/perf/util/session.h b/tools/perf/util/session.h index cc28976bb00e..6886cc85600f 100644 --- a/tools/perf/util/session.h +++ b/tools/perf/util/session.h @@ -163,7 +163,7 @@ int perf_session__dsos_hit_all(struct perf_session *ses= sion); int perf_event__process_id_index(struct perf_session *session, union perf_event *event); =20 -int perf_event__process_finished_round(struct perf_tool *tool, +int perf_event__process_finished_round(const struct perf_tool *tool, union perf_event *event, struct ordered_events *oe); =20 diff --git a/tools/perf/util/synthetic-events.c b/tools/perf/util/synthetic= -events.c index 5498048f56ea..7f884d70de81 100644 --- a/tools/perf/util/synthetic-events.c +++ b/tools/perf/util/synthetic-events.c @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: GPL-2.0-only=20 +// SPDX-License-Identifier: GPL-2.0-only =20 #include "util/cgroup.h" #include "util/data.h" @@ -47,7 +47,7 @@ =20 unsigned int proc_map_timeout =3D DEFAULT_PROC_MAP_PARSE_TIMEOUT; =20 -int perf_tool__process_synth_event(struct perf_tool *tool, +int perf_tool__process_synth_event(const struct perf_tool *tool, union perf_event *event, struct machine *machine, perf_event__handler_t process) @@ -187,7 +187,7 @@ static int perf_event__prepare_comm(union perf_event *e= vent, pid_t pid, pid_t ti return 0; } =20 -pid_t perf_event__synthesize_comm(struct perf_tool *tool, +pid_t perf_event__synthesize_comm(const struct perf_tool *tool, union perf_event *event, pid_t pid, perf_event__handler_t process, struct machine *machine) @@ -218,7 +218,7 @@ static void perf_event__get_ns_link_info(pid_t pid, con= st char *ns, } } =20 -int perf_event__synthesize_namespaces(struct perf_tool *tool, +int perf_event__synthesize_namespaces(const struct perf_tool *tool, union perf_event *event, pid_t pid, pid_t tgid, perf_event__handler_t process, @@ -257,7 +257,7 @@ int perf_event__synthesize_namespaces(struct perf_tool = *tool, return 0; } =20 -static int perf_event__synthesize_fork(struct perf_tool *tool, +static int perf_event__synthesize_fork(const struct perf_tool *tool, union perf_event *event, pid_t pid, pid_t tgid, pid_t ppid, perf_event__handler_t process, @@ -418,7 +418,7 @@ static void perf_record_mmap2__read_build_id(struct per= f_record_mmap2 *event, dso__put(dso); } =20 -int perf_event__synthesize_mmap_events(struct perf_tool *tool, +int perf_event__synthesize_mmap_events(const struct perf_tool *tool, union perf_event *event, pid_t pid, pid_t tgid, perf_event__handler_t process, @@ -542,7 +542,7 @@ int perf_event__synthesize_mmap_events(struct perf_tool= *tool, } =20 #ifdef HAVE_FILE_HANDLE -static int perf_event__synthesize_cgroup(struct perf_tool *tool, +static int perf_event__synthesize_cgroup(const struct perf_tool *tool, union perf_event *event, char *path, size_t mount_len, perf_event__handler_t process, @@ -582,7 +582,7 @@ static int perf_event__synthesize_cgroup(struct perf_to= ol *tool, return 0; } =20 -static int perf_event__walk_cgroup_tree(struct perf_tool *tool, +static int perf_event__walk_cgroup_tree(const struct perf_tool *tool, union perf_event *event, char *path, size_t mount_len, perf_event__handler_t process, @@ -630,7 +630,7 @@ static int perf_event__walk_cgroup_tree(struct perf_too= l *tool, return ret; } =20 -int perf_event__synthesize_cgroups(struct perf_tool *tool, +int perf_event__synthesize_cgroups(const struct perf_tool *tool, perf_event__handler_t process, struct machine *machine) { @@ -657,7 +657,7 @@ int perf_event__synthesize_cgroups(struct perf_tool *to= ol, return 0; } #else -int perf_event__synthesize_cgroups(struct perf_tool *tool __maybe_unused, +int perf_event__synthesize_cgroups(const struct perf_tool *tool __maybe_un= used, perf_event__handler_t process __maybe_unused, struct machine *machine __maybe_unused) { @@ -666,7 +666,7 @@ int perf_event__synthesize_cgroups(struct perf_tool *to= ol __maybe_unused, #endif =20 struct perf_event__synthesize_modules_maps_cb_args { - struct perf_tool *tool; + const struct perf_tool *tool; perf_event__handler_t process; struct machine *machine; union perf_event *event; @@ -717,7 +717,7 @@ static int perf_event__synthesize_modules_maps_cb(struc= t map *map, void *data) return 0; } =20 -int perf_event__synthesize_modules(struct perf_tool *tool, perf_event__han= dler_t process, +int perf_event__synthesize_modules(const struct perf_tool *tool, perf_even= t__handler_t process, struct machine *machine) { int rc; @@ -763,7 +763,7 @@ static int __event__synthesize_thread(union perf_event = *comm_event, union perf_event *fork_event, union perf_event *namespaces_event, pid_t pid, int full, perf_event__handler_t process, - struct perf_tool *tool, struct machine *machine, + const struct perf_tool *tool, struct machine *machine, bool needs_mmap, bool mmap_data) { char filename[PATH_MAX]; @@ -852,7 +852,7 @@ static int __event__synthesize_thread(union perf_event = *comm_event, return rc; } =20 -int perf_event__synthesize_thread_map(struct perf_tool *tool, +int perf_event__synthesize_thread_map(const struct perf_tool *tool, struct perf_thread_map *threads, perf_event__handler_t process, struct machine *machine, @@ -929,7 +929,7 @@ int perf_event__synthesize_thread_map(struct perf_tool = *tool, return err; } =20 -static int __perf_event__synthesize_threads(struct perf_tool *tool, +static int __perf_event__synthesize_threads(const struct perf_tool *tool, perf_event__handler_t process, struct machine *machine, bool needs_mmap, @@ -993,7 +993,7 @@ static int __perf_event__synthesize_threads(struct perf= _tool *tool, } =20 struct synthesize_threads_arg { - struct perf_tool *tool; + const struct perf_tool *tool; perf_event__handler_t process; struct machine *machine; bool needs_mmap; @@ -1015,7 +1015,7 @@ static void *synthesize_threads_worker(void *arg) return NULL; } =20 -int perf_event__synthesize_threads(struct perf_tool *tool, +int perf_event__synthesize_threads(const struct perf_tool *tool, perf_event__handler_t process, struct machine *machine, bool needs_mmap, bool mmap_data, @@ -1104,14 +1104,14 @@ int perf_event__synthesize_threads(struct perf_tool= *tool, return err; } =20 -int __weak perf_event__synthesize_extra_kmaps(struct perf_tool *tool __may= be_unused, +int __weak perf_event__synthesize_extra_kmaps(const struct perf_tool *tool= __maybe_unused, perf_event__handler_t process __maybe_unused, struct machine *machine __maybe_unused) { return 0; } =20 -static int __perf_event__synthesize_kernel_mmap(struct perf_tool *tool, +static int __perf_event__synthesize_kernel_mmap(const struct perf_tool *to= ol, perf_event__handler_t process, struct machine *machine) { @@ -1183,7 +1183,7 @@ static int __perf_event__synthesize_kernel_mmap(struc= t perf_tool *tool, return err; } =20 -int perf_event__synthesize_kernel_mmap(struct perf_tool *tool, +int perf_event__synthesize_kernel_mmap(const struct perf_tool *tool, perf_event__handler_t process, struct machine *machine) { @@ -1196,7 +1196,7 @@ int perf_event__synthesize_kernel_mmap(struct perf_to= ol *tool, return perf_event__synthesize_extra_kmaps(tool, process, machine); } =20 -int perf_event__synthesize_thread_map2(struct perf_tool *tool, +int perf_event__synthesize_thread_map2(const struct perf_tool *tool, struct perf_thread_map *threads, perf_event__handler_t process, struct machine *machine) @@ -1346,7 +1346,7 @@ static struct perf_record_cpu_map *cpu_map_event__new= (const struct perf_cpu_map } =20 =20 -int perf_event__synthesize_cpu_map(struct perf_tool *tool, +int perf_event__synthesize_cpu_map(const struct perf_tool *tool, const struct perf_cpu_map *map, perf_event__handler_t process, struct machine *machine) @@ -1364,7 +1364,7 @@ int perf_event__synthesize_cpu_map(struct perf_tool *= tool, return err; } =20 -int perf_event__synthesize_stat_config(struct perf_tool *tool, +int perf_event__synthesize_stat_config(const struct perf_tool *tool, struct perf_stat_config *config, perf_event__handler_t process, struct machine *machine) @@ -1403,7 +1403,7 @@ int perf_event__synthesize_stat_config(struct perf_to= ol *tool, return err; } =20 -int perf_event__synthesize_stat(struct perf_tool *tool, +int perf_event__synthesize_stat(const struct perf_tool *tool, struct perf_cpu cpu, u32 thread, u64 id, struct perf_counts_values *count, perf_event__handler_t process, @@ -1425,7 +1425,7 @@ int perf_event__synthesize_stat(struct perf_tool *too= l, return process(tool, (union perf_event *) &event, NULL, machine); } =20 -int perf_event__synthesize_stat_round(struct perf_tool *tool, +int perf_event__synthesize_stat_round(const struct perf_tool *tool, u64 evtime, u64 type, perf_event__handler_t process, struct machine *machine) @@ -1826,7 +1826,7 @@ int perf_event__synthesize_id_sample(__u64 *array, u6= 4 type, const struct perf_s return (void *)array - (void *)start; } =20 -int __perf_event__synthesize_id_index(struct perf_tool *tool, perf_event__= handler_t process, +int __perf_event__synthesize_id_index(const struct perf_tool *tool, perf_e= vent__handler_t process, struct evlist *evlist, struct machine *machine, size_t from) { union perf_event *ev; @@ -1918,13 +1918,13 @@ int __perf_event__synthesize_id_index(struct perf_t= ool *tool, perf_event__handle return err; } =20 -int perf_event__synthesize_id_index(struct perf_tool *tool, perf_event__ha= ndler_t process, +int perf_event__synthesize_id_index(const struct perf_tool *tool, perf_eve= nt__handler_t process, struct evlist *evlist, struct machine *machine) { return __perf_event__synthesize_id_index(tool, process, evlist, machine, = 0); } =20 -int __machine__synthesize_threads(struct machine *machine, struct perf_too= l *tool, +int __machine__synthesize_threads(struct machine *machine, const struct pe= rf_tool *tool, struct target *target, struct perf_thread_map *threads, perf_event__handler_t process, bool needs_mmap, bool data_mmap, unsigned int nr_threads_synthesize) @@ -1985,7 +1985,7 @@ static struct perf_record_event_update *event_update_= event__new(size_t size, u64 return ev; } =20 -int perf_event__synthesize_event_update_unit(struct perf_tool *tool, struc= t evsel *evsel, +int perf_event__synthesize_event_update_unit(const struct perf_tool *tool,= struct evsel *evsel, perf_event__handler_t process) { size_t size =3D strlen(evsel->unit); @@ -2002,7 +2002,7 @@ int perf_event__synthesize_event_update_unit(struct p= erf_tool *tool, struct evse return err; } =20 -int perf_event__synthesize_event_update_scale(struct perf_tool *tool, stru= ct evsel *evsel, +int perf_event__synthesize_event_update_scale(const struct perf_tool *tool= , struct evsel *evsel, perf_event__handler_t process) { struct perf_record_event_update *ev; @@ -2019,7 +2019,7 @@ int perf_event__synthesize_event_update_scale(struct = perf_tool *tool, struct evs return err; } =20 -int perf_event__synthesize_event_update_name(struct perf_tool *tool, struc= t evsel *evsel, +int perf_event__synthesize_event_update_name(const struct perf_tool *tool,= struct evsel *evsel, perf_event__handler_t process) { struct perf_record_event_update *ev; @@ -2036,7 +2036,7 @@ int perf_event__synthesize_event_update_name(struct p= erf_tool *tool, struct evse return err; } =20 -int perf_event__synthesize_event_update_cpus(struct perf_tool *tool, struc= t evsel *evsel, +int perf_event__synthesize_event_update_cpus(const struct perf_tool *tool,= struct evsel *evsel, perf_event__handler_t process) { struct synthesize_cpu_map_data syn_data =3D { .map =3D evsel->core.own_cp= us }; @@ -2059,7 +2059,7 @@ int perf_event__synthesize_event_update_cpus(struct p= erf_tool *tool, struct evse return err; } =20 -int perf_event__synthesize_attrs(struct perf_tool *tool, struct evlist *ev= list, +int perf_event__synthesize_attrs(const struct perf_tool *tool, struct evli= st *evlist, perf_event__handler_t process) { struct evsel *evsel; @@ -2087,7 +2087,7 @@ static bool has_scale(struct evsel *evsel) return evsel->scale !=3D 1; } =20 -int perf_event__synthesize_extra_attr(struct perf_tool *tool, struct evlis= t *evsel_list, +int perf_event__synthesize_extra_attr(const struct perf_tool *tool, struct= evlist *evsel_list, perf_event__handler_t process, bool is_pipe) { struct evsel *evsel; @@ -2143,7 +2143,7 @@ int perf_event__synthesize_extra_attr(struct perf_too= l *tool, struct evlist *evs return 0; } =20 -int perf_event__synthesize_attr(struct perf_tool *tool, struct perf_event_= attr *attr, +int perf_event__synthesize_attr(const struct perf_tool *tool, struct perf_= event_attr *attr, u32 ids, u64 *id, perf_event__handler_t process) { union perf_event *ev; @@ -2177,7 +2177,7 @@ int perf_event__synthesize_attr(struct perf_tool *too= l, struct perf_event_attr * } =20 #ifdef HAVE_LIBTRACEEVENT -int perf_event__synthesize_tracing_data(struct perf_tool *tool, int fd, st= ruct evlist *evlist, +int perf_event__synthesize_tracing_data(const struct perf_tool *tool, int = fd, struct evlist *evlist, perf_event__handler_t process) { union perf_event ev; @@ -2225,7 +2225,7 @@ int perf_event__synthesize_tracing_data(struct perf_t= ool *tool, int fd, struct e } #endif =20 -int perf_event__synthesize_build_id(struct perf_tool *tool, struct dso *po= s, u16 misc, +int perf_event__synthesize_build_id(const struct perf_tool *tool, struct d= so *pos, u16 misc, perf_event__handler_t process, struct machine *machine) { union perf_event ev; @@ -2249,7 +2249,7 @@ int perf_event__synthesize_build_id(struct perf_tool = *tool, struct dso *pos, u16 return process(tool, &ev, NULL, machine); } =20 -int perf_event__synthesize_stat_events(struct perf_stat_config *config, st= ruct perf_tool *tool, +int perf_event__synthesize_stat_events(struct perf_stat_config *config, co= nst struct perf_tool *tool, struct evlist *evlist, perf_event__handler_t process, bool attr= s) { int err; @@ -2286,7 +2286,7 @@ int perf_event__synthesize_stat_events(struct perf_st= at_config *config, struct p =20 extern const struct perf_header_feature_ops feat_ops[HEADER_LAST_FEATURE]; =20 -int perf_event__synthesize_features(struct perf_tool *tool, struct perf_se= ssion *session, +int perf_event__synthesize_features(const struct perf_tool *tool, struct p= erf_session *session, struct evlist *evlist, perf_event__handler_t process) { struct perf_header *header =3D &session->header; @@ -2349,7 +2349,7 @@ int perf_event__synthesize_features(struct perf_tool = *tool, struct perf_session return ret; } =20 -int perf_event__synthesize_for_pipe(struct perf_tool *tool, +int perf_event__synthesize_for_pipe(const struct perf_tool *tool, struct perf_session *session, struct perf_data *data, perf_event__handler_t process) diff --git a/tools/perf/util/synthetic-events.h b/tools/perf/util/synthetic= -events.h index 53737d1619a4..31df7653677f 100644 --- a/tools/perf/util/synthetic-events.h +++ b/tools/perf/util/synthetic-events.h @@ -40,45 +40,45 @@ enum perf_record_synth { =20 int parse_synth_opt(char *str); =20 -typedef int (*perf_event__handler_t)(struct perf_tool *tool, union perf_ev= ent *event, +typedef int (*perf_event__handler_t)(const struct perf_tool *tool, union p= erf_event *event, struct perf_sample *sample, struct machine *machine); =20 -int perf_event__synthesize_attrs(struct perf_tool *tool, struct evlist *ev= list, perf_event__handler_t process); -int perf_event__synthesize_attr(struct perf_tool *tool, struct perf_event_= attr *attr, u32 ids, u64 *id, perf_event__handler_t process); -int perf_event__synthesize_build_id(struct perf_tool *tool, struct dso *po= s, u16 misc, perf_event__handler_t process, struct machine *machine); -int perf_event__synthesize_cpu_map(struct perf_tool *tool, const struct pe= rf_cpu_map *cpus, perf_event__handler_t process, struct machine *machine); -int perf_event__synthesize_event_update_cpus(struct perf_tool *tool, struc= t evsel *evsel, perf_event__handler_t process); -int perf_event__synthesize_event_update_name(struct perf_tool *tool, struc= t evsel *evsel, perf_event__handler_t process); -int perf_event__synthesize_event_update_scale(struct perf_tool *tool, stru= ct evsel *evsel, perf_event__handler_t process); -int perf_event__synthesize_event_update_unit(struct perf_tool *tool, struc= t evsel *evsel, perf_event__handler_t process); -int perf_event__synthesize_extra_attr(struct perf_tool *tool, struct evlis= t *evsel_list, perf_event__handler_t process, bool is_pipe); -int perf_event__synthesize_extra_kmaps(struct perf_tool *tool, perf_event_= _handler_t process, struct machine *machine); -int perf_event__synthesize_features(struct perf_tool *tool, struct perf_se= ssion *session, struct evlist *evlist, perf_event__handler_t process); -int perf_event__synthesize_id_index(struct perf_tool *tool, perf_event__ha= ndler_t process, struct evlist *evlist, struct machine *machine); -int __perf_event__synthesize_id_index(struct perf_tool *tool, perf_event__= handler_t process, struct evlist *evlist, struct machine *machine, size_t f= rom); +int perf_event__synthesize_attrs(const struct perf_tool *tool, struct evli= st *evlist, perf_event__handler_t process); +int perf_event__synthesize_attr(const struct perf_tool *tool, struct perf_= event_attr *attr, u32 ids, u64 *id, perf_event__handler_t process); +int perf_event__synthesize_build_id(const struct perf_tool *tool, struct d= so *pos, u16 misc, perf_event__handler_t process, struct machine *machine); +int perf_event__synthesize_cpu_map(const struct perf_tool *tool, const str= uct perf_cpu_map *cpus, perf_event__handler_t process, struct machine *mach= ine); +int perf_event__synthesize_event_update_cpus(const struct perf_tool *tool,= struct evsel *evsel, perf_event__handler_t process); +int perf_event__synthesize_event_update_name(const struct perf_tool *tool,= struct evsel *evsel, perf_event__handler_t process); +int perf_event__synthesize_event_update_scale(const struct perf_tool *tool= , struct evsel *evsel, perf_event__handler_t process); +int perf_event__synthesize_event_update_unit(const struct perf_tool *tool,= struct evsel *evsel, perf_event__handler_t process); +int perf_event__synthesize_extra_attr(const struct perf_tool *tool, struct= evlist *evsel_list, perf_event__handler_t process, bool is_pipe); +int perf_event__synthesize_extra_kmaps(const struct perf_tool *tool, perf_= event__handler_t process, struct machine *machine); +int perf_event__synthesize_features(const struct perf_tool *tool, struct p= erf_session *session, struct evlist *evlist, perf_event__handler_t process); +int perf_event__synthesize_id_index(const struct perf_tool *tool, perf_eve= nt__handler_t process, struct evlist *evlist, struct machine *machine); +int __perf_event__synthesize_id_index(const struct perf_tool *tool, perf_e= vent__handler_t process, struct evlist *evlist, struct machine *machine, si= ze_t from); int perf_event__synthesize_id_sample(__u64 *array, u64 type, const struct = perf_sample *sample); -int perf_event__synthesize_kernel_mmap(struct perf_tool *tool, perf_event_= _handler_t process, struct machine *machine); -int perf_event__synthesize_mmap_events(struct perf_tool *tool, union perf_= event *event, pid_t pid, pid_t tgid, perf_event__handler_t process, struct = machine *machine, bool mmap_data); -int perf_event__synthesize_modules(struct perf_tool *tool, perf_event__han= dler_t process, struct machine *machine); -int perf_event__synthesize_namespaces(struct perf_tool *tool, union perf_e= vent *event, pid_t pid, pid_t tgid, perf_event__handler_t process, struct m= achine *machine); -int perf_event__synthesize_cgroups(struct perf_tool *tool, perf_event__han= dler_t process, struct machine *machine); +int perf_event__synthesize_kernel_mmap(const struct perf_tool *tool, perf_= event__handler_t process, struct machine *machine); +int perf_event__synthesize_mmap_events(const struct perf_tool *tool, union= perf_event *event, pid_t pid, pid_t tgid, perf_event__handler_t process, s= truct machine *machine, bool mmap_data); +int perf_event__synthesize_modules(const struct perf_tool *tool, perf_even= t__handler_t process, struct machine *machine); +int perf_event__synthesize_namespaces(const struct perf_tool *tool, union = perf_event *event, pid_t pid, pid_t tgid, perf_event__handler_t process, st= ruct machine *machine); +int perf_event__synthesize_cgroups(const struct perf_tool *tool, perf_even= t__handler_t process, struct machine *machine); int perf_event__synthesize_sample(union perf_event *event, u64 type, u64 r= ead_format, const struct perf_sample *sample); -int perf_event__synthesize_stat_config(struct perf_tool *tool, struct perf= _stat_config *config, perf_event__handler_t process, struct machine *machin= e); -int perf_event__synthesize_stat_events(struct perf_stat_config *config, st= ruct perf_tool *tool, struct evlist *evlist, perf_event__handler_t process,= bool attrs); -int perf_event__synthesize_stat_round(struct perf_tool *tool, u64 time, u6= 4 type, perf_event__handler_t process, struct machine *machine); -int perf_event__synthesize_stat(struct perf_tool *tool, struct perf_cpu cp= u, u32 thread, u64 id, struct perf_counts_values *count, perf_event__handle= r_t process, struct machine *machine); -int perf_event__synthesize_thread_map2(struct perf_tool *tool, struct perf= _thread_map *threads, perf_event__handler_t process, struct machine *machin= e); -int perf_event__synthesize_thread_map(struct perf_tool *tool, struct perf_= thread_map *threads, perf_event__handler_t process, struct machine *machine= , bool needs_mmap, bool mmap_data); -int perf_event__synthesize_threads(struct perf_tool *tool, perf_event__han= dler_t process, struct machine *machine, bool needs_mmap, bool mmap_data, u= nsigned int nr_threads_synthesize); -int perf_event__synthesize_tracing_data(struct perf_tool *tool, int fd, st= ruct evlist *evlist, perf_event__handler_t process); -int perf_event__synth_time_conv(const struct perf_event_mmap_page *pc, str= uct perf_tool *tool, perf_event__handler_t process, struct machine *machine= ); -pid_t perf_event__synthesize_comm(struct perf_tool *tool, union perf_event= *event, pid_t pid, perf_event__handler_t process, struct machine *machine); - -int perf_tool__process_synth_event(struct perf_tool *tool, union perf_even= t *event, struct machine *machine, perf_event__handler_t process); +int perf_event__synthesize_stat_config(const struct perf_tool *tool, struc= t perf_stat_config *config, perf_event__handler_t process, struct machine *= machine); +int perf_event__synthesize_stat_events(struct perf_stat_config *config, co= nst struct perf_tool *tool, struct evlist *evlist, perf_event__handler_t pr= ocess, bool attrs); +int perf_event__synthesize_stat_round(const struct perf_tool *tool, u64 ti= me, u64 type, perf_event__handler_t process, struct machine *machine); +int perf_event__synthesize_stat(const struct perf_tool *tool, struct perf_= cpu cpu, u32 thread, u64 id, struct perf_counts_values *count, perf_event__= handler_t process, struct machine *machine); +int perf_event__synthesize_thread_map2(const struct perf_tool *tool, struc= t perf_thread_map *threads, perf_event__handler_t process, struct machine *= machine); +int perf_event__synthesize_thread_map(const struct perf_tool *tool, struct= perf_thread_map *threads, perf_event__handler_t process, struct machine *m= achine, bool needs_mmap, bool mmap_data); +int perf_event__synthesize_threads(const struct perf_tool *tool, perf_even= t__handler_t process, struct machine *machine, bool needs_mmap, bool mmap_d= ata, unsigned int nr_threads_synthesize); +int perf_event__synthesize_tracing_data(const struct perf_tool *tool, int = fd, struct evlist *evlist, perf_event__handler_t process); +int perf_event__synth_time_conv(const struct perf_event_mmap_page *pc, con= st struct perf_tool *tool, perf_event__handler_t process, struct machine *m= achine); +pid_t perf_event__synthesize_comm(const struct perf_tool *tool, union perf= _event *event, pid_t pid, perf_event__handler_t process, struct machine *ma= chine); + +int perf_tool__process_synth_event(const struct perf_tool *tool, union per= f_event *event, struct machine *machine, perf_event__handler_t process); =20 size_t perf_event__sample_event_size(const struct perf_sample *sample, u64= type, u64 read_format); =20 -int __machine__synthesize_threads(struct machine *machine, struct perf_too= l *tool, +int __machine__synthesize_threads(struct machine *machine, const struct pe= rf_tool *tool, struct target *target, struct perf_thread_map *threads, perf_event__handler_t process, bool needs_mmap, bool data_mmap, unsigned int nr_threads_synthesize); @@ -87,7 +87,7 @@ int machine__synthesize_threads(struct machine *machine, = struct target *target, unsigned int nr_threads_synthesize); =20 #ifdef HAVE_AUXTRACE_SUPPORT -int perf_event__synthesize_auxtrace_info(struct auxtrace_record *itr, stru= ct perf_tool *tool, +int perf_event__synthesize_auxtrace_info(struct auxtrace_record *itr, cons= t struct perf_tool *tool, struct perf_session *session, perf_event__handler_t process); =20 #else // HAVE_AUXTRACE_SUPPORT @@ -96,7 +96,7 @@ int perf_event__synthesize_auxtrace_info(struct auxtrace_= record *itr, struct per =20 static inline int perf_event__synthesize_auxtrace_info(struct auxtrace_record *itr __maybe_u= nused, - struct perf_tool *tool __maybe_unused, + const struct perf_tool *tool __maybe_unused, struct perf_session *session __maybe_unused, perf_event__handler_t process __maybe_unused) { @@ -117,7 +117,7 @@ static inline int perf_event__synthesize_bpf_events(str= uct perf_session *session } #endif // HAVE_LIBBPF_SUPPORT =20 -int perf_event__synthesize_for_pipe(struct perf_tool *tool, +int perf_event__synthesize_for_pipe(const struct perf_tool *tool, struct perf_session *session, struct perf_data *data, perf_event__handler_t process); diff --git a/tools/perf/util/tool.h b/tools/perf/util/tool.h index c957fb849ac6..b192d44fe91f 100644 --- a/tools/perf/util/tool.h +++ b/tools/perf/util/tool.h @@ -15,14 +15,14 @@ struct perf_tool; struct machine; struct ordered_events; =20 -typedef int (*event_sample)(struct perf_tool *tool, union perf_event *even= t, +typedef int (*event_sample)(const struct perf_tool *tool, union perf_event= *event, struct perf_sample *sample, struct evsel *evsel, struct machine *machine); =20 -typedef int (*event_op)(struct perf_tool *tool, union perf_event *event, +typedef int (*event_op)(const struct perf_tool *tool, union perf_event *ev= ent, struct perf_sample *sample, struct machine *machine); =20 -typedef int (*event_attr_op)(struct perf_tool *tool, +typedef int (*event_attr_op)(const struct perf_tool *tool, union perf_event *event, struct evlist **pevlist); =20 @@ -31,7 +31,7 @@ typedef s64 (*event_op3)(struct perf_session *session, un= ion perf_event *event); typedef int (*event_op4)(struct perf_session *session, union perf_event *e= vent, u64 data, const char *str); =20 -typedef int (*event_oe)(struct perf_tool *tool, union perf_event *event, +typedef int (*event_oe)(const struct perf_tool *tool, union perf_event *ev= ent, struct ordered_events *oe); =20 enum show_feature_header { diff --git a/tools/perf/util/tsc.c b/tools/perf/util/tsc.c index f19791d46e99..2e33a20e1e1b 100644 --- a/tools/perf/util/tsc.c +++ b/tools/perf/util/tsc.c @@ -72,7 +72,7 @@ int perf_read_tsc_conversion(const struct perf_event_mmap= _page *pc, } =20 int perf_event__synth_time_conv(const struct perf_event_mmap_page *pc, - struct perf_tool *tool, + const struct perf_tool *tool, perf_event__handler_t process, struct machine *machine) { --=20 2.45.2.993.g49e7a77208-goog