Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf tool: Constify tool pointers

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.

Reviewed-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ian Rogers <irogers@google.com>
Tested-by: Adrian Hunter <adrian.hunter@intel.com>
Tested-by: Leo Yan <leo.yan@arm.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: Ilkka Koskinen <ilkka@os.amperecomputing.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@arm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Garry <john.g.garry@oracle.com>
Cc: Jonathan Cameron <jonathan.cameron@huawei.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Leo Yan <leo.yan@linux.dev>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Nick Terrell <terrelln@fb.com>
Cc: Oliver Upton <oliver.upton@linux.dev>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Song Liu <song@kernel.org>
Cc: Sun Haiyong <sunhaiyong@loongson.cn>
Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Yanteng Si <siyanteng@loongson.cn>
Cc: Yicong Yang <yangyicong@hisilicon.com>
Cc: linux-arm-kernel@lists.infradead.org
Link: https://lore.kernel.org/r/20240812204720.631678-4-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Ian Rogers and committed by
Arnaldo Carvalho de Melo
30f29bae 1816dc4b

+313 -315
+2 -2
tools/perf/arch/x86/util/event.c
··· 15 15 #if defined(__x86_64__) 16 16 17 17 struct perf_event__synthesize_extra_kmaps_cb_args { 18 - struct perf_tool *tool; 18 + const struct perf_tool *tool; 19 19 perf_event__handler_t process; 20 20 struct machine *machine; 21 21 union perf_event *event; ··· 65 65 return 0; 66 66 } 67 67 68 - int perf_event__synthesize_extra_kmaps(struct perf_tool *tool, 68 + int perf_event__synthesize_extra_kmaps(const struct perf_tool *tool, 69 69 perf_event__handler_t process, 70 70 struct machine *machine) 71 71 {
+1 -1
tools/perf/bench/synthesize.c
··· 49 49 50 50 static atomic_t event_count; 51 51 52 - static int process_synthesized_event(struct perf_tool *tool __maybe_unused, 52 + static int process_synthesized_event(const struct perf_tool *tool __maybe_unused, 53 53 union perf_event *event __maybe_unused, 54 54 struct perf_sample *sample __maybe_unused, 55 55 struct machine *machine __maybe_unused)
+1 -1
tools/perf/builtin-annotate.c
··· 279 279 return ret; 280 280 } 281 281 282 - static int process_sample_event(struct perf_tool *tool, 282 + static int process_sample_event(const struct perf_tool *tool, 283 283 union perf_event *event, 284 284 struct perf_sample *sample, 285 285 struct evsel *evsel,
+1 -1
tools/perf/builtin-c2c.c
··· 273 273 update_stats(&cstats->load, weight); 274 274 } 275 275 276 - static int process_sample_event(struct perf_tool *tool __maybe_unused, 276 + static int process_sample_event(const struct perf_tool *tool __maybe_unused, 277 277 union perf_event *event, 278 278 struct perf_sample *sample, 279 279 struct evsel *evsel,
+1 -1
tools/perf/builtin-diff.c
··· 388 388 .free = block_hist_free, 389 389 }; 390 390 391 - static int diff__process_sample_event(struct perf_tool *tool, 391 + static int diff__process_sample_event(const struct perf_tool *tool, 392 392 union perf_event *event, 393 393 struct perf_sample *sample, 394 394 struct evsel *evsel,
+35 -35
tools/perf/builtin-inject.c
··· 134 134 union perf_event event[]; 135 135 }; 136 136 137 - static int dso__inject_build_id(struct dso *dso, struct perf_tool *tool, 137 + static int dso__inject_build_id(struct dso *dso, const struct perf_tool *tool, 138 138 struct machine *machine, u8 cpumode, u32 flags); 139 139 140 140 static int output_bytes(struct perf_inject *inject, void *buf, size_t sz) ··· 149 149 return 0; 150 150 } 151 151 152 - static int perf_event__repipe_synth(struct perf_tool *tool, 152 + static int perf_event__repipe_synth(const struct perf_tool *tool, 153 153 union perf_event *event) 154 154 { 155 155 struct perf_inject *inject = container_of(tool, struct perf_inject, ··· 158 158 return output_bytes(inject, event, event->header.size); 159 159 } 160 160 161 - static int perf_event__repipe_oe_synth(struct perf_tool *tool, 161 + static int perf_event__repipe_oe_synth(const struct perf_tool *tool, 162 162 union perf_event *event, 163 163 struct ordered_events *oe __maybe_unused) 164 164 { ··· 166 166 } 167 167 168 168 #ifdef HAVE_JITDUMP 169 - static int perf_event__drop_oe(struct perf_tool *tool __maybe_unused, 169 + static int perf_event__drop_oe(const struct perf_tool *tool __maybe_unused, 170 170 union perf_event *event __maybe_unused, 171 171 struct ordered_events *oe __maybe_unused) 172 172 { ··· 188 188 return perf_event__repipe_synth(session->tool, event); 189 189 } 190 190 191 - static int perf_event__repipe_attr(struct perf_tool *tool, 191 + static int perf_event__repipe_attr(const struct perf_tool *tool, 192 192 union perf_event *event, 193 193 struct evlist **pevlist) 194 194 { ··· 206 206 return perf_event__repipe_synth(tool, event); 207 207 } 208 208 209 - static int perf_event__repipe_event_update(struct perf_tool *tool, 209 + static int perf_event__repipe_event_update(const struct perf_tool *tool, 210 210 union perf_event *event, 211 211 struct evlist **pevlist __maybe_unused) 212 212 { ··· 237 237 static s64 perf_event__repipe_auxtrace(struct perf_session *session, 238 238 union perf_event *event) 239 239 { 240 - struct perf_tool *tool = session->tool; 240 + const struct perf_tool *tool = session->tool; 241 241 struct perf_inject *inject = container_of(tool, struct perf_inject, 242 242 tool); 243 243 int ret; ··· 284 284 285 285 #endif 286 286 287 - static int perf_event__repipe(struct perf_tool *tool, 287 + static int perf_event__repipe(const struct perf_tool *tool, 288 288 union perf_event *event, 289 289 struct perf_sample *sample __maybe_unused, 290 290 struct machine *machine __maybe_unused) ··· 292 292 return perf_event__repipe_synth(tool, event); 293 293 } 294 294 295 - static int perf_event__drop(struct perf_tool *tool __maybe_unused, 295 + static int perf_event__drop(const struct perf_tool *tool __maybe_unused, 296 296 union perf_event *event __maybe_unused, 297 297 struct perf_sample *sample __maybe_unused, 298 298 struct machine *machine __maybe_unused) ··· 300 300 return 0; 301 301 } 302 302 303 - static int perf_event__drop_aux(struct perf_tool *tool, 303 + static int perf_event__drop_aux(const struct perf_tool *tool, 304 304 union perf_event *event __maybe_unused, 305 305 struct perf_sample *sample, 306 306 struct machine *machine __maybe_unused) ··· 341 341 return ev; 342 342 } 343 343 344 - typedef int (*inject_handler)(struct perf_tool *tool, 344 + typedef int (*inject_handler)(const struct perf_tool *tool, 345 345 union perf_event *event, 346 346 struct perf_sample *sample, 347 347 struct evsel *evsel, 348 348 struct machine *machine); 349 349 350 - static int perf_event__repipe_sample(struct perf_tool *tool, 350 + static int perf_event__repipe_sample(const struct perf_tool *tool, 351 351 union perf_event *event, 352 352 struct perf_sample *sample, 353 353 struct evsel *evsel, ··· 372 372 return perf_event__repipe_synth(tool, event); 373 373 } 374 374 375 - static int perf_event__repipe_mmap(struct perf_tool *tool, 375 + static int perf_event__repipe_mmap(const struct perf_tool *tool, 376 376 union perf_event *event, 377 377 struct perf_sample *sample, 378 378 struct machine *machine) ··· 386 386 } 387 387 388 388 #ifdef HAVE_JITDUMP 389 - static int perf_event__jit_repipe_mmap(struct perf_tool *tool, 389 + static int perf_event__jit_repipe_mmap(const struct perf_tool *tool, 390 390 union perf_event *event, 391 391 struct perf_sample *sample, 392 392 struct machine *machine) ··· 455 455 return dso; 456 456 } 457 457 458 - static int perf_event__repipe_buildid_mmap(struct perf_tool *tool, 458 + static int perf_event__repipe_buildid_mmap(const struct perf_tool *tool, 459 459 union perf_event *event, 460 460 struct perf_sample *sample, 461 461 struct machine *machine) ··· 474 474 return perf_event__repipe(tool, event, sample, machine); 475 475 } 476 476 477 - static int perf_event__repipe_mmap2(struct perf_tool *tool, 477 + static int perf_event__repipe_mmap2(const struct perf_tool *tool, 478 478 union perf_event *event, 479 479 struct perf_sample *sample, 480 480 struct machine *machine) ··· 500 500 } 501 501 502 502 #ifdef HAVE_JITDUMP 503 - static int perf_event__jit_repipe_mmap2(struct perf_tool *tool, 503 + static int perf_event__jit_repipe_mmap2(const struct perf_tool *tool, 504 504 union perf_event *event, 505 505 struct perf_sample *sample, 506 506 struct machine *machine) ··· 524 524 } 525 525 #endif 526 526 527 - static int perf_event__repipe_buildid_mmap2(struct perf_tool *tool, 527 + static int perf_event__repipe_buildid_mmap2(const struct perf_tool *tool, 528 528 union perf_event *event, 529 529 struct perf_sample *sample, 530 530 struct machine *machine) ··· 565 565 return 0; 566 566 } 567 567 568 - static int perf_event__repipe_fork(struct perf_tool *tool, 568 + static int perf_event__repipe_fork(const struct perf_tool *tool, 569 569 union perf_event *event, 570 570 struct perf_sample *sample, 571 571 struct machine *machine) ··· 578 578 return err; 579 579 } 580 580 581 - static int perf_event__repipe_comm(struct perf_tool *tool, 581 + static int perf_event__repipe_comm(const struct perf_tool *tool, 582 582 union perf_event *event, 583 583 struct perf_sample *sample, 584 584 struct machine *machine) ··· 591 591 return err; 592 592 } 593 593 594 - static int perf_event__repipe_namespaces(struct perf_tool *tool, 594 + static int perf_event__repipe_namespaces(const struct perf_tool *tool, 595 595 union perf_event *event, 596 596 struct perf_sample *sample, 597 597 struct machine *machine) ··· 603 603 return err; 604 604 } 605 605 606 - static int perf_event__repipe_exit(struct perf_tool *tool, 606 + static int perf_event__repipe_exit(const struct perf_tool *tool, 607 607 union perf_event *event, 608 608 struct perf_sample *sample, 609 609 struct machine *machine) ··· 712 712 return false; 713 713 } 714 714 715 - static int dso__inject_build_id(struct dso *dso, struct perf_tool *tool, 715 + static int dso__inject_build_id(struct dso *dso, const struct perf_tool *tool, 716 716 struct machine *machine, u8 cpumode, u32 flags) 717 717 { 718 718 struct perf_inject *inject = container_of(tool, struct perf_inject, ··· 743 743 return 0; 744 744 } 745 745 746 - int perf_event__inject_buildid(struct perf_tool *tool, union perf_event *event, 746 + int perf_event__inject_buildid(const struct perf_tool *tool, union perf_event *event, 747 747 struct perf_sample *sample, 748 748 struct evsel *evsel __maybe_unused, 749 749 struct machine *machine) ··· 776 776 return 0; 777 777 } 778 778 779 - static int perf_inject__sched_process_exit(struct perf_tool *tool, 779 + static int perf_inject__sched_process_exit(const struct perf_tool *tool, 780 780 union perf_event *event __maybe_unused, 781 781 struct perf_sample *sample, 782 782 struct evsel *evsel __maybe_unused, ··· 796 796 return 0; 797 797 } 798 798 799 - static int perf_inject__sched_switch(struct perf_tool *tool, 799 + static int perf_inject__sched_switch(const struct perf_tool *tool, 800 800 union perf_event *event, 801 801 struct perf_sample *sample, 802 802 struct evsel *evsel, ··· 821 821 } 822 822 823 823 #ifdef HAVE_LIBTRACEEVENT 824 - static int perf_inject__sched_stat(struct perf_tool *tool, 824 + static int perf_inject__sched_stat(const struct perf_tool *tool, 825 825 union perf_event *event __maybe_unused, 826 826 struct perf_sample *sample, 827 827 struct evsel *evsel, ··· 866 866 return ret < 0 ? ret : 0; 867 867 } 868 868 869 - static int guest_session__repipe(struct perf_tool *tool, 869 + static int guest_session__repipe(const struct perf_tool *tool, 870 870 union perf_event *event, 871 871 struct perf_sample *sample __maybe_unused, 872 872 struct machine *machine __maybe_unused) ··· 1032 1032 return NULL; 1033 1033 } 1034 1034 1035 - static int process_attr(struct perf_tool *tool, union perf_event *event, 1035 + static int process_attr(const struct perf_tool *tool, union perf_event *event, 1036 1036 struct perf_sample *sample __maybe_unused, 1037 1037 struct machine *machine __maybe_unused) 1038 1038 { ··· 1160 1160 return 0; 1161 1161 } 1162 1162 1163 - static int process_build_id(struct perf_tool *tool, 1163 + static int process_build_id(const struct perf_tool *tool, 1164 1164 union perf_event *event, 1165 1165 struct perf_sample *sample __maybe_unused, 1166 1166 struct machine *machine __maybe_unused) ··· 1210 1210 gs); 1211 1211 } 1212 1212 1213 - static int guest_session__ksymbol_event(struct perf_tool *tool, 1213 + static int guest_session__ksymbol_event(const struct perf_tool *tool, 1214 1214 union perf_event *event, 1215 1215 struct perf_sample *sample __maybe_unused, 1216 1216 struct machine *machine __maybe_unused) ··· 1574 1574 return guest_session__inject_events(gs, -1); 1575 1575 } 1576 1576 1577 - static int host__repipe(struct perf_tool *tool, 1577 + static int host__repipe(const struct perf_tool *tool, 1578 1578 union perf_event *event, 1579 1579 struct perf_sample *sample, 1580 1580 struct machine *machine) ··· 1647 1647 * guest events up to the same time. Finally write out the FINISHED_ROUND event 1648 1648 * itself. 1649 1649 */ 1650 - static int host__finished_round(struct perf_tool *tool, 1650 + static int host__finished_round(const struct perf_tool *tool, 1651 1651 union perf_event *event, 1652 1652 struct ordered_events *oe) 1653 1653 { ··· 1665 1665 return perf_event__repipe_oe_synth(tool, event, oe); 1666 1666 } 1667 1667 1668 - static int host__context_switch(struct perf_tool *tool, 1668 + static int host__context_switch(const struct perf_tool *tool, 1669 1669 union perf_event *event, 1670 1670 struct perf_sample *sample, 1671 1671 struct machine *machine) ··· 1719 1719 return 0; 1720 1720 } 1721 1721 1722 - static int drop_sample(struct perf_tool *tool __maybe_unused, 1722 + static int drop_sample(const struct perf_tool *tool __maybe_unused, 1723 1723 union perf_event *event __maybe_unused, 1724 1724 struct perf_sample *sample __maybe_unused, 1725 1725 struct evsel *evsel __maybe_unused,
+1 -2
tools/perf/builtin-kmem.c
··· 955 955 typedef int (*tracepoint_handler)(struct evsel *evsel, 956 956 struct perf_sample *sample); 957 957 958 - static int process_sample_event(struct perf_tool *tool __maybe_unused, 958 + static int process_sample_event(const struct perf_tool *tool __maybe_unused, 959 959 union perf_event *event, 960 960 struct perf_sample *sample, 961 961 struct evsel *evsel, ··· 2061 2061 2062 2062 return ret; 2063 2063 } 2064 -
+2 -2
tools/perf/builtin-kvm.c
··· 1166 1166 } 1167 1167 1168 1168 #if defined(HAVE_TIMERFD_SUPPORT) && defined(HAVE_LIBTRACEEVENT) 1169 - static int process_lost_event(struct perf_tool *tool, 1169 + static int process_lost_event(const struct perf_tool *tool, 1170 1170 union perf_event *event __maybe_unused, 1171 1171 struct perf_sample *sample __maybe_unused, 1172 1172 struct machine *machine __maybe_unused) ··· 1187 1187 return false; 1188 1188 } 1189 1189 1190 - static int process_sample_event(struct perf_tool *tool, 1190 + static int process_sample_event(const struct perf_tool *tool, 1191 1191 union perf_event *event, 1192 1192 struct perf_sample *sample, 1193 1193 struct evsel *evsel,
+11 -11
tools/perf/builtin-kwork.c
··· 958 958 } 959 959 960 960 static struct kwork_class kwork_irq; 961 - static int process_irq_handler_entry_event(struct perf_tool *tool, 961 + static int process_irq_handler_entry_event(const struct perf_tool *tool, 962 962 struct evsel *evsel, 963 963 struct perf_sample *sample, 964 964 struct machine *machine) ··· 971 971 return 0; 972 972 } 973 973 974 - static int process_irq_handler_exit_event(struct perf_tool *tool, 974 + static int process_irq_handler_exit_event(const struct perf_tool *tool, 975 975 struct evsel *evsel, 976 976 struct perf_sample *sample, 977 977 struct machine *machine) ··· 1037 1037 }; 1038 1038 1039 1039 static struct kwork_class kwork_softirq; 1040 - static int process_softirq_raise_event(struct perf_tool *tool, 1040 + static int process_softirq_raise_event(const struct perf_tool *tool, 1041 1041 struct evsel *evsel, 1042 1042 struct perf_sample *sample, 1043 1043 struct machine *machine) ··· 1051 1051 return 0; 1052 1052 } 1053 1053 1054 - static int process_softirq_entry_event(struct perf_tool *tool, 1054 + static int process_softirq_entry_event(const struct perf_tool *tool, 1055 1055 struct evsel *evsel, 1056 1056 struct perf_sample *sample, 1057 1057 struct machine *machine) ··· 1065 1065 return 0; 1066 1066 } 1067 1067 1068 - static int process_softirq_exit_event(struct perf_tool *tool, 1068 + static int process_softirq_exit_event(const struct perf_tool *tool, 1069 1069 struct evsel *evsel, 1070 1070 struct perf_sample *sample, 1071 1071 struct machine *machine) ··· 1167 1167 }; 1168 1168 1169 1169 static struct kwork_class kwork_workqueue; 1170 - static int process_workqueue_activate_work_event(struct perf_tool *tool, 1170 + static int process_workqueue_activate_work_event(const struct perf_tool *tool, 1171 1171 struct evsel *evsel, 1172 1172 struct perf_sample *sample, 1173 1173 struct machine *machine) ··· 1181 1181 return 0; 1182 1182 } 1183 1183 1184 - static int process_workqueue_execute_start_event(struct perf_tool *tool, 1184 + static int process_workqueue_execute_start_event(const struct perf_tool *tool, 1185 1185 struct evsel *evsel, 1186 1186 struct perf_sample *sample, 1187 1187 struct machine *machine) ··· 1195 1195 return 0; 1196 1196 } 1197 1197 1198 - static int process_workqueue_execute_end_event(struct perf_tool *tool, 1198 + static int process_workqueue_execute_end_event(const struct perf_tool *tool, 1199 1199 struct evsel *evsel, 1200 1200 struct perf_sample *sample, 1201 1201 struct machine *machine) ··· 1266 1266 }; 1267 1267 1268 1268 static struct kwork_class kwork_sched; 1269 - static int process_sched_switch_event(struct perf_tool *tool, 1269 + static int process_sched_switch_event(const struct perf_tool *tool, 1270 1270 struct evsel *evsel, 1271 1271 struct perf_sample *sample, 1272 1272 struct machine *machine) ··· 1945 1945 return 0; 1946 1946 } 1947 1947 1948 - typedef int (*tracepoint_handler)(struct perf_tool *tool, 1948 + typedef int (*tracepoint_handler)(const struct perf_tool *tool, 1949 1949 struct evsel *evsel, 1950 1950 struct perf_sample *sample, 1951 1951 struct machine *machine); 1952 1952 1953 - static int perf_kwork__process_tracepoint_sample(struct perf_tool *tool, 1953 + static int perf_kwork__process_tracepoint_sample(const struct perf_tool *tool, 1954 1954 union perf_event *event __maybe_unused, 1955 1955 struct perf_sample *sample, 1956 1956 struct evsel *evsel,
+2 -2
tools/perf/builtin-lock.c
··· 1501 1501 { "lock:contention_end", evsel__process_contention_end, }, 1502 1502 }; 1503 1503 1504 - static int process_event_update(struct perf_tool *tool, 1504 + static int process_event_update(const struct perf_tool *tool, 1505 1505 union perf_event *event, 1506 1506 struct evlist **pevlist) 1507 1507 { ··· 1520 1520 typedef int (*tracepoint_handler)(struct evsel *evsel, 1521 1521 struct perf_sample *sample); 1522 1522 1523 - static int process_sample_event(struct perf_tool *tool __maybe_unused, 1523 + static int process_sample_event(const struct perf_tool *tool __maybe_unused, 1524 1524 union perf_event *event, 1525 1525 struct perf_sample *sample, 1526 1526 struct evsel *evsel,
+2 -2
tools/perf/builtin-mem.c
··· 179 179 } 180 180 181 181 static int 182 - dump_raw_samples(struct perf_tool *tool, 182 + dump_raw_samples(const struct perf_tool *tool, 183 183 union perf_event *event, 184 184 struct perf_sample *sample, 185 185 struct machine *machine) ··· 253 253 return 0; 254 254 } 255 255 256 - static int process_sample_event(struct perf_tool *tool, 256 + static int process_sample_event(const struct perf_tool *tool, 257 257 union perf_event *event, 258 258 struct perf_sample *sample, 259 259 struct evsel *evsel __maybe_unused,
+7 -7
tools/perf/builtin-record.c
··· 609 609 return rec->opts.comp_level > 0; 610 610 } 611 611 612 - static int process_synthesized_event(struct perf_tool *tool, 612 + static int process_synthesized_event(const struct perf_tool *tool, 613 613 union perf_event *event, 614 614 struct perf_sample *sample __maybe_unused, 615 615 struct machine *machine __maybe_unused) ··· 620 620 621 621 static struct mutex synth_lock; 622 622 623 - static int process_locked_synthesized_event(struct perf_tool *tool, 623 + static int process_locked_synthesized_event(const struct perf_tool *tool, 624 624 union perf_event *event, 625 625 struct perf_sample *sample __maybe_unused, 626 626 struct machine *machine __maybe_unused) ··· 705 705 706 706 #ifdef HAVE_AUXTRACE_SUPPORT 707 707 708 - static int record__process_auxtrace(struct perf_tool *tool, 708 + static int record__process_auxtrace(const struct perf_tool *tool, 709 709 struct mmap *map, 710 710 union perf_event *event, void *data1, 711 711 size_t len1, void *data2, size_t len2) ··· 1417 1417 rec->evlist->last_sample_time = sample_time; 1418 1418 } 1419 1419 1420 - static int process_sample_event(struct perf_tool *tool, 1420 + static int process_sample_event(const struct perf_tool *tool, 1421 1421 union perf_event *event, 1422 1422 struct perf_sample *sample, 1423 1423 struct evsel *evsel, ··· 3244 3244 }; 3245 3245 const char * const *record_usage = __record_usage; 3246 3246 3247 - static int build_id__process_mmap(struct perf_tool *tool, union perf_event *event, 3247 + static int build_id__process_mmap(const struct perf_tool *tool, union perf_event *event, 3248 3248 struct perf_sample *sample, struct machine *machine) 3249 3249 { 3250 3250 /* ··· 3256 3256 return perf_event__process_mmap(tool, event, sample, machine); 3257 3257 } 3258 3258 3259 - static int build_id__process_mmap2(struct perf_tool *tool, union perf_event *event, 3259 + static int build_id__process_mmap2(const struct perf_tool *tool, union perf_event *event, 3260 3260 struct perf_sample *sample, struct machine *machine) 3261 3261 { 3262 3262 /* ··· 3269 3269 return perf_event__process_mmap2(tool, event, sample, machine); 3270 3270 } 3271 3271 3272 - static int process_timestamp_boundary(struct perf_tool *tool, 3272 + static int process_timestamp_boundary(const struct perf_tool *tool, 3273 3273 union perf_event *event __maybe_unused, 3274 3274 struct perf_sample *sample, 3275 3275 struct machine *machine __maybe_unused)
+6 -6
tools/perf/builtin-report.c
··· 263 263 return 0; 264 264 } 265 265 266 - static int process_sample_event(struct perf_tool *tool, 266 + static int process_sample_event(const struct perf_tool *tool, 267 267 union perf_event *event, 268 268 struct perf_sample *sample, 269 269 struct evsel *evsel, ··· 339 339 return ret; 340 340 } 341 341 342 - static int process_read_event(struct perf_tool *tool, 342 + static int process_read_event(const struct perf_tool *tool, 343 343 union perf_event *event, 344 344 struct perf_sample *sample __maybe_unused, 345 345 struct evsel *evsel, ··· 765 765 ui_progress__finish(); 766 766 } 767 767 768 - static int count_sample_event(struct perf_tool *tool __maybe_unused, 768 + static int count_sample_event(const struct perf_tool *tool __maybe_unused, 769 769 union perf_event *event __maybe_unused, 770 770 struct perf_sample *sample __maybe_unused, 771 771 struct evsel *evsel, ··· 777 777 return 0; 778 778 } 779 779 780 - static int count_lost_samples_event(struct perf_tool *tool, 780 + static int count_lost_samples_event(const struct perf_tool *tool, 781 781 union perf_event *event, 782 782 struct perf_sample *sample, 783 783 struct machine *machine __maybe_unused) ··· 793 793 return 0; 794 794 } 795 795 796 - static int process_attr(struct perf_tool *tool __maybe_unused, 796 + static int process_attr(const struct perf_tool *tool __maybe_unused, 797 797 union perf_event *event, 798 798 struct evlist **pevlist); 799 799 ··· 1233 1233 return 0; 1234 1234 } 1235 1235 1236 - static int process_attr(struct perf_tool *tool __maybe_unused, 1236 + static int process_attr(const struct perf_tool *tool __maybe_unused, 1237 1237 union perf_event *event, 1238 1238 struct evlist **pevlist) 1239 1239 {
+17 -17
tools/perf/builtin-sched.c
··· 1489 1489 } 1490 1490 } 1491 1491 1492 - static int process_sched_wakeup_event(struct perf_tool *tool, 1492 + static int process_sched_wakeup_event(const struct perf_tool *tool, 1493 1493 struct evsel *evsel, 1494 1494 struct perf_sample *sample, 1495 1495 struct machine *machine) ··· 1502 1502 return 0; 1503 1503 } 1504 1504 1505 - static int process_sched_wakeup_ignore(struct perf_tool *tool __maybe_unused, 1505 + static int process_sched_wakeup_ignore(const struct perf_tool *tool __maybe_unused, 1506 1506 struct evsel *evsel __maybe_unused, 1507 1507 struct perf_sample *sample __maybe_unused, 1508 1508 struct machine *machine __maybe_unused) ··· 1770 1770 return 0; 1771 1771 } 1772 1772 1773 - static int process_sched_switch_event(struct perf_tool *tool, 1773 + static int process_sched_switch_event(const struct perf_tool *tool, 1774 1774 struct evsel *evsel, 1775 1775 struct perf_sample *sample, 1776 1776 struct machine *machine) ··· 1796 1796 return err; 1797 1797 } 1798 1798 1799 - static int process_sched_runtime_event(struct perf_tool *tool, 1799 + static int process_sched_runtime_event(const struct perf_tool *tool, 1800 1800 struct evsel *evsel, 1801 1801 struct perf_sample *sample, 1802 1802 struct machine *machine) ··· 1809 1809 return 0; 1810 1810 } 1811 1811 1812 - static int perf_sched__process_fork_event(struct perf_tool *tool, 1812 + static int perf_sched__process_fork_event(const struct perf_tool *tool, 1813 1813 union perf_event *event, 1814 1814 struct perf_sample *sample, 1815 1815 struct machine *machine) ··· 1826 1826 return 0; 1827 1827 } 1828 1828 1829 - static int process_sched_migrate_task_event(struct perf_tool *tool, 1829 + static int process_sched_migrate_task_event(const struct perf_tool *tool, 1830 1830 struct evsel *evsel, 1831 1831 struct perf_sample *sample, 1832 1832 struct machine *machine) ··· 1839 1839 return 0; 1840 1840 } 1841 1841 1842 - typedef int (*tracepoint_handler)(struct perf_tool *tool, 1842 + typedef int (*tracepoint_handler)(const struct perf_tool *tool, 1843 1843 struct evsel *evsel, 1844 1844 struct perf_sample *sample, 1845 1845 struct machine *machine); 1846 1846 1847 - static int perf_sched__process_tracepoint_sample(struct perf_tool *tool __maybe_unused, 1847 + static int perf_sched__process_tracepoint_sample(const struct perf_tool *tool __maybe_unused, 1848 1848 union perf_event *event __maybe_unused, 1849 1849 struct perf_sample *sample, 1850 1850 struct evsel *evsel, ··· 1860 1860 return err; 1861 1861 } 1862 1862 1863 - static int perf_sched__process_comm(struct perf_tool *tool __maybe_unused, 1863 + static int perf_sched__process_comm(const struct perf_tool *tool __maybe_unused, 1864 1864 union perf_event *event, 1865 1865 struct perf_sample *sample, 1866 1866 struct machine *machine) ··· 2506 2506 printf("\n"); 2507 2507 } 2508 2508 2509 - static int timehist_sched_wakeup_ignore(struct perf_tool *tool __maybe_unused, 2509 + static int timehist_sched_wakeup_ignore(const struct perf_tool *tool __maybe_unused, 2510 2510 union perf_event *event __maybe_unused, 2511 2511 struct evsel *evsel __maybe_unused, 2512 2512 struct perf_sample *sample __maybe_unused, ··· 2515 2515 return 0; 2516 2516 } 2517 2517 2518 - static int timehist_sched_wakeup_event(struct perf_tool *tool, 2518 + static int timehist_sched_wakeup_event(const struct perf_tool *tool, 2519 2519 union perf_event *event __maybe_unused, 2520 2520 struct evsel *evsel, 2521 2521 struct perf_sample *sample, ··· 2599 2599 printf("\n"); 2600 2600 } 2601 2601 2602 - static int timehist_migrate_task_event(struct perf_tool *tool, 2602 + static int timehist_migrate_task_event(const struct perf_tool *tool, 2603 2603 union perf_event *event __maybe_unused, 2604 2604 struct evsel *evsel, 2605 2605 struct perf_sample *sample, ··· 2627 2627 return 0; 2628 2628 } 2629 2629 2630 - static int timehist_sched_change_event(struct perf_tool *tool, 2630 + static int timehist_sched_change_event(const struct perf_tool *tool, 2631 2631 union perf_event *event, 2632 2632 struct evsel *evsel, 2633 2633 struct perf_sample *sample, ··· 2758 2758 return rc; 2759 2759 } 2760 2760 2761 - static int timehist_sched_switch_event(struct perf_tool *tool, 2761 + static int timehist_sched_switch_event(const struct perf_tool *tool, 2762 2762 union perf_event *event, 2763 2763 struct evsel *evsel, 2764 2764 struct perf_sample *sample, ··· 2767 2767 return timehist_sched_change_event(tool, event, evsel, sample, machine); 2768 2768 } 2769 2769 2770 - static int process_lost(struct perf_tool *tool __maybe_unused, 2770 + static int process_lost(const struct perf_tool *tool __maybe_unused, 2771 2771 union perf_event *event, 2772 2772 struct perf_sample *sample, 2773 2773 struct machine *machine __maybe_unused) ··· 3010 3010 printf(" (x %d)\n", sched->max_cpu.cpu); 3011 3011 } 3012 3012 3013 - typedef int (*sched_handler)(struct perf_tool *tool, 3013 + typedef int (*sched_handler)(const struct perf_tool *tool, 3014 3014 union perf_event *event, 3015 3015 struct evsel *evsel, 3016 3016 struct perf_sample *sample, 3017 3017 struct machine *machine); 3018 3018 3019 - static int perf_timehist__process_sample(struct perf_tool *tool, 3019 + static int perf_timehist__process_sample(const struct perf_tool *tool, 3020 3020 union perf_event *event, 3021 3021 struct perf_sample *sample, 3022 3022 struct evsel *evsel,
+20 -21
tools/perf/builtin-script.c
··· 2399 2399 return false; 2400 2400 } 2401 2401 2402 - static int process_sample_event(struct perf_tool *tool, 2402 + static int process_sample_event(const struct perf_tool *tool, 2403 2403 union perf_event *event, 2404 2404 struct perf_sample *sample, 2405 2405 struct evsel *evsel, ··· 2486 2486 // Used when scr->per_event_dump is not set 2487 2487 static struct evsel_script es_stdout; 2488 2488 2489 - static int process_attr(struct perf_tool *tool, union perf_event *event, 2489 + static int process_attr(const struct perf_tool *tool, union perf_event *event, 2490 2490 struct evlist **pevlist) 2491 2491 { 2492 2492 struct perf_script *scr = container_of(tool, struct perf_script, tool); ··· 2552 2552 return 0; 2553 2553 } 2554 2554 2555 - static int print_event_with_time(struct perf_tool *tool, 2555 + static int print_event_with_time(const struct perf_tool *tool, 2556 2556 union perf_event *event, 2557 2557 struct perf_sample *sample, 2558 2558 struct machine *machine, ··· 2588 2588 return 0; 2589 2589 } 2590 2590 2591 - static int print_event(struct perf_tool *tool, union perf_event *event, 2591 + static int print_event(const struct perf_tool *tool, union perf_event *event, 2592 2592 struct perf_sample *sample, struct machine *machine, 2593 2593 pid_t pid, pid_t tid) 2594 2594 { 2595 2595 return print_event_with_time(tool, event, sample, machine, pid, tid, 0); 2596 2596 } 2597 2597 2598 - static int process_comm_event(struct perf_tool *tool, 2598 + static int process_comm_event(const struct perf_tool *tool, 2599 2599 union perf_event *event, 2600 2600 struct perf_sample *sample, 2601 2601 struct machine *machine) ··· 2607 2607 event->comm.tid); 2608 2608 } 2609 2609 2610 - static int process_namespaces_event(struct perf_tool *tool, 2610 + static int process_namespaces_event(const struct perf_tool *tool, 2611 2611 union perf_event *event, 2612 2612 struct perf_sample *sample, 2613 2613 struct machine *machine) ··· 2619 2619 event->namespaces.tid); 2620 2620 } 2621 2621 2622 - static int process_cgroup_event(struct perf_tool *tool, 2622 + static int process_cgroup_event(const struct perf_tool *tool, 2623 2623 union perf_event *event, 2624 2624 struct perf_sample *sample, 2625 2625 struct machine *machine) ··· 2631 2631 sample->tid); 2632 2632 } 2633 2633 2634 - static int process_fork_event(struct perf_tool *tool, 2634 + static int process_fork_event(const struct perf_tool *tool, 2635 2635 union perf_event *event, 2636 2636 struct perf_sample *sample, 2637 2637 struct machine *machine) ··· 2643 2643 event->fork.pid, event->fork.tid, 2644 2644 event->fork.time); 2645 2645 } 2646 - static int process_exit_event(struct perf_tool *tool, 2646 + static int process_exit_event(const struct perf_tool *tool, 2647 2647 union perf_event *event, 2648 2648 struct perf_sample *sample, 2649 2649 struct machine *machine) ··· 2656 2656 return perf_event__process_exit(tool, event, sample, machine); 2657 2657 } 2658 2658 2659 - static int process_mmap_event(struct perf_tool *tool, 2659 + static int process_mmap_event(const struct perf_tool *tool, 2660 2660 union perf_event *event, 2661 2661 struct perf_sample *sample, 2662 2662 struct machine *machine) ··· 2668 2668 event->mmap.tid); 2669 2669 } 2670 2670 2671 - static int process_mmap2_event(struct perf_tool *tool, 2671 + static int process_mmap2_event(const struct perf_tool *tool, 2672 2672 union perf_event *event, 2673 2673 struct perf_sample *sample, 2674 2674 struct machine *machine) ··· 2680 2680 event->mmap2.tid); 2681 2681 } 2682 2682 2683 - static int process_switch_event(struct perf_tool *tool, 2683 + static int process_switch_event(const struct perf_tool *tool, 2684 2684 union perf_event *event, 2685 2685 struct perf_sample *sample, 2686 2686 struct machine *machine) ··· 2712 2712 } 2713 2713 2714 2714 static int 2715 - process_lost_event(struct perf_tool *tool, 2715 + process_lost_event(const struct perf_tool *tool, 2716 2716 union perf_event *event, 2717 2717 struct perf_sample *sample, 2718 2718 struct machine *machine) ··· 2722 2722 } 2723 2723 2724 2724 static int 2725 - process_throttle_event(struct perf_tool *tool __maybe_unused, 2725 + process_throttle_event(const struct perf_tool *tool __maybe_unused, 2726 2726 union perf_event *event, 2727 2727 struct perf_sample *sample, 2728 2728 struct machine *machine) ··· 2733 2733 } 2734 2734 2735 2735 static int 2736 - process_finished_round_event(struct perf_tool *tool __maybe_unused, 2736 + process_finished_round_event(const struct perf_tool *tool __maybe_unused, 2737 2737 union perf_event *event, 2738 2738 struct ordered_events *oe __maybe_unused) 2739 2739 ··· 2743 2743 } 2744 2744 2745 2745 static int 2746 - process_bpf_events(struct perf_tool *tool __maybe_unused, 2746 + process_bpf_events(const struct perf_tool *tool __maybe_unused, 2747 2747 union perf_event *event, 2748 2748 struct perf_sample *sample, 2749 2749 struct machine *machine) ··· 2755 2755 sample->tid); 2756 2756 } 2757 2757 2758 - static int process_text_poke_events(struct perf_tool *tool, 2758 + static int process_text_poke_events(const struct perf_tool *tool, 2759 2759 union perf_event *event, 2760 2760 struct perf_sample *sample, 2761 2761 struct machine *machine) ··· 3757 3757 int process_thread_map_event(struct perf_session *session, 3758 3758 union perf_event *event) 3759 3759 { 3760 - struct perf_tool *tool = session->tool; 3760 + const struct perf_tool *tool = session->tool; 3761 3761 struct perf_script *script = container_of(tool, struct perf_script, tool); 3762 3762 3763 3763 if (dump_trace) ··· 3779 3779 int process_cpu_map_event(struct perf_session *session, 3780 3780 union perf_event *event) 3781 3781 { 3782 - struct perf_tool *tool = session->tool; 3782 + const struct perf_tool *tool = session->tool; 3783 3783 struct perf_script *script = container_of(tool, struct perf_script, tool); 3784 3784 3785 3785 if (dump_trace) ··· 3809 3809 static int perf_script__process_auxtrace_info(struct perf_session *session, 3810 3810 union perf_event *event) 3811 3811 { 3812 - struct perf_tool *tool = session->tool; 3813 - 3814 3812 int ret = perf_event__process_auxtrace_info(session, event); 3815 3813 3816 3814 if (ret == 0) { 3815 + const struct perf_tool *tool = session->tool; 3817 3816 struct perf_script *script = container_of(tool, struct perf_script, tool); 3818 3817 3819 3818 ret = perf_script__setup_per_event_dump(script);
+4 -4
tools/perf/builtin-stat.c
··· 248 248 perf_stat__reset_shadow_stats(); 249 249 } 250 250 251 - static int process_synthesized_event(struct perf_tool *tool __maybe_unused, 251 + static int process_synthesized_event(const struct perf_tool *tool __maybe_unused, 252 252 union perf_event *event, 253 253 struct perf_sample *sample __maybe_unused, 254 254 struct machine *machine __maybe_unused) ··· 2180 2180 int process_stat_config_event(struct perf_session *session, 2181 2181 union perf_event *event) 2182 2182 { 2183 - struct perf_tool *tool = session->tool; 2183 + const struct perf_tool *tool = session->tool; 2184 2184 struct perf_stat *st = container_of(tool, struct perf_stat, tool); 2185 2185 2186 2186 perf_event__read_stat_config(&stat_config, &event->stat_config); ··· 2229 2229 int process_thread_map_event(struct perf_session *session, 2230 2230 union perf_event *event) 2231 2231 { 2232 - struct perf_tool *tool = session->tool; 2232 + const struct perf_tool *tool = session->tool; 2233 2233 struct perf_stat *st = container_of(tool, struct perf_stat, tool); 2234 2234 2235 2235 if (st->threads) { ··· 2248 2248 int process_cpu_map_event(struct perf_session *session, 2249 2249 union perf_event *event) 2250 2250 { 2251 - struct perf_tool *tool = session->tool; 2251 + const struct perf_tool *tool = session->tool; 2252 2252 struct perf_stat *st = container_of(tool, struct perf_stat, tool); 2253 2253 struct perf_cpu_map *cpus; 2254 2254
+4 -4
tools/perf/builtin-timechart.c
··· 320 320 static u64 *cpus_pstate_start_times; 321 321 static u64 *cpus_pstate_state; 322 322 323 - static int process_comm_event(struct perf_tool *tool, 323 + static int process_comm_event(const struct perf_tool *tool, 324 324 union perf_event *event, 325 325 struct perf_sample *sample __maybe_unused, 326 326 struct machine *machine __maybe_unused) ··· 330 330 return 0; 331 331 } 332 332 333 - static int process_fork_event(struct perf_tool *tool, 333 + static int process_fork_event(const struct perf_tool *tool, 334 334 union perf_event *event, 335 335 struct perf_sample *sample __maybe_unused, 336 336 struct machine *machine __maybe_unused) ··· 340 340 return 0; 341 341 } 342 342 343 - static int process_exit_event(struct perf_tool *tool, 343 + static int process_exit_event(const struct perf_tool *tool, 344 344 union perf_event *event, 345 345 struct perf_sample *sample __maybe_unused, 346 346 struct machine *machine __maybe_unused) ··· 571 571 struct perf_sample *sample, 572 572 const char *backtrace); 573 573 574 - static int process_sample_event(struct perf_tool *tool, 574 + static int process_sample_event(const struct perf_tool *tool, 575 575 union perf_event *event, 576 576 struct perf_sample *sample, 577 577 struct evsel *evsel,
+1 -1
tools/perf/builtin-top.c
··· 740 740 return 0; 741 741 } 742 742 743 - static void perf_event__process_sample(struct perf_tool *tool, 743 + static void perf_event__process_sample(const struct perf_tool *tool, 744 744 const union perf_event *event, 745 745 struct evsel *evsel, 746 746 struct perf_sample *sample,
+2 -2
tools/perf/builtin-trace.c
··· 1778 1778 return ret; 1779 1779 } 1780 1780 1781 - static int trace__tool_process(struct perf_tool *tool, 1781 + static int trace__tool_process(const struct perf_tool *tool, 1782 1782 union perf_event *event, 1783 1783 struct perf_sample *sample, 1784 1784 struct machine *machine) ··· 3179 3179 trace->base_time = sample->time; 3180 3180 } 3181 3181 3182 - static int trace__process_sample(struct perf_tool *tool, 3182 + static int trace__process_sample(const struct perf_tool *tool, 3183 3183 union perf_event *event, 3184 3184 struct perf_sample *sample, 3185 3185 struct evsel *evsel,
+3 -3
tools/perf/tests/cpumap.c
··· 11 11 12 12 struct machine; 13 13 14 - static int process_event_mask(struct perf_tool *tool __maybe_unused, 14 + static int process_event_mask(const struct perf_tool *tool __maybe_unused, 15 15 union perf_event *event, 16 16 struct perf_sample *sample __maybe_unused, 17 17 struct machine *machine __maybe_unused) ··· 47 47 return 0; 48 48 } 49 49 50 - static int process_event_cpus(struct perf_tool *tool __maybe_unused, 50 + static int process_event_cpus(const struct perf_tool *tool __maybe_unused, 51 51 union perf_event *event, 52 52 struct perf_sample *sample __maybe_unused, 53 53 struct machine *machine __maybe_unused) ··· 73 73 return 0; 74 74 } 75 75 76 - static int process_event_range_cpus(struct perf_tool *tool __maybe_unused, 76 + static int process_event_range_cpus(const struct perf_tool *tool __maybe_unused, 77 77 union perf_event *event, 78 78 struct perf_sample *sample __maybe_unused, 79 79 struct machine *machine __maybe_unused)
+1 -1
tools/perf/tests/dlfilter-test.c
··· 62 62 return ret; 63 63 } 64 64 65 - static int process(struct perf_tool *tool, union perf_event *event, 65 + static int process(const struct perf_tool *tool, union perf_event *event, 66 66 struct perf_sample *sample __maybe_unused, 67 67 struct machine *machine __maybe_unused) 68 68 {
+1 -1
tools/perf/tests/dwarf-unwind.c
··· 37 37 #define NO_TAIL_CALL_BARRIER __asm__ __volatile__("" : : : "memory"); 38 38 #endif 39 39 40 - static int mmap_handler(struct perf_tool *tool __maybe_unused, 40 + static int mmap_handler(const struct perf_tool *tool __maybe_unused, 41 41 union perf_event *event, 42 42 struct perf_sample *sample, 43 43 struct machine *machine)
+4 -4
tools/perf/tests/event_update.c
··· 12 12 #include "tests.h" 13 13 #include "debug.h" 14 14 15 - static int process_event_unit(struct perf_tool *tool __maybe_unused, 15 + static int process_event_unit(const struct perf_tool *tool __maybe_unused, 16 16 union perf_event *event, 17 17 struct perf_sample *sample __maybe_unused, 18 18 struct machine *machine __maybe_unused) ··· 25 25 return 0; 26 26 } 27 27 28 - static int process_event_scale(struct perf_tool *tool __maybe_unused, 28 + static int process_event_scale(const struct perf_tool *tool __maybe_unused, 29 29 union perf_event *event, 30 30 struct perf_sample *sample __maybe_unused, 31 31 struct machine *machine __maybe_unused) ··· 43 43 const char *name; 44 44 }; 45 45 46 - static int process_event_name(struct perf_tool *tool, 46 + static int process_event_name(const struct perf_tool *tool, 47 47 union perf_event *event, 48 48 struct perf_sample *sample __maybe_unused, 49 49 struct machine *machine __maybe_unused) ··· 57 57 return 0; 58 58 } 59 59 60 - static int process_event_cpus(struct perf_tool *tool __maybe_unused, 60 + static int process_event_cpus(const struct perf_tool *tool __maybe_unused, 61 61 union perf_event *event, 62 62 struct perf_sample *sample __maybe_unused, 63 63 struct machine *machine __maybe_unused)
+3 -3
tools/perf/tests/stat.c
··· 21 21 return false; 22 22 } 23 23 24 - static int process_stat_config_event(struct perf_tool *tool __maybe_unused, 24 + static int process_stat_config_event(const struct perf_tool *tool __maybe_unused, 25 25 union perf_event *event, 26 26 struct perf_sample *sample __maybe_unused, 27 27 struct machine *machine __maybe_unused) ··· 62 62 return 0; 63 63 } 64 64 65 - static int process_stat_event(struct perf_tool *tool __maybe_unused, 65 + static int process_stat_event(const struct perf_tool *tool __maybe_unused, 66 66 union perf_event *event, 67 67 struct perf_sample *sample __maybe_unused, 68 68 struct machine *machine __maybe_unused) ··· 93 93 return 0; 94 94 } 95 95 96 - static int process_stat_round_event(struct perf_tool *tool __maybe_unused, 96 + static int process_stat_round_event(const struct perf_tool *tool __maybe_unused, 97 97 union perf_event *event, 98 98 struct perf_sample *sample __maybe_unused, 99 99 struct machine *machine __maybe_unused)
+1 -1
tools/perf/tests/thread-map.c
··· 60 60 return 0; 61 61 } 62 62 63 - static int process_event(struct perf_tool *tool __maybe_unused, 63 + static int process_event(const struct perf_tool *tool __maybe_unused, 64 64 union perf_event *event, 65 65 struct perf_sample *sample __maybe_unused, 66 66 struct machine *machine __maybe_unused)
+3 -3
tools/perf/util/arm-spe.c
··· 899 899 static int arm_spe_process_event(struct perf_session *session, 900 900 union perf_event *event, 901 901 struct perf_sample *sample, 902 - struct perf_tool *tool) 902 + const struct perf_tool *tool) 903 903 { 904 904 int err = 0; 905 905 u64 timestamp; ··· 947 947 948 948 static int arm_spe_process_auxtrace_event(struct perf_session *session, 949 949 union perf_event *event, 950 - struct perf_tool *tool __maybe_unused) 950 + const struct perf_tool *tool __maybe_unused) 951 951 { 952 952 struct arm_spe *spe = container_of(session->auxtrace, struct arm_spe, 953 953 auxtrace); ··· 985 985 } 986 986 987 987 static int arm_spe_flush(struct perf_session *session __maybe_unused, 988 - struct perf_tool *tool __maybe_unused) 988 + const struct perf_tool *tool __maybe_unused) 989 989 { 990 990 struct arm_spe *spe = container_of(session->auxtrace, struct arm_spe, 991 991 auxtrace);
+6 -6
tools/perf/util/auxtrace.c
··· 1240 1240 } 1241 1241 1242 1242 int perf_event__synthesize_auxtrace_info(struct auxtrace_record *itr, 1243 - struct perf_tool *tool, 1243 + const struct perf_tool *tool, 1244 1244 struct perf_session *session, 1245 1245 perf_event__handler_t process) 1246 1246 { ··· 1831 1831 1832 1832 static int __auxtrace_mmap__read(struct mmap *map, 1833 1833 struct auxtrace_record *itr, 1834 - struct perf_tool *tool, process_auxtrace_t fn, 1834 + const struct perf_tool *tool, process_auxtrace_t fn, 1835 1835 bool snapshot, size_t snapshot_size) 1836 1836 { 1837 1837 struct auxtrace_mmap *mm = &map->auxtrace_mmap; ··· 1942 1942 } 1943 1943 1944 1944 int auxtrace_mmap__read(struct mmap *map, struct auxtrace_record *itr, 1945 - struct perf_tool *tool, process_auxtrace_t fn) 1945 + const struct perf_tool *tool, process_auxtrace_t fn) 1946 1946 { 1947 1947 return __auxtrace_mmap__read(map, itr, tool, fn, false, 0); 1948 1948 } 1949 1949 1950 1950 int auxtrace_mmap__read_snapshot(struct mmap *map, 1951 1951 struct auxtrace_record *itr, 1952 - struct perf_tool *tool, process_auxtrace_t fn, 1952 + const struct perf_tool *tool, process_auxtrace_t fn, 1953 1953 size_t snapshot_size) 1954 1954 { 1955 1955 return __auxtrace_mmap__read(map, itr, tool, fn, true, snapshot_size); ··· 2829 2829 } 2830 2830 2831 2831 int auxtrace__process_event(struct perf_session *session, union perf_event *event, 2832 - struct perf_sample *sample, struct perf_tool *tool) 2832 + struct perf_sample *sample, const struct perf_tool *tool) 2833 2833 { 2834 2834 if (!session->auxtrace) 2835 2835 return 0; ··· 2847 2847 session->auxtrace->dump_auxtrace_sample(session, sample); 2848 2848 } 2849 2849 2850 - int auxtrace__flush_events(struct perf_session *session, struct perf_tool *tool) 2850 + int auxtrace__flush_events(struct perf_session *session, const struct perf_tool *tool) 2851 2851 { 2852 2852 if (!session->auxtrace) 2853 2853 return 0;
+10 -10
tools/perf/util/auxtrace.h
··· 208 208 int (*process_event)(struct perf_session *session, 209 209 union perf_event *event, 210 210 struct perf_sample *sample, 211 - struct perf_tool *tool); 211 + const struct perf_tool *tool); 212 212 int (*process_auxtrace_event)(struct perf_session *session, 213 213 union perf_event *event, 214 - struct perf_tool *tool); 214 + const struct perf_tool *tool); 215 215 int (*queue_data)(struct perf_session *session, 216 216 struct perf_sample *sample, union perf_event *event, 217 217 u64 data_offset); 218 218 void (*dump_auxtrace_sample)(struct perf_session *session, 219 219 struct perf_sample *sample); 220 220 int (*flush_events)(struct perf_session *session, 221 - struct perf_tool *tool); 221 + const struct perf_tool *tool); 222 222 void (*free_events)(struct perf_session *session); 223 223 void (*free)(struct perf_session *session); 224 224 bool (*evsel_is_auxtrace)(struct perf_session *session, ··· 508 508 struct evlist *evlist, 509 509 struct evsel *evsel, int idx); 510 510 511 - typedef int (*process_auxtrace_t)(struct perf_tool *tool, 511 + typedef int (*process_auxtrace_t)(const struct perf_tool *tool, 512 512 struct mmap *map, 513 513 union perf_event *event, void *data1, 514 514 size_t len1, void *data2, size_t len2); 515 515 516 516 int auxtrace_mmap__read(struct mmap *map, struct auxtrace_record *itr, 517 - struct perf_tool *tool, process_auxtrace_t fn); 517 + const struct perf_tool *tool, process_auxtrace_t fn); 518 518 519 519 int auxtrace_mmap__read_snapshot(struct mmap *map, 520 520 struct auxtrace_record *itr, 521 - struct perf_tool *tool, process_auxtrace_t fn, 521 + const struct perf_tool *tool, process_auxtrace_t fn, 522 522 size_t snapshot_size); 523 523 524 524 int auxtrace_queues__init_nr(struct auxtrace_queues *queues, int nr_queues); ··· 639 639 int auxtrace_parse_filters(struct evlist *evlist); 640 640 641 641 int auxtrace__process_event(struct perf_session *session, union perf_event *event, 642 - struct perf_sample *sample, struct perf_tool *tool); 642 + struct perf_sample *sample, const struct perf_tool *tool); 643 643 void auxtrace__dump_auxtrace_sample(struct perf_session *session, 644 644 struct perf_sample *sample); 645 - int auxtrace__flush_events(struct perf_session *session, struct perf_tool *tool); 645 + int auxtrace__flush_events(struct perf_session *session, const struct perf_tool *tool); 646 646 void auxtrace__free_events(struct perf_session *session); 647 647 void auxtrace__free(struct perf_session *session); 648 648 bool auxtrace__evsel_is_auxtrace(struct perf_session *session, ··· 809 809 int auxtrace__process_event(struct perf_session *session __maybe_unused, 810 810 union perf_event *event __maybe_unused, 811 811 struct perf_sample *sample __maybe_unused, 812 - struct perf_tool *tool __maybe_unused) 812 + const struct perf_tool *tool __maybe_unused) 813 813 { 814 814 return 0; 815 815 } ··· 822 822 823 823 static inline 824 824 int auxtrace__flush_events(struct perf_session *session __maybe_unused, 825 - struct perf_tool *tool __maybe_unused) 825 + const struct perf_tool *tool __maybe_unused) 826 826 { 827 827 return 0; 828 828 }
+2 -2
tools/perf/util/bpf-event.c
··· 170 170 { 171 171 struct perf_record_ksymbol *ksymbol_event = &event->ksymbol; 172 172 struct perf_record_bpf_event *bpf_event = &event->bpf; 173 - struct perf_tool *tool = session->tool; 173 + const struct perf_tool *tool = session->tool; 174 174 struct bpf_prog_info_node *info_node; 175 175 struct perf_bpil *info_linear; 176 176 struct bpf_prog_info *info; ··· 310 310 union perf_event *event; 311 311 perf_event__handler_t process; 312 312 struct machine *machine; 313 - struct perf_tool *tool; 313 + const struct perf_tool *tool; 314 314 }; 315 315 316 316 static int
+2 -2
tools/perf/util/build-id.c
··· 42 42 43 43 static bool no_buildid_cache; 44 44 45 - int build_id__mark_dso_hit(struct perf_tool *tool __maybe_unused, 45 + int build_id__mark_dso_hit(const struct perf_tool *tool __maybe_unused, 46 46 union perf_event *event, 47 47 struct perf_sample *sample, 48 48 struct evsel *evsel __maybe_unused, ··· 67 67 return 0; 68 68 } 69 69 70 - static int perf_event__exit_del_thread(struct perf_tool *tool __maybe_unused, 70 + static int perf_event__exit_del_thread(const struct perf_tool *tool __maybe_unused, 71 71 union perf_event *event, 72 72 struct perf_sample *sample 73 73 __maybe_unused,
+2 -2
tools/perf/util/build-id.h
··· 35 35 char *__dso__build_id_filename(const struct dso *dso, char *bf, size_t size, 36 36 bool is_debug, bool is_kallsyms); 37 37 38 - int build_id__mark_dso_hit(struct perf_tool *tool, union perf_event *event, 38 + int build_id__mark_dso_hit(const struct perf_tool *tool, union perf_event *event, 39 39 struct perf_sample *sample, struct evsel *evsel, 40 40 struct machine *machine); 41 41 42 - int perf_event__inject_buildid(struct perf_tool *tool, union perf_event *event, 42 + int perf_event__inject_buildid(const struct perf_tool *tool, union perf_event *event, 43 43 struct perf_sample *sample, struct evsel *evsel, 44 44 struct machine *machine); 45 45
+3 -3
tools/perf/util/cs-etm.c
··· 788 788 } 789 789 790 790 static int cs_etm__flush_events(struct perf_session *session, 791 - struct perf_tool *tool) 791 + const struct perf_tool *tool) 792 792 { 793 793 struct cs_etm_auxtrace *etm = container_of(session->auxtrace, 794 794 struct cs_etm_auxtrace, ··· 2715 2715 static int cs_etm__process_event(struct perf_session *session, 2716 2716 union perf_event *event, 2717 2717 struct perf_sample *sample, 2718 - struct perf_tool *tool) 2718 + const struct perf_tool *tool) 2719 2719 { 2720 2720 struct cs_etm_auxtrace *etm = container_of(session->auxtrace, 2721 2721 struct cs_etm_auxtrace, ··· 2785 2785 2786 2786 static int cs_etm__process_auxtrace_event(struct perf_session *session, 2787 2787 union perf_event *event, 2788 - struct perf_tool *tool __maybe_unused) 2788 + const struct perf_tool *tool __maybe_unused) 2789 2789 { 2790 2790 struct cs_etm_auxtrace *etm = container_of(session->auxtrace, 2791 2791 struct cs_etm_auxtrace,
+2 -2
tools/perf/util/data-convert-bt.c
··· 792 792 return cs->count >= STREAM_FLUSH_COUNT; 793 793 } 794 794 795 - static int process_sample_event(struct perf_tool *tool, 795 + static int process_sample_event(const struct perf_tool *tool, 796 796 union perf_event *_event, 797 797 struct perf_sample *sample, 798 798 struct evsel *evsel, ··· 871 871 } while(0) 872 872 873 873 #define __FUNC_PROCESS_NON_SAMPLE(_name, body) \ 874 - static int process_##_name##_event(struct perf_tool *tool, \ 874 + static int process_##_name##_event(const struct perf_tool *tool, \ 875 875 union perf_event *_event, \ 876 876 struct perf_sample *sample, \ 877 877 struct machine *machine) \
+2 -2
tools/perf/util/data-convert-json.c
··· 118 118 va_end(args); 119 119 } 120 120 121 - static void output_sample_callchain_entry(struct perf_tool *tool, 121 + static void output_sample_callchain_entry(const struct perf_tool *tool, 122 122 u64 ip, struct addr_location *al) 123 123 { 124 124 struct convert_json *c = container_of(tool, struct convert_json, tool); ··· 146 146 output_json_format(out, false, 4, "}"); 147 147 } 148 148 149 - static int process_sample_event(struct perf_tool *tool, 149 + static int process_sample_event(const struct perf_tool *tool, 150 150 union perf_event *event __maybe_unused, 151 151 struct perf_sample *sample, 152 152 struct evsel *evsel __maybe_unused,
+17 -17
tools/perf/util/event.c
··· 216 216 event->cgroup.id, event->cgroup.path); 217 217 } 218 218 219 - int perf_event__process_comm(struct perf_tool *tool __maybe_unused, 219 + int perf_event__process_comm(const struct perf_tool *tool __maybe_unused, 220 220 union perf_event *event, 221 221 struct perf_sample *sample, 222 222 struct machine *machine) ··· 224 224 return machine__process_comm_event(machine, event, sample); 225 225 } 226 226 227 - int perf_event__process_namespaces(struct perf_tool *tool __maybe_unused, 227 + int perf_event__process_namespaces(const struct perf_tool *tool __maybe_unused, 228 228 union perf_event *event, 229 229 struct perf_sample *sample, 230 230 struct machine *machine) ··· 232 232 return machine__process_namespaces_event(machine, event, sample); 233 233 } 234 234 235 - int perf_event__process_cgroup(struct perf_tool *tool __maybe_unused, 235 + int perf_event__process_cgroup(const struct perf_tool *tool __maybe_unused, 236 236 union perf_event *event, 237 237 struct perf_sample *sample, 238 238 struct machine *machine) ··· 240 240 return machine__process_cgroup_event(machine, event, sample); 241 241 } 242 242 243 - int perf_event__process_lost(struct perf_tool *tool __maybe_unused, 243 + int perf_event__process_lost(const struct perf_tool *tool __maybe_unused, 244 244 union perf_event *event, 245 245 struct perf_sample *sample, 246 246 struct machine *machine) ··· 248 248 return machine__process_lost_event(machine, event, sample); 249 249 } 250 250 251 - int perf_event__process_aux(struct perf_tool *tool __maybe_unused, 251 + int perf_event__process_aux(const struct perf_tool *tool __maybe_unused, 252 252 union perf_event *event, 253 253 struct perf_sample *sample __maybe_unused, 254 254 struct machine *machine) ··· 256 256 return machine__process_aux_event(machine, event); 257 257 } 258 258 259 - int perf_event__process_itrace_start(struct perf_tool *tool __maybe_unused, 259 + int perf_event__process_itrace_start(const struct perf_tool *tool __maybe_unused, 260 260 union perf_event *event, 261 261 struct perf_sample *sample __maybe_unused, 262 262 struct machine *machine) ··· 264 264 return machine__process_itrace_start_event(machine, event); 265 265 } 266 266 267 - int perf_event__process_aux_output_hw_id(struct perf_tool *tool __maybe_unused, 267 + int perf_event__process_aux_output_hw_id(const struct perf_tool *tool __maybe_unused, 268 268 union perf_event *event, 269 269 struct perf_sample *sample __maybe_unused, 270 270 struct machine *machine) ··· 272 272 return machine__process_aux_output_hw_id_event(machine, event); 273 273 } 274 274 275 - int perf_event__process_lost_samples(struct perf_tool *tool __maybe_unused, 275 + int perf_event__process_lost_samples(const struct perf_tool *tool __maybe_unused, 276 276 union perf_event *event, 277 277 struct perf_sample *sample, 278 278 struct machine *machine) ··· 280 280 return machine__process_lost_samples_event(machine, event, sample); 281 281 } 282 282 283 - int perf_event__process_switch(struct perf_tool *tool __maybe_unused, 283 + int perf_event__process_switch(const struct perf_tool *tool __maybe_unused, 284 284 union perf_event *event, 285 285 struct perf_sample *sample __maybe_unused, 286 286 struct machine *machine) ··· 288 288 return machine__process_switch_event(machine, event); 289 289 } 290 290 291 - int perf_event__process_ksymbol(struct perf_tool *tool __maybe_unused, 291 + int perf_event__process_ksymbol(const struct perf_tool *tool __maybe_unused, 292 292 union perf_event *event, 293 293 struct perf_sample *sample __maybe_unused, 294 294 struct machine *machine) ··· 296 296 return machine__process_ksymbol(machine, event, sample); 297 297 } 298 298 299 - int perf_event__process_bpf(struct perf_tool *tool __maybe_unused, 299 + int perf_event__process_bpf(const struct perf_tool *tool __maybe_unused, 300 300 union perf_event *event, 301 301 struct perf_sample *sample, 302 302 struct machine *machine) ··· 304 304 return machine__process_bpf(machine, event, sample); 305 305 } 306 306 307 - int perf_event__process_text_poke(struct perf_tool *tool __maybe_unused, 307 + int perf_event__process_text_poke(const struct perf_tool *tool __maybe_unused, 308 308 union perf_event *event, 309 309 struct perf_sample *sample, 310 310 struct machine *machine) ··· 387 387 return ret; 388 388 } 389 389 390 - int perf_event__process_mmap(struct perf_tool *tool __maybe_unused, 390 + int perf_event__process_mmap(const struct perf_tool *tool __maybe_unused, 391 391 union perf_event *event, 392 392 struct perf_sample *sample, 393 393 struct machine *machine) ··· 395 395 return machine__process_mmap_event(machine, event, sample); 396 396 } 397 397 398 - int perf_event__process_mmap2(struct perf_tool *tool __maybe_unused, 398 + int perf_event__process_mmap2(const struct perf_tool *tool __maybe_unused, 399 399 union perf_event *event, 400 400 struct perf_sample *sample, 401 401 struct machine *machine) ··· 410 410 event->fork.ppid, event->fork.ptid); 411 411 } 412 412 413 - int perf_event__process_fork(struct perf_tool *tool __maybe_unused, 413 + int perf_event__process_fork(const struct perf_tool *tool __maybe_unused, 414 414 union perf_event *event, 415 415 struct perf_sample *sample, 416 416 struct machine *machine) ··· 418 418 return machine__process_fork_event(machine, event, sample); 419 419 } 420 420 421 - int perf_event__process_exit(struct perf_tool *tool __maybe_unused, 421 + int perf_event__process_exit(const struct perf_tool *tool __maybe_unused, 422 422 union perf_event *event, 423 423 struct perf_sample *sample, 424 424 struct machine *machine) ··· 587 587 return ret; 588 588 } 589 589 590 - int perf_event__process(struct perf_tool *tool __maybe_unused, 590 + int perf_event__process(const struct perf_tool *tool __maybe_unused, 591 591 union perf_event *event, 592 592 struct perf_sample *sample, 593 593 struct machine *machine)
+17 -17
tools/perf/util/event.h
··· 267 267 void perf_event__read_stat_config(struct perf_stat_config *config, 268 268 struct perf_record_stat_config *event); 269 269 270 - int perf_event__process_comm(struct perf_tool *tool, 270 + int perf_event__process_comm(const struct perf_tool *tool, 271 271 union perf_event *event, 272 272 struct perf_sample *sample, 273 273 struct machine *machine); 274 - int perf_event__process_lost(struct perf_tool *tool, 274 + int perf_event__process_lost(const struct perf_tool *tool, 275 275 union perf_event *event, 276 276 struct perf_sample *sample, 277 277 struct machine *machine); 278 - int perf_event__process_lost_samples(struct perf_tool *tool, 278 + int perf_event__process_lost_samples(const struct perf_tool *tool, 279 279 union perf_event *event, 280 280 struct perf_sample *sample, 281 281 struct machine *machine); 282 - int perf_event__process_aux(struct perf_tool *tool, 282 + int perf_event__process_aux(const struct perf_tool *tool, 283 283 union perf_event *event, 284 284 struct perf_sample *sample, 285 285 struct machine *machine); 286 - int perf_event__process_itrace_start(struct perf_tool *tool, 286 + int perf_event__process_itrace_start(const struct perf_tool *tool, 287 287 union perf_event *event, 288 288 struct perf_sample *sample, 289 289 struct machine *machine); 290 - int perf_event__process_aux_output_hw_id(struct perf_tool *tool, 290 + int perf_event__process_aux_output_hw_id(const struct perf_tool *tool, 291 291 union perf_event *event, 292 292 struct perf_sample *sample, 293 293 struct machine *machine); 294 - int perf_event__process_switch(struct perf_tool *tool, 294 + int perf_event__process_switch(const struct perf_tool *tool, 295 295 union perf_event *event, 296 296 struct perf_sample *sample, 297 297 struct machine *machine); 298 - int perf_event__process_namespaces(struct perf_tool *tool, 298 + int perf_event__process_namespaces(const struct perf_tool *tool, 299 299 union perf_event *event, 300 300 struct perf_sample *sample, 301 301 struct machine *machine); 302 - int perf_event__process_cgroup(struct perf_tool *tool, 302 + int perf_event__process_cgroup(const struct perf_tool *tool, 303 303 union perf_event *event, 304 304 struct perf_sample *sample, 305 305 struct machine *machine); 306 - int perf_event__process_mmap(struct perf_tool *tool, 306 + int perf_event__process_mmap(const struct perf_tool *tool, 307 307 union perf_event *event, 308 308 struct perf_sample *sample, 309 309 struct machine *machine); 310 - int perf_event__process_mmap2(struct perf_tool *tool, 310 + int perf_event__process_mmap2(const struct perf_tool *tool, 311 311 union perf_event *event, 312 312 struct perf_sample *sample, 313 313 struct machine *machine); 314 - int perf_event__process_fork(struct perf_tool *tool, 314 + int perf_event__process_fork(const struct perf_tool *tool, 315 315 union perf_event *event, 316 316 struct perf_sample *sample, 317 317 struct machine *machine); 318 - int perf_event__process_exit(struct perf_tool *tool, 318 + int perf_event__process_exit(const struct perf_tool *tool, 319 319 union perf_event *event, 320 320 struct perf_sample *sample, 321 321 struct machine *machine); 322 - int perf_event__process_ksymbol(struct perf_tool *tool, 322 + int perf_event__process_ksymbol(const struct perf_tool *tool, 323 323 union perf_event *event, 324 324 struct perf_sample *sample, 325 325 struct machine *machine); 326 - int perf_event__process_bpf(struct perf_tool *tool, 326 + int perf_event__process_bpf(const struct perf_tool *tool, 327 327 union perf_event *event, 328 328 struct perf_sample *sample, 329 329 struct machine *machine); 330 - int perf_event__process_text_poke(struct perf_tool *tool, 330 + int perf_event__process_text_poke(const struct perf_tool *tool, 331 331 union perf_event *event, 332 332 struct perf_sample *sample, 333 333 struct machine *machine); 334 - int perf_event__process(struct perf_tool *tool, 334 + int perf_event__process(const struct perf_tool *tool, 335 335 union perf_event *event, 336 336 struct perf_sample *sample, 337 337 struct machine *machine);
+3 -3
tools/perf/util/header.c
··· 4326 4326 int perf_event__process_feature(struct perf_session *session, 4327 4327 union perf_event *event) 4328 4328 { 4329 - struct perf_tool *tool = session->tool; 4329 + const struct perf_tool *tool = session->tool; 4330 4330 struct feat_fd ff = { .fd = 0 }; 4331 4331 struct perf_record_header_feature *fe = (struct perf_record_header_feature *)event; 4332 4332 int type = fe->header.type; ··· 4405 4405 return ret; 4406 4406 } 4407 4407 4408 - int perf_event__process_attr(struct perf_tool *tool __maybe_unused, 4408 + int perf_event__process_attr(const struct perf_tool *tool __maybe_unused, 4409 4409 union perf_event *event, 4410 4410 struct evlist **pevlist) 4411 4411 { ··· 4444 4444 return 0; 4445 4445 } 4446 4446 4447 - int perf_event__process_event_update(struct perf_tool *tool __maybe_unused, 4447 + int perf_event__process_event_update(const struct perf_tool *tool __maybe_unused, 4448 4448 union perf_event *event, 4449 4449 struct evlist **pevlist) 4450 4450 {
+2 -2
tools/perf/util/header.h
··· 156 156 157 157 int perf_event__process_feature(struct perf_session *session, 158 158 union perf_event *event); 159 - int perf_event__process_attr(struct perf_tool *tool, union perf_event *event, 159 + int perf_event__process_attr(const struct perf_tool *tool, union perf_event *event, 160 160 struct evlist **pevlist); 161 - int perf_event__process_event_update(struct perf_tool *tool, 161 + int perf_event__process_event_update(const struct perf_tool *tool, 162 162 union perf_event *event, 163 163 struct evlist **pevlist); 164 164 size_t perf_event__fprintf_event_update(union perf_event *event, FILE *fp);
+3 -3
tools/perf/util/hisi-ptt.c
··· 79 79 static int hisi_ptt_process_event(struct perf_session *session __maybe_unused, 80 80 union perf_event *event __maybe_unused, 81 81 struct perf_sample *sample __maybe_unused, 82 - struct perf_tool *tool __maybe_unused) 82 + const struct perf_tool *tool __maybe_unused) 83 83 { 84 84 return 0; 85 85 } 86 86 87 87 static int hisi_ptt_process_auxtrace_event(struct perf_session *session, 88 88 union perf_event *event, 89 - struct perf_tool *tool __maybe_unused) 89 + const struct perf_tool *tool __maybe_unused) 90 90 { 91 91 struct hisi_ptt *ptt = container_of(session->auxtrace, struct hisi_ptt, 92 92 auxtrace); ··· 123 123 } 124 124 125 125 static int hisi_ptt_flush(struct perf_session *session __maybe_unused, 126 - struct perf_tool *tool __maybe_unused) 126 + const struct perf_tool *tool __maybe_unused) 127 127 { 128 128 return 0; 129 129 }
+3 -3
tools/perf/util/intel-bts.c
··· 591 591 static int intel_bts_process_event(struct perf_session *session, 592 592 union perf_event *event, 593 593 struct perf_sample *sample, 594 - struct perf_tool *tool) 594 + const struct perf_tool *tool) 595 595 { 596 596 struct intel_bts *bts = container_of(session->auxtrace, struct intel_bts, 597 597 auxtrace); ··· 634 634 635 635 static int intel_bts_process_auxtrace_event(struct perf_session *session, 636 636 union perf_event *event, 637 - struct perf_tool *tool __maybe_unused) 637 + const struct perf_tool *tool __maybe_unused) 638 638 { 639 639 struct intel_bts *bts = container_of(session->auxtrace, struct intel_bts, 640 640 auxtrace); ··· 675 675 } 676 676 677 677 static int intel_bts_flush(struct perf_session *session, 678 - struct perf_tool *tool __maybe_unused) 678 + const struct perf_tool *tool __maybe_unused) 679 679 { 680 680 struct intel_bts *bts = container_of(session->auxtrace, struct intel_bts, 681 681 auxtrace);
+3 -3
tools/perf/util/intel-pt.c
··· 3449 3449 static int intel_pt_process_event(struct perf_session *session, 3450 3450 union perf_event *event, 3451 3451 struct perf_sample *sample, 3452 - struct perf_tool *tool) 3452 + const struct perf_tool *tool) 3453 3453 { 3454 3454 struct intel_pt *pt = container_of(session->auxtrace, struct intel_pt, 3455 3455 auxtrace); ··· 3533 3533 return err; 3534 3534 } 3535 3535 3536 - static int intel_pt_flush(struct perf_session *session, struct perf_tool *tool) 3536 + static int intel_pt_flush(struct perf_session *session, const struct perf_tool *tool) 3537 3537 { 3538 3538 struct intel_pt *pt = container_of(session->auxtrace, struct intel_pt, 3539 3539 auxtrace); ··· 3600 3600 3601 3601 static int intel_pt_process_auxtrace_event(struct perf_session *session, 3602 3602 union perf_event *event, 3603 - struct perf_tool *tool __maybe_unused) 3603 + const struct perf_tool *tool __maybe_unused) 3604 3604 { 3605 3605 struct intel_pt *pt = container_of(session->auxtrace, struct intel_pt, 3606 3606 auxtrace);
+2 -2
tools/perf/util/jitdump.c
··· 424 424 { 425 425 struct perf_sample sample; 426 426 union perf_event *event; 427 - struct perf_tool *tool = jd->session->tool; 427 + const struct perf_tool *tool = jd->session->tool; 428 428 uint64_t code, addr; 429 429 uintptr_t uaddr; 430 430 char *filename; ··· 543 543 { 544 544 struct perf_sample sample; 545 545 union perf_event *event; 546 - struct perf_tool *tool = jd->session->tool; 546 + const struct perf_tool *tool = jd->session->tool; 547 547 char *filename; 548 548 size_t size; 549 549 struct stat st;
+3 -3
tools/perf/util/s390-cpumsf.c
··· 912 912 s390_cpumsf_process_event(struct perf_session *session, 913 913 union perf_event *event, 914 914 struct perf_sample *sample, 915 - struct perf_tool *tool) 915 + const struct perf_tool *tool) 916 916 { 917 917 struct s390_cpumsf *sf = container_of(session->auxtrace, 918 918 struct s390_cpumsf, ··· 955 955 static int 956 956 s390_cpumsf_process_auxtrace_event(struct perf_session *session, 957 957 union perf_event *event __maybe_unused, 958 - struct perf_tool *tool __maybe_unused) 958 + const struct perf_tool *tool __maybe_unused) 959 959 { 960 960 struct s390_cpumsf *sf = container_of(session->auxtrace, 961 961 struct s390_cpumsf, ··· 998 998 } 999 999 1000 1000 static int s390_cpumsf_flush(struct perf_session *session __maybe_unused, 1001 - struct perf_tool *tool __maybe_unused) 1001 + const struct perf_tool *tool __maybe_unused) 1002 1002 { 1003 1003 return 0; 1004 1004 }
+15 -15
tools/perf/util/session.c
··· 103 103 104 104 static int perf_session__deliver_event(struct perf_session *session, 105 105 union perf_event *event, 106 - struct perf_tool *tool, 106 + const struct perf_tool *tool, 107 107 u64 file_offset, 108 108 const char *file_path); 109 109 ··· 330 330 return 0; 331 331 } 332 332 333 - static int process_event_synth_attr_stub(struct perf_tool *tool __maybe_unused, 333 + static int process_event_synth_attr_stub(const struct perf_tool *tool __maybe_unused, 334 334 union perf_event *event __maybe_unused, 335 335 struct evlist **pevlist 336 336 __maybe_unused) ··· 339 339 return 0; 340 340 } 341 341 342 - static int process_event_synth_event_update_stub(struct perf_tool *tool __maybe_unused, 342 + static int process_event_synth_event_update_stub(const struct perf_tool *tool __maybe_unused, 343 343 union perf_event *event __maybe_unused, 344 344 struct evlist **pevlist 345 345 __maybe_unused) ··· 351 351 return 0; 352 352 } 353 353 354 - static int process_event_sample_stub(struct perf_tool *tool __maybe_unused, 354 + static int process_event_sample_stub(const struct perf_tool *tool __maybe_unused, 355 355 union perf_event *event __maybe_unused, 356 356 struct perf_sample *sample __maybe_unused, 357 357 struct evsel *evsel __maybe_unused, ··· 361 361 return 0; 362 362 } 363 363 364 - static int process_event_stub(struct perf_tool *tool __maybe_unused, 364 + static int process_event_stub(const struct perf_tool *tool __maybe_unused, 365 365 union perf_event *event __maybe_unused, 366 366 struct perf_sample *sample __maybe_unused, 367 367 struct machine *machine __maybe_unused) ··· 370 370 return 0; 371 371 } 372 372 373 - static int process_finished_round_stub(struct perf_tool *tool __maybe_unused, 373 + static int process_finished_round_stub(const struct perf_tool *tool __maybe_unused, 374 374 union perf_event *event __maybe_unused, 375 375 struct ordered_events *oe __maybe_unused) 376 376 { ··· 1078 1078 * Flush every events below timestamp 7 1079 1079 * etc... 1080 1080 */ 1081 - int perf_event__process_finished_round(struct perf_tool *tool __maybe_unused, 1081 + int perf_event__process_finished_round(const struct perf_tool *tool __maybe_unused, 1082 1082 union perf_event *event __maybe_unused, 1083 1083 struct ordered_events *oe) 1084 1084 { ··· 1472 1472 } 1473 1473 1474 1474 static int deliver_sample_value(struct evlist *evlist, 1475 - struct perf_tool *tool, 1475 + const struct perf_tool *tool, 1476 1476 union perf_event *event, 1477 1477 struct perf_sample *sample, 1478 1478 struct sample_read_value *v, ··· 1504 1504 } 1505 1505 1506 1506 static int deliver_sample_group(struct evlist *evlist, 1507 - struct perf_tool *tool, 1507 + const struct perf_tool *tool, 1508 1508 union perf_event *event, 1509 1509 struct perf_sample *sample, 1510 1510 struct machine *machine, ··· 1526 1526 return ret; 1527 1527 } 1528 1528 1529 - static int evlist__deliver_sample(struct evlist *evlist, struct perf_tool *tool, 1529 + static int evlist__deliver_sample(struct evlist *evlist, const struct perf_tool *tool, 1530 1530 union perf_event *event, struct perf_sample *sample, 1531 1531 struct evsel *evsel, struct machine *machine) 1532 1532 { ··· 1551 1551 struct evlist *evlist, 1552 1552 union perf_event *event, 1553 1553 struct perf_sample *sample, 1554 - struct perf_tool *tool, u64 file_offset, 1554 + const struct perf_tool *tool, u64 file_offset, 1555 1555 const char *file_path) 1556 1556 { 1557 1557 struct evsel *evsel; ··· 1639 1639 1640 1640 static int perf_session__deliver_event(struct perf_session *session, 1641 1641 union perf_event *event, 1642 - struct perf_tool *tool, 1642 + const struct perf_tool *tool, 1643 1643 u64 file_offset, 1644 1644 const char *file_path) 1645 1645 { ··· 1672 1672 const char *file_path) 1673 1673 { 1674 1674 struct ordered_events *oe = &session->ordered_events; 1675 - struct perf_tool *tool = session->tool; 1675 + const struct perf_tool *tool = session->tool; 1676 1676 struct perf_sample sample = { .time = 0, }; 1677 1677 int fd = perf_data__fd(session->data); 1678 1678 int err; ··· 1759 1759 struct perf_sample *sample) 1760 1760 { 1761 1761 struct evlist *evlist = session->evlist; 1762 - struct perf_tool *tool = session->tool; 1762 + const struct perf_tool *tool = session->tool; 1763 1763 1764 1764 events_stats__inc(&evlist->stats, event->header.type); 1765 1765 ··· 1891 1891 const char *file_path) 1892 1892 { 1893 1893 struct evlist *evlist = session->evlist; 1894 - struct perf_tool *tool = session->tool; 1894 + const struct perf_tool *tool = session->tool; 1895 1895 int ret; 1896 1896 1897 1897 if (session->header.needs_swap)
+1 -1
tools/perf/util/session.h
··· 163 163 int perf_event__process_id_index(struct perf_session *session, 164 164 union perf_event *event); 165 165 166 - int perf_event__process_finished_round(struct perf_tool *tool, 166 + int perf_event__process_finished_round(const struct perf_tool *tool, 167 167 union perf_event *event, 168 168 struct ordered_events *oe); 169 169
+40 -40
tools/perf/util/synthetic-events.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 1 + // SPDX-License-Identifier: GPL-2.0-only 2 2 3 3 #include "util/cgroup.h" 4 4 #include "util/data.h" ··· 47 47 48 48 unsigned int proc_map_timeout = DEFAULT_PROC_MAP_PARSE_TIMEOUT; 49 49 50 - int perf_tool__process_synth_event(struct perf_tool *tool, 50 + int perf_tool__process_synth_event(const struct perf_tool *tool, 51 51 union perf_event *event, 52 52 struct machine *machine, 53 53 perf_event__handler_t process) ··· 187 187 return 0; 188 188 } 189 189 190 - pid_t perf_event__synthesize_comm(struct perf_tool *tool, 190 + pid_t perf_event__synthesize_comm(const struct perf_tool *tool, 191 191 union perf_event *event, pid_t pid, 192 192 perf_event__handler_t process, 193 193 struct machine *machine) ··· 218 218 } 219 219 } 220 220 221 - int perf_event__synthesize_namespaces(struct perf_tool *tool, 221 + int perf_event__synthesize_namespaces(const struct perf_tool *tool, 222 222 union perf_event *event, 223 223 pid_t pid, pid_t tgid, 224 224 perf_event__handler_t process, ··· 257 257 return 0; 258 258 } 259 259 260 - static int perf_event__synthesize_fork(struct perf_tool *tool, 260 + static int perf_event__synthesize_fork(const struct perf_tool *tool, 261 261 union perf_event *event, 262 262 pid_t pid, pid_t tgid, pid_t ppid, 263 263 perf_event__handler_t process, ··· 418 418 dso__put(dso); 419 419 } 420 420 421 - int perf_event__synthesize_mmap_events(struct perf_tool *tool, 421 + int perf_event__synthesize_mmap_events(const struct perf_tool *tool, 422 422 union perf_event *event, 423 423 pid_t pid, pid_t tgid, 424 424 perf_event__handler_t process, ··· 542 542 } 543 543 544 544 #ifdef HAVE_FILE_HANDLE 545 - static int perf_event__synthesize_cgroup(struct perf_tool *tool, 545 + static int perf_event__synthesize_cgroup(const struct perf_tool *tool, 546 546 union perf_event *event, 547 547 char *path, size_t mount_len, 548 548 perf_event__handler_t process, ··· 582 582 return 0; 583 583 } 584 584 585 - static int perf_event__walk_cgroup_tree(struct perf_tool *tool, 585 + static int perf_event__walk_cgroup_tree(const struct perf_tool *tool, 586 586 union perf_event *event, 587 587 char *path, size_t mount_len, 588 588 perf_event__handler_t process, ··· 630 630 return ret; 631 631 } 632 632 633 - int perf_event__synthesize_cgroups(struct perf_tool *tool, 633 + int perf_event__synthesize_cgroups(const struct perf_tool *tool, 634 634 perf_event__handler_t process, 635 635 struct machine *machine) 636 636 { ··· 657 657 return 0; 658 658 } 659 659 #else 660 - int perf_event__synthesize_cgroups(struct perf_tool *tool __maybe_unused, 660 + int perf_event__synthesize_cgroups(const struct perf_tool *tool __maybe_unused, 661 661 perf_event__handler_t process __maybe_unused, 662 662 struct machine *machine __maybe_unused) 663 663 { ··· 666 666 #endif 667 667 668 668 struct perf_event__synthesize_modules_maps_cb_args { 669 - struct perf_tool *tool; 669 + const struct perf_tool *tool; 670 670 perf_event__handler_t process; 671 671 struct machine *machine; 672 672 union perf_event *event; ··· 717 717 return 0; 718 718 } 719 719 720 - int perf_event__synthesize_modules(struct perf_tool *tool, perf_event__handler_t process, 720 + int perf_event__synthesize_modules(const struct perf_tool *tool, perf_event__handler_t process, 721 721 struct machine *machine) 722 722 { 723 723 int rc; ··· 763 763 union perf_event *fork_event, 764 764 union perf_event *namespaces_event, 765 765 pid_t pid, int full, perf_event__handler_t process, 766 - struct perf_tool *tool, struct machine *machine, 766 + const struct perf_tool *tool, struct machine *machine, 767 767 bool needs_mmap, bool mmap_data) 768 768 { 769 769 char filename[PATH_MAX]; ··· 852 852 return rc; 853 853 } 854 854 855 - int perf_event__synthesize_thread_map(struct perf_tool *tool, 855 + int perf_event__synthesize_thread_map(const struct perf_tool *tool, 856 856 struct perf_thread_map *threads, 857 857 perf_event__handler_t process, 858 858 struct machine *machine, ··· 929 929 return err; 930 930 } 931 931 932 - static int __perf_event__synthesize_threads(struct perf_tool *tool, 932 + static int __perf_event__synthesize_threads(const struct perf_tool *tool, 933 933 perf_event__handler_t process, 934 934 struct machine *machine, 935 935 bool needs_mmap, ··· 993 993 } 994 994 995 995 struct synthesize_threads_arg { 996 - struct perf_tool *tool; 996 + const struct perf_tool *tool; 997 997 perf_event__handler_t process; 998 998 struct machine *machine; 999 999 bool needs_mmap; ··· 1015 1015 return NULL; 1016 1016 } 1017 1017 1018 - int perf_event__synthesize_threads(struct perf_tool *tool, 1018 + int perf_event__synthesize_threads(const struct perf_tool *tool, 1019 1019 perf_event__handler_t process, 1020 1020 struct machine *machine, 1021 1021 bool needs_mmap, bool mmap_data, ··· 1104 1104 return err; 1105 1105 } 1106 1106 1107 - int __weak perf_event__synthesize_extra_kmaps(struct perf_tool *tool __maybe_unused, 1107 + int __weak perf_event__synthesize_extra_kmaps(const struct perf_tool *tool __maybe_unused, 1108 1108 perf_event__handler_t process __maybe_unused, 1109 1109 struct machine *machine __maybe_unused) 1110 1110 { 1111 1111 return 0; 1112 1112 } 1113 1113 1114 - static int __perf_event__synthesize_kernel_mmap(struct perf_tool *tool, 1114 + static int __perf_event__synthesize_kernel_mmap(const struct perf_tool *tool, 1115 1115 perf_event__handler_t process, 1116 1116 struct machine *machine) 1117 1117 { ··· 1183 1183 return err; 1184 1184 } 1185 1185 1186 - int perf_event__synthesize_kernel_mmap(struct perf_tool *tool, 1186 + int perf_event__synthesize_kernel_mmap(const struct perf_tool *tool, 1187 1187 perf_event__handler_t process, 1188 1188 struct machine *machine) 1189 1189 { ··· 1196 1196 return perf_event__synthesize_extra_kmaps(tool, process, machine); 1197 1197 } 1198 1198 1199 - int perf_event__synthesize_thread_map2(struct perf_tool *tool, 1199 + int perf_event__synthesize_thread_map2(const struct perf_tool *tool, 1200 1200 struct perf_thread_map *threads, 1201 1201 perf_event__handler_t process, 1202 1202 struct machine *machine) ··· 1346 1346 } 1347 1347 1348 1348 1349 - int perf_event__synthesize_cpu_map(struct perf_tool *tool, 1349 + int perf_event__synthesize_cpu_map(const struct perf_tool *tool, 1350 1350 const struct perf_cpu_map *map, 1351 1351 perf_event__handler_t process, 1352 1352 struct machine *machine) ··· 1364 1364 return err; 1365 1365 } 1366 1366 1367 - int perf_event__synthesize_stat_config(struct perf_tool *tool, 1367 + int perf_event__synthesize_stat_config(const struct perf_tool *tool, 1368 1368 struct perf_stat_config *config, 1369 1369 perf_event__handler_t process, 1370 1370 struct machine *machine) ··· 1403 1403 return err; 1404 1404 } 1405 1405 1406 - int perf_event__synthesize_stat(struct perf_tool *tool, 1406 + int perf_event__synthesize_stat(const struct perf_tool *tool, 1407 1407 struct perf_cpu cpu, u32 thread, u64 id, 1408 1408 struct perf_counts_values *count, 1409 1409 perf_event__handler_t process, ··· 1425 1425 return process(tool, (union perf_event *) &event, NULL, machine); 1426 1426 } 1427 1427 1428 - int perf_event__synthesize_stat_round(struct perf_tool *tool, 1428 + int perf_event__synthesize_stat_round(const struct perf_tool *tool, 1429 1429 u64 evtime, u64 type, 1430 1430 perf_event__handler_t process, 1431 1431 struct machine *machine) ··· 1826 1826 return (void *)array - (void *)start; 1827 1827 } 1828 1828 1829 - int __perf_event__synthesize_id_index(struct perf_tool *tool, perf_event__handler_t process, 1829 + int __perf_event__synthesize_id_index(const struct perf_tool *tool, perf_event__handler_t process, 1830 1830 struct evlist *evlist, struct machine *machine, size_t from) 1831 1831 { 1832 1832 union perf_event *ev; ··· 1918 1918 return err; 1919 1919 } 1920 1920 1921 - int perf_event__synthesize_id_index(struct perf_tool *tool, perf_event__handler_t process, 1921 + int perf_event__synthesize_id_index(const struct perf_tool *tool, perf_event__handler_t process, 1922 1922 struct evlist *evlist, struct machine *machine) 1923 1923 { 1924 1924 return __perf_event__synthesize_id_index(tool, process, evlist, machine, 0); 1925 1925 } 1926 1926 1927 - int __machine__synthesize_threads(struct machine *machine, struct perf_tool *tool, 1927 + int __machine__synthesize_threads(struct machine *machine, const struct perf_tool *tool, 1928 1928 struct target *target, struct perf_thread_map *threads, 1929 1929 perf_event__handler_t process, bool needs_mmap, 1930 1930 bool data_mmap, unsigned int nr_threads_synthesize) ··· 1985 1985 return ev; 1986 1986 } 1987 1987 1988 - int perf_event__synthesize_event_update_unit(struct perf_tool *tool, struct evsel *evsel, 1988 + int perf_event__synthesize_event_update_unit(const struct perf_tool *tool, struct evsel *evsel, 1989 1989 perf_event__handler_t process) 1990 1990 { 1991 1991 size_t size = strlen(evsel->unit); ··· 2002 2002 return err; 2003 2003 } 2004 2004 2005 - int perf_event__synthesize_event_update_scale(struct perf_tool *tool, struct evsel *evsel, 2005 + int perf_event__synthesize_event_update_scale(const struct perf_tool *tool, struct evsel *evsel, 2006 2006 perf_event__handler_t process) 2007 2007 { 2008 2008 struct perf_record_event_update *ev; ··· 2019 2019 return err; 2020 2020 } 2021 2021 2022 - int perf_event__synthesize_event_update_name(struct perf_tool *tool, struct evsel *evsel, 2022 + int perf_event__synthesize_event_update_name(const struct perf_tool *tool, struct evsel *evsel, 2023 2023 perf_event__handler_t process) 2024 2024 { 2025 2025 struct perf_record_event_update *ev; ··· 2036 2036 return err; 2037 2037 } 2038 2038 2039 - int perf_event__synthesize_event_update_cpus(struct perf_tool *tool, struct evsel *evsel, 2039 + int perf_event__synthesize_event_update_cpus(const struct perf_tool *tool, struct evsel *evsel, 2040 2040 perf_event__handler_t process) 2041 2041 { 2042 2042 struct synthesize_cpu_map_data syn_data = { .map = evsel->core.own_cpus }; ··· 2059 2059 return err; 2060 2060 } 2061 2061 2062 - int perf_event__synthesize_attrs(struct perf_tool *tool, struct evlist *evlist, 2062 + int perf_event__synthesize_attrs(const struct perf_tool *tool, struct evlist *evlist, 2063 2063 perf_event__handler_t process) 2064 2064 { 2065 2065 struct evsel *evsel; ··· 2087 2087 return evsel->scale != 1; 2088 2088 } 2089 2089 2090 - int perf_event__synthesize_extra_attr(struct perf_tool *tool, struct evlist *evsel_list, 2090 + int perf_event__synthesize_extra_attr(const struct perf_tool *tool, struct evlist *evsel_list, 2091 2091 perf_event__handler_t process, bool is_pipe) 2092 2092 { 2093 2093 struct evsel *evsel; ··· 2143 2143 return 0; 2144 2144 } 2145 2145 2146 - int perf_event__synthesize_attr(struct perf_tool *tool, struct perf_event_attr *attr, 2146 + int perf_event__synthesize_attr(const struct perf_tool *tool, struct perf_event_attr *attr, 2147 2147 u32 ids, u64 *id, perf_event__handler_t process) 2148 2148 { 2149 2149 union perf_event *ev; ··· 2177 2177 } 2178 2178 2179 2179 #ifdef HAVE_LIBTRACEEVENT 2180 - int perf_event__synthesize_tracing_data(struct perf_tool *tool, int fd, struct evlist *evlist, 2180 + int perf_event__synthesize_tracing_data(const struct perf_tool *tool, int fd, struct evlist *evlist, 2181 2181 perf_event__handler_t process) 2182 2182 { 2183 2183 union perf_event ev; ··· 2225 2225 } 2226 2226 #endif 2227 2227 2228 - int perf_event__synthesize_build_id(struct perf_tool *tool, struct dso *pos, u16 misc, 2228 + int perf_event__synthesize_build_id(const struct perf_tool *tool, struct dso *pos, u16 misc, 2229 2229 perf_event__handler_t process, struct machine *machine) 2230 2230 { 2231 2231 union perf_event ev; ··· 2249 2249 return process(tool, &ev, NULL, machine); 2250 2250 } 2251 2251 2252 - int perf_event__synthesize_stat_events(struct perf_stat_config *config, struct perf_tool *tool, 2252 + int perf_event__synthesize_stat_events(struct perf_stat_config *config, const struct perf_tool *tool, 2253 2253 struct evlist *evlist, perf_event__handler_t process, bool attrs) 2254 2254 { 2255 2255 int err; ··· 2286 2286 2287 2287 extern const struct perf_header_feature_ops feat_ops[HEADER_LAST_FEATURE]; 2288 2288 2289 - int perf_event__synthesize_features(struct perf_tool *tool, struct perf_session *session, 2289 + int perf_event__synthesize_features(const struct perf_tool *tool, struct perf_session *session, 2290 2290 struct evlist *evlist, perf_event__handler_t process) 2291 2291 { 2292 2292 struct perf_header *header = &session->header; ··· 2349 2349 return ret; 2350 2350 } 2351 2351 2352 - int perf_event__synthesize_for_pipe(struct perf_tool *tool, 2352 + int perf_event__synthesize_for_pipe(const struct perf_tool *tool, 2353 2353 struct perf_session *session, 2354 2354 struct perf_data *data, 2355 2355 perf_event__handler_t process)
+34 -34
tools/perf/util/synthetic-events.h
··· 40 40 41 41 int parse_synth_opt(char *str); 42 42 43 - typedef int (*perf_event__handler_t)(struct perf_tool *tool, union perf_event *event, 43 + typedef int (*perf_event__handler_t)(const struct perf_tool *tool, union perf_event *event, 44 44 struct perf_sample *sample, struct machine *machine); 45 45 46 - int perf_event__synthesize_attrs(struct perf_tool *tool, struct evlist *evlist, perf_event__handler_t process); 47 - int perf_event__synthesize_attr(struct perf_tool *tool, struct perf_event_attr *attr, u32 ids, u64 *id, perf_event__handler_t process); 48 - int perf_event__synthesize_build_id(struct perf_tool *tool, struct dso *pos, u16 misc, perf_event__handler_t process, struct machine *machine); 49 - int perf_event__synthesize_cpu_map(struct perf_tool *tool, const struct perf_cpu_map *cpus, perf_event__handler_t process, struct machine *machine); 50 - int perf_event__synthesize_event_update_cpus(struct perf_tool *tool, struct evsel *evsel, perf_event__handler_t process); 51 - int perf_event__synthesize_event_update_name(struct perf_tool *tool, struct evsel *evsel, perf_event__handler_t process); 52 - int perf_event__synthesize_event_update_scale(struct perf_tool *tool, struct evsel *evsel, perf_event__handler_t process); 53 - int perf_event__synthesize_event_update_unit(struct perf_tool *tool, struct evsel *evsel, perf_event__handler_t process); 54 - int perf_event__synthesize_extra_attr(struct perf_tool *tool, struct evlist *evsel_list, perf_event__handler_t process, bool is_pipe); 55 - int perf_event__synthesize_extra_kmaps(struct perf_tool *tool, perf_event__handler_t process, struct machine *machine); 56 - int perf_event__synthesize_features(struct perf_tool *tool, struct perf_session *session, struct evlist *evlist, perf_event__handler_t process); 57 - int perf_event__synthesize_id_index(struct perf_tool *tool, perf_event__handler_t process, struct evlist *evlist, struct machine *machine); 58 - int __perf_event__synthesize_id_index(struct perf_tool *tool, perf_event__handler_t process, struct evlist *evlist, struct machine *machine, size_t from); 46 + int perf_event__synthesize_attrs(const struct perf_tool *tool, struct evlist *evlist, perf_event__handler_t process); 47 + int perf_event__synthesize_attr(const struct perf_tool *tool, struct perf_event_attr *attr, u32 ids, u64 *id, perf_event__handler_t process); 48 + int perf_event__synthesize_build_id(const struct perf_tool *tool, struct dso *pos, u16 misc, perf_event__handler_t process, struct machine *machine); 49 + int perf_event__synthesize_cpu_map(const struct perf_tool *tool, const struct perf_cpu_map *cpus, perf_event__handler_t process, struct machine *machine); 50 + int perf_event__synthesize_event_update_cpus(const struct perf_tool *tool, struct evsel *evsel, perf_event__handler_t process); 51 + int perf_event__synthesize_event_update_name(const struct perf_tool *tool, struct evsel *evsel, perf_event__handler_t process); 52 + int perf_event__synthesize_event_update_scale(const struct perf_tool *tool, struct evsel *evsel, perf_event__handler_t process); 53 + int perf_event__synthesize_event_update_unit(const struct perf_tool *tool, struct evsel *evsel, perf_event__handler_t process); 54 + int perf_event__synthesize_extra_attr(const struct perf_tool *tool, struct evlist *evsel_list, perf_event__handler_t process, bool is_pipe); 55 + int perf_event__synthesize_extra_kmaps(const struct perf_tool *tool, perf_event__handler_t process, struct machine *machine); 56 + int perf_event__synthesize_features(const struct perf_tool *tool, struct perf_session *session, struct evlist *evlist, perf_event__handler_t process); 57 + int perf_event__synthesize_id_index(const struct perf_tool *tool, perf_event__handler_t process, struct evlist *evlist, struct machine *machine); 58 + int __perf_event__synthesize_id_index(const struct perf_tool *tool, perf_event__handler_t process, struct evlist *evlist, struct machine *machine, size_t from); 59 59 int perf_event__synthesize_id_sample(__u64 *array, u64 type, const struct perf_sample *sample); 60 - int perf_event__synthesize_kernel_mmap(struct perf_tool *tool, perf_event__handler_t process, struct machine *machine); 61 - 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); 62 - int perf_event__synthesize_modules(struct perf_tool *tool, perf_event__handler_t process, struct machine *machine); 63 - int perf_event__synthesize_namespaces(struct perf_tool *tool, union perf_event *event, pid_t pid, pid_t tgid, perf_event__handler_t process, struct machine *machine); 64 - int perf_event__synthesize_cgroups(struct perf_tool *tool, perf_event__handler_t process, struct machine *machine); 60 + int perf_event__synthesize_kernel_mmap(const struct perf_tool *tool, perf_event__handler_t process, struct machine *machine); 61 + 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, struct machine *machine, bool mmap_data); 62 + int perf_event__synthesize_modules(const struct perf_tool *tool, perf_event__handler_t process, struct machine *machine); 63 + 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, struct machine *machine); 64 + int perf_event__synthesize_cgroups(const struct perf_tool *tool, perf_event__handler_t process, struct machine *machine); 65 65 int perf_event__synthesize_sample(union perf_event *event, u64 type, u64 read_format, const struct perf_sample *sample); 66 - int perf_event__synthesize_stat_config(struct perf_tool *tool, struct perf_stat_config *config, perf_event__handler_t process, struct machine *machine); 67 - int perf_event__synthesize_stat_events(struct perf_stat_config *config, struct perf_tool *tool, struct evlist *evlist, perf_event__handler_t process, bool attrs); 68 - int perf_event__synthesize_stat_round(struct perf_tool *tool, u64 time, u64 type, perf_event__handler_t process, struct machine *machine); 69 - int perf_event__synthesize_stat(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); 70 - int perf_event__synthesize_thread_map2(struct perf_tool *tool, struct perf_thread_map *threads, perf_event__handler_t process, struct machine *machine); 71 - 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); 72 - int perf_event__synthesize_threads(struct perf_tool *tool, perf_event__handler_t process, struct machine *machine, bool needs_mmap, bool mmap_data, unsigned int nr_threads_synthesize); 73 - int perf_event__synthesize_tracing_data(struct perf_tool *tool, int fd, struct evlist *evlist, perf_event__handler_t process); 74 - int perf_event__synth_time_conv(const struct perf_event_mmap_page *pc, struct perf_tool *tool, perf_event__handler_t process, struct machine *machine); 75 - 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); 66 + int perf_event__synthesize_stat_config(const struct perf_tool *tool, struct perf_stat_config *config, perf_event__handler_t process, struct machine *machine); 67 + int perf_event__synthesize_stat_events(struct perf_stat_config *config, const struct perf_tool *tool, struct evlist *evlist, perf_event__handler_t process, bool attrs); 68 + int perf_event__synthesize_stat_round(const struct perf_tool *tool, u64 time, u64 type, perf_event__handler_t process, struct machine *machine); 69 + 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); 70 + int perf_event__synthesize_thread_map2(const struct perf_tool *tool, struct perf_thread_map *threads, perf_event__handler_t process, struct machine *machine); 71 + int perf_event__synthesize_thread_map(const struct perf_tool *tool, struct perf_thread_map *threads, perf_event__handler_t process, struct machine *machine, bool needs_mmap, bool mmap_data); 72 + int perf_event__synthesize_threads(const struct perf_tool *tool, perf_event__handler_t process, struct machine *machine, bool needs_mmap, bool mmap_data, unsigned int nr_threads_synthesize); 73 + int perf_event__synthesize_tracing_data(const struct perf_tool *tool, int fd, struct evlist *evlist, perf_event__handler_t process); 74 + int perf_event__synth_time_conv(const struct perf_event_mmap_page *pc, const struct perf_tool *tool, perf_event__handler_t process, struct machine *machine); 75 + 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); 76 76 77 - int perf_tool__process_synth_event(struct perf_tool *tool, union perf_event *event, struct machine *machine, perf_event__handler_t process); 77 + int perf_tool__process_synth_event(const struct perf_tool *tool, union perf_event *event, struct machine *machine, perf_event__handler_t process); 78 78 79 79 size_t perf_event__sample_event_size(const struct perf_sample *sample, u64 type, u64 read_format); 80 80 81 - int __machine__synthesize_threads(struct machine *machine, struct perf_tool *tool, 81 + int __machine__synthesize_threads(struct machine *machine, const struct perf_tool *tool, 82 82 struct target *target, struct perf_thread_map *threads, 83 83 perf_event__handler_t process, bool needs_mmap, bool data_mmap, 84 84 unsigned int nr_threads_synthesize); ··· 87 87 unsigned int nr_threads_synthesize); 88 88 89 89 #ifdef HAVE_AUXTRACE_SUPPORT 90 - int perf_event__synthesize_auxtrace_info(struct auxtrace_record *itr, struct perf_tool *tool, 90 + int perf_event__synthesize_auxtrace_info(struct auxtrace_record *itr, const struct perf_tool *tool, 91 91 struct perf_session *session, perf_event__handler_t process); 92 92 93 93 #else // HAVE_AUXTRACE_SUPPORT ··· 96 96 97 97 static inline int 98 98 perf_event__synthesize_auxtrace_info(struct auxtrace_record *itr __maybe_unused, 99 - struct perf_tool *tool __maybe_unused, 99 + const struct perf_tool *tool __maybe_unused, 100 100 struct perf_session *session __maybe_unused, 101 101 perf_event__handler_t process __maybe_unused) 102 102 { ··· 117 117 } 118 118 #endif // HAVE_LIBBPF_SUPPORT 119 119 120 - int perf_event__synthesize_for_pipe(struct perf_tool *tool, 120 + int perf_event__synthesize_for_pipe(const struct perf_tool *tool, 121 121 struct perf_session *session, 122 122 struct perf_data *data, 123 123 perf_event__handler_t process);
+4 -4
tools/perf/util/tool.h
··· 15 15 struct machine; 16 16 struct ordered_events; 17 17 18 - typedef int (*event_sample)(struct perf_tool *tool, union perf_event *event, 18 + typedef int (*event_sample)(const struct perf_tool *tool, union perf_event *event, 19 19 struct perf_sample *sample, 20 20 struct evsel *evsel, struct machine *machine); 21 21 22 - typedef int (*event_op)(struct perf_tool *tool, union perf_event *event, 22 + typedef int (*event_op)(const struct perf_tool *tool, union perf_event *event, 23 23 struct perf_sample *sample, struct machine *machine); 24 24 25 - typedef int (*event_attr_op)(struct perf_tool *tool, 25 + typedef int (*event_attr_op)(const struct perf_tool *tool, 26 26 union perf_event *event, 27 27 struct evlist **pevlist); 28 28 ··· 31 31 typedef int (*event_op4)(struct perf_session *session, union perf_event *event, u64 data, 32 32 const char *str); 33 33 34 - typedef int (*event_oe)(struct perf_tool *tool, union perf_event *event, 34 + typedef int (*event_oe)(const struct perf_tool *tool, union perf_event *event, 35 35 struct ordered_events *oe); 36 36 37 37 enum show_feature_header {
+1 -1
tools/perf/util/tsc.c
··· 72 72 } 73 73 74 74 int perf_event__synth_time_conv(const struct perf_event_mmap_page *pc, 75 - struct perf_tool *tool, 75 + const struct perf_tool *tool, 76 76 perf_event__handler_t process, 77 77 struct machine *machine) 78 78 {