| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * auxtrace.h: AUX area trace support |
|---|
| 3 | 4 | * Copyright (c) 2013-2015, Intel Corporation. |
|---|
| 4 | | - * |
|---|
| 5 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 6 | | - * under the terms and conditions of the GNU General Public License, |
|---|
| 7 | | - * version 2, as published by the Free Software Foundation. |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is distributed in the hope it will be useful, but WITHOUT |
|---|
| 10 | | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|---|
| 11 | | - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
|---|
| 12 | | - * more details. |
|---|
| 13 | | - * |
|---|
| 14 | 5 | */ |
|---|
| 15 | 6 | |
|---|
| 16 | 7 | #ifndef __PERF_AUXTRACE_H |
|---|
| .. | .. |
|---|
| 20 | 11 | #include <errno.h> |
|---|
| 21 | 12 | #include <stdbool.h> |
|---|
| 22 | 13 | #include <stddef.h> |
|---|
| 14 | +#include <stdio.h> // FILE |
|---|
| 23 | 15 | #include <linux/list.h> |
|---|
| 24 | 16 | #include <linux/perf_event.h> |
|---|
| 25 | 17 | #include <linux/types.h> |
|---|
| 26 | | - |
|---|
| 27 | | -#include "../perf.h" |
|---|
| 28 | | -#include "event.h" |
|---|
| 29 | | -#include "session.h" |
|---|
| 30 | | -#include "debug.h" |
|---|
| 18 | +#include <asm/bitsperlong.h> |
|---|
| 19 | +#include <asm/barrier.h> |
|---|
| 31 | 20 | |
|---|
| 32 | 21 | union perf_event; |
|---|
| 33 | 22 | struct perf_session; |
|---|
| 34 | | -struct perf_evlist; |
|---|
| 23 | +struct evlist; |
|---|
| 24 | +struct evsel; |
|---|
| 35 | 25 | struct perf_tool; |
|---|
| 26 | +struct mmap; |
|---|
| 27 | +struct perf_sample; |
|---|
| 36 | 28 | struct option; |
|---|
| 37 | 29 | struct record_opts; |
|---|
| 38 | | -struct auxtrace_info_event; |
|---|
| 30 | +struct perf_record_auxtrace_error; |
|---|
| 31 | +struct perf_record_auxtrace_info; |
|---|
| 39 | 32 | struct events_stats; |
|---|
| 33 | +struct perf_pmu; |
|---|
| 34 | + |
|---|
| 35 | +enum auxtrace_error_type { |
|---|
| 36 | + PERF_AUXTRACE_ERROR_ITRACE = 1, |
|---|
| 37 | + PERF_AUXTRACE_ERROR_MAX |
|---|
| 38 | +}; |
|---|
| 40 | 39 | |
|---|
| 41 | 40 | /* Auxtrace records must have the same alignment as perf event records */ |
|---|
| 42 | 41 | #define PERF_AUXTRACE_RECORD_ALIGNMENT 8 |
|---|
| .. | .. |
|---|
| 56 | 55 | PERF_ITRACE_PERIOD_NANOSECS, |
|---|
| 57 | 56 | }; |
|---|
| 58 | 57 | |
|---|
| 58 | +#define AUXTRACE_ERR_FLG_OVERFLOW (1 << ('o' - 'a')) |
|---|
| 59 | +#define AUXTRACE_ERR_FLG_DATA_LOST (1 << ('l' - 'a')) |
|---|
| 60 | + |
|---|
| 61 | +#define AUXTRACE_LOG_FLG_ALL_PERF_EVTS (1 << ('a' - 'a')) |
|---|
| 62 | + |
|---|
| 59 | 63 | /** |
|---|
| 60 | 64 | * struct itrace_synth_opts - AUX area tracing synthesis options. |
|---|
| 61 | 65 | * @set: indicates whether or not options have been set |
|---|
| 66 | + * @default_no_sample: Default to no sampling. |
|---|
| 62 | 67 | * @inject: indicates the event (not just the sample) must be fully synthesized |
|---|
| 63 | 68 | * because 'perf inject' will write it out |
|---|
| 64 | 69 | * @instructions: whether to synthesize 'instructions' events |
|---|
| 65 | 70 | * @branches: whether to synthesize 'branches' events |
|---|
| 71 | + * (branch misses only for Arm SPE) |
|---|
| 66 | 72 | * @transactions: whether to synthesize events for transactions |
|---|
| 67 | 73 | * @ptwrites: whether to synthesize events for ptwrites |
|---|
| 68 | 74 | * @pwr_events: whether to synthesize power events |
|---|
| 75 | + * @other_events: whether to synthesize other events recorded due to the use of |
|---|
| 76 | + * aux_output |
|---|
| 69 | 77 | * @errors: whether to synthesize decoder error events |
|---|
| 70 | 78 | * @dont_decode: whether to skip decoding entirely |
|---|
| 71 | 79 | * @log: write a decoding log |
|---|
| 72 | 80 | * @calls: limit branch samples to calls (can be combined with @returns) |
|---|
| 73 | 81 | * @returns: limit branch samples to returns (can be combined with @calls) |
|---|
| 74 | 82 | * @callchain: add callchain to 'instructions' events |
|---|
| 83 | + * @add_callchain: add callchain to existing event records |
|---|
| 75 | 84 | * @thread_stack: feed branches to the thread_stack |
|---|
| 76 | 85 | * @last_branch: add branch context to 'instruction' events |
|---|
| 86 | + * @add_last_branch: add branch context to existing event records |
|---|
| 87 | + * @flc: whether to synthesize first level cache events |
|---|
| 88 | + * @llc: whether to synthesize last level cache events |
|---|
| 89 | + * @tlb: whether to synthesize TLB events |
|---|
| 90 | + * @remote_access: whether to synthesize remote access events |
|---|
| 77 | 91 | * @callchain_sz: maximum callchain size |
|---|
| 78 | 92 | * @last_branch_sz: branch context size |
|---|
| 79 | 93 | * @period: 'instructions' events period |
|---|
| 80 | 94 | * @period_type: 'instructions' events period type |
|---|
| 81 | 95 | * @initial_skip: skip N events at the beginning. |
|---|
| 82 | 96 | * @cpu_bitmap: CPUs for which to synthesize events, or NULL for all |
|---|
| 97 | + * @ptime_range: time intervals to trace or NULL |
|---|
| 98 | + * @range_num: number of time intervals to trace |
|---|
| 99 | + * @error_plus_flags: flags to affect what errors are reported |
|---|
| 100 | + * @error_minus_flags: flags to affect what errors are reported |
|---|
| 101 | + * @log_plus_flags: flags to affect what is logged |
|---|
| 102 | + * @log_minus_flags: flags to affect what is logged |
|---|
| 103 | + * @quick: quicker (less detailed) decoding |
|---|
| 83 | 104 | */ |
|---|
| 84 | 105 | struct itrace_synth_opts { |
|---|
| 85 | 106 | bool set; |
|---|
| 107 | + bool default_no_sample; |
|---|
| 86 | 108 | bool inject; |
|---|
| 87 | 109 | bool instructions; |
|---|
| 88 | 110 | bool branches; |
|---|
| 89 | 111 | bool transactions; |
|---|
| 90 | 112 | bool ptwrites; |
|---|
| 91 | 113 | bool pwr_events; |
|---|
| 114 | + bool other_events; |
|---|
| 92 | 115 | bool errors; |
|---|
| 93 | 116 | bool dont_decode; |
|---|
| 94 | 117 | bool log; |
|---|
| 95 | 118 | bool calls; |
|---|
| 96 | 119 | bool returns; |
|---|
| 97 | 120 | bool callchain; |
|---|
| 121 | + bool add_callchain; |
|---|
| 98 | 122 | bool thread_stack; |
|---|
| 99 | 123 | bool last_branch; |
|---|
| 124 | + bool add_last_branch; |
|---|
| 125 | + bool flc; |
|---|
| 126 | + bool llc; |
|---|
| 127 | + bool tlb; |
|---|
| 128 | + bool remote_access; |
|---|
| 100 | 129 | unsigned int callchain_sz; |
|---|
| 101 | 130 | unsigned int last_branch_sz; |
|---|
| 102 | 131 | unsigned long long period; |
|---|
| 103 | 132 | enum itrace_period_type period_type; |
|---|
| 104 | 133 | unsigned long initial_skip; |
|---|
| 105 | 134 | unsigned long *cpu_bitmap; |
|---|
| 135 | + struct perf_time_interval *ptime_range; |
|---|
| 136 | + int range_num; |
|---|
| 137 | + unsigned int error_plus_flags; |
|---|
| 138 | + unsigned int error_minus_flags; |
|---|
| 139 | + unsigned int log_plus_flags; |
|---|
| 140 | + unsigned int log_minus_flags; |
|---|
| 141 | + unsigned int quick; |
|---|
| 106 | 142 | }; |
|---|
| 107 | 143 | |
|---|
| 108 | 144 | /** |
|---|
| .. | .. |
|---|
| 135 | 171 | * struct auxtrace - session callbacks to allow AUX area data decoding. |
|---|
| 136 | 172 | * @process_event: lets the decoder see all session events |
|---|
| 137 | 173 | * @process_auxtrace_event: process a PERF_RECORD_AUXTRACE event |
|---|
| 174 | + * @queue_data: queue an AUX sample or PERF_RECORD_AUXTRACE event for later |
|---|
| 175 | + * processing |
|---|
| 176 | + * @dump_auxtrace_sample: dump AUX area sample data |
|---|
| 138 | 177 | * @flush_events: process any remaining data |
|---|
| 139 | 178 | * @free_events: free resources associated with event processing |
|---|
| 140 | 179 | * @free: free resources associated with the session |
|---|
| .. | .. |
|---|
| 147 | 186 | int (*process_auxtrace_event)(struct perf_session *session, |
|---|
| 148 | 187 | union perf_event *event, |
|---|
| 149 | 188 | struct perf_tool *tool); |
|---|
| 189 | + int (*queue_data)(struct perf_session *session, |
|---|
| 190 | + struct perf_sample *sample, union perf_event *event, |
|---|
| 191 | + u64 data_offset); |
|---|
| 192 | + void (*dump_auxtrace_sample)(struct perf_session *session, |
|---|
| 193 | + struct perf_sample *sample); |
|---|
| 150 | 194 | int (*flush_events)(struct perf_session *session, |
|---|
| 151 | 195 | struct perf_tool *tool); |
|---|
| 152 | 196 | void (*free_events)(struct perf_session *session); |
|---|
| 153 | 197 | void (*free)(struct perf_session *session); |
|---|
| 198 | + bool (*evsel_is_auxtrace)(struct perf_session *session, |
|---|
| 199 | + struct evsel *evsel); |
|---|
| 154 | 200 | }; |
|---|
| 155 | 201 | |
|---|
| 156 | 202 | /** |
|---|
| .. | .. |
|---|
| 307 | 353 | * @reference: provide a 64-bit reference number for auxtrace_event |
|---|
| 308 | 354 | * @read_finish: called after reading from an auxtrace mmap |
|---|
| 309 | 355 | * @alignment: alignment (if any) for AUX area data |
|---|
| 356 | + * @default_aux_sample_size: default sample size for --aux sample option |
|---|
| 357 | + * @pmu: associated pmu |
|---|
| 358 | + * @evlist: selected events list |
|---|
| 310 | 359 | */ |
|---|
| 311 | 360 | struct auxtrace_record { |
|---|
| 312 | 361 | int (*recording_options)(struct auxtrace_record *itr, |
|---|
| 313 | | - struct perf_evlist *evlist, |
|---|
| 362 | + struct evlist *evlist, |
|---|
| 314 | 363 | struct record_opts *opts); |
|---|
| 315 | 364 | size_t (*info_priv_size)(struct auxtrace_record *itr, |
|---|
| 316 | | - struct perf_evlist *evlist); |
|---|
| 365 | + struct evlist *evlist); |
|---|
| 317 | 366 | int (*info_fill)(struct auxtrace_record *itr, |
|---|
| 318 | 367 | struct perf_session *session, |
|---|
| 319 | | - struct auxtrace_info_event *auxtrace_info, |
|---|
| 368 | + struct perf_record_auxtrace_info *auxtrace_info, |
|---|
| 320 | 369 | size_t priv_size); |
|---|
| 321 | 370 | void (*free)(struct auxtrace_record *itr); |
|---|
| 322 | 371 | int (*snapshot_start)(struct auxtrace_record *itr); |
|---|
| .. | .. |
|---|
| 330 | 379 | u64 (*reference)(struct auxtrace_record *itr); |
|---|
| 331 | 380 | int (*read_finish)(struct auxtrace_record *itr, int idx); |
|---|
| 332 | 381 | unsigned int alignment; |
|---|
| 382 | + unsigned int default_aux_sample_size; |
|---|
| 383 | + struct perf_pmu *pmu; |
|---|
| 384 | + struct evlist *evlist; |
|---|
| 333 | 385 | }; |
|---|
| 334 | 386 | |
|---|
| 335 | 387 | /** |
|---|
| .. | .. |
|---|
| 373 | 425 | struct list_head head; |
|---|
| 374 | 426 | int cnt; |
|---|
| 375 | 427 | }; |
|---|
| 428 | + |
|---|
| 429 | +struct auxtrace_cache; |
|---|
| 376 | 430 | |
|---|
| 377 | 431 | #ifdef HAVE_AUXTRACE_SUPPORT |
|---|
| 378 | 432 | |
|---|
| .. | .. |
|---|
| 433 | 487 | unsigned int auxtrace_pages, |
|---|
| 434 | 488 | bool auxtrace_overwrite); |
|---|
| 435 | 489 | void auxtrace_mmap_params__set_idx(struct auxtrace_mmap_params *mp, |
|---|
| 436 | | - struct perf_evlist *evlist, int idx, |
|---|
| 490 | + struct evlist *evlist, int idx, |
|---|
| 437 | 491 | bool per_cpu); |
|---|
| 438 | 492 | |
|---|
| 439 | 493 | typedef int (*process_auxtrace_t)(struct perf_tool *tool, |
|---|
| 494 | + struct mmap *map, |
|---|
| 440 | 495 | union perf_event *event, void *data1, |
|---|
| 441 | 496 | size_t len1, void *data2, size_t len2); |
|---|
| 442 | 497 | |
|---|
| 443 | | -int auxtrace_mmap__read(struct auxtrace_mmap *mm, struct auxtrace_record *itr, |
|---|
| 498 | +int auxtrace_mmap__read(struct mmap *map, struct auxtrace_record *itr, |
|---|
| 444 | 499 | struct perf_tool *tool, process_auxtrace_t fn); |
|---|
| 445 | 500 | |
|---|
| 446 | | -int auxtrace_mmap__read_snapshot(struct auxtrace_mmap *mm, |
|---|
| 501 | +int auxtrace_mmap__read_snapshot(struct mmap *map, |
|---|
| 447 | 502 | struct auxtrace_record *itr, |
|---|
| 448 | 503 | struct perf_tool *tool, process_auxtrace_t fn, |
|---|
| 449 | 504 | size_t snapshot_size); |
|---|
| .. | .. |
|---|
| 453 | 508 | struct perf_session *session, |
|---|
| 454 | 509 | union perf_event *event, off_t data_offset, |
|---|
| 455 | 510 | struct auxtrace_buffer **buffer_ptr); |
|---|
| 511 | +struct auxtrace_queue * |
|---|
| 512 | +auxtrace_queues__sample_queue(struct auxtrace_queues *queues, |
|---|
| 513 | + struct perf_sample *sample, |
|---|
| 514 | + struct perf_session *session); |
|---|
| 515 | +int auxtrace_queues__add_sample(struct auxtrace_queues *queues, |
|---|
| 516 | + struct perf_session *session, |
|---|
| 517 | + struct perf_sample *sample, u64 data_offset, |
|---|
| 518 | + u64 reference); |
|---|
| 456 | 519 | void auxtrace_queues__free(struct auxtrace_queues *queues); |
|---|
| 457 | 520 | int auxtrace_queues__process_index(struct auxtrace_queues *queues, |
|---|
| 458 | 521 | struct perf_session *session); |
|---|
| 522 | +int auxtrace_queue_data(struct perf_session *session, bool samples, |
|---|
| 523 | + bool events); |
|---|
| 459 | 524 | struct auxtrace_buffer *auxtrace_buffer__next(struct auxtrace_queue *queue, |
|---|
| 460 | 525 | struct auxtrace_buffer *buffer); |
|---|
| 461 | 526 | void *auxtrace_buffer__get_data(struct auxtrace_buffer *buffer, int fd); |
|---|
| .. | .. |
|---|
| 480 | 545 | void auxtrace_cache__free_entry(struct auxtrace_cache *c, void *entry); |
|---|
| 481 | 546 | int auxtrace_cache__add(struct auxtrace_cache *c, u32 key, |
|---|
| 482 | 547 | struct auxtrace_cache_entry *entry); |
|---|
| 548 | +void auxtrace_cache__remove(struct auxtrace_cache *c, u32 key); |
|---|
| 483 | 549 | void *auxtrace_cache__lookup(struct auxtrace_cache *c, u32 key); |
|---|
| 484 | 550 | |
|---|
| 485 | | -struct auxtrace_record *auxtrace_record__init(struct perf_evlist *evlist, |
|---|
| 551 | +struct auxtrace_record *auxtrace_record__init(struct evlist *evlist, |
|---|
| 486 | 552 | int *err); |
|---|
| 487 | 553 | |
|---|
| 488 | 554 | int auxtrace_parse_snapshot_options(struct auxtrace_record *itr, |
|---|
| 489 | 555 | struct record_opts *opts, |
|---|
| 490 | 556 | const char *str); |
|---|
| 557 | +int auxtrace_parse_sample_options(struct auxtrace_record *itr, |
|---|
| 558 | + struct evlist *evlist, |
|---|
| 559 | + struct record_opts *opts, const char *str); |
|---|
| 491 | 560 | int auxtrace_record__options(struct auxtrace_record *itr, |
|---|
| 492 | | - struct perf_evlist *evlist, |
|---|
| 561 | + struct evlist *evlist, |
|---|
| 493 | 562 | struct record_opts *opts); |
|---|
| 494 | 563 | size_t auxtrace_record__info_priv_size(struct auxtrace_record *itr, |
|---|
| 495 | | - struct perf_evlist *evlist); |
|---|
| 564 | + struct evlist *evlist); |
|---|
| 496 | 565 | int auxtrace_record__info_fill(struct auxtrace_record *itr, |
|---|
| 497 | 566 | struct perf_session *session, |
|---|
| 498 | | - struct auxtrace_info_event *auxtrace_info, |
|---|
| 567 | + struct perf_record_auxtrace_info *auxtrace_info, |
|---|
| 499 | 568 | size_t priv_size); |
|---|
| 500 | 569 | void auxtrace_record__free(struct auxtrace_record *itr); |
|---|
| 501 | 570 | int auxtrace_record__snapshot_start(struct auxtrace_record *itr); |
|---|
| 502 | | -int auxtrace_record__snapshot_finish(struct auxtrace_record *itr); |
|---|
| 571 | +int auxtrace_record__snapshot_finish(struct auxtrace_record *itr, bool on_exit); |
|---|
| 503 | 572 | int auxtrace_record__find_snapshot(struct auxtrace_record *itr, int idx, |
|---|
| 504 | 573 | struct auxtrace_mmap *mm, |
|---|
| 505 | 574 | unsigned char *data, u64 *head, u64 *old); |
|---|
| 506 | 575 | u64 auxtrace_record__reference(struct auxtrace_record *itr); |
|---|
| 576 | +int auxtrace_record__read_finish(struct auxtrace_record *itr, int idx); |
|---|
| 507 | 577 | |
|---|
| 508 | 578 | int auxtrace_index__auxtrace_event(struct list_head *head, union perf_event *event, |
|---|
| 509 | 579 | off_t file_offset); |
|---|
| .. | .. |
|---|
| 512 | 582 | bool needs_swap); |
|---|
| 513 | 583 | void auxtrace_index__free(struct list_head *head); |
|---|
| 514 | 584 | |
|---|
| 515 | | -void auxtrace_synth_error(struct auxtrace_error_event *auxtrace_error, int type, |
|---|
| 585 | +void auxtrace_synth_error(struct perf_record_auxtrace_error *auxtrace_error, int type, |
|---|
| 516 | 586 | int code, int cpu, pid_t pid, pid_t tid, u64 ip, |
|---|
| 517 | | - const char *msg); |
|---|
| 587 | + const char *msg, u64 timestamp); |
|---|
| 518 | 588 | |
|---|
| 519 | | -int perf_event__synthesize_auxtrace_info(struct auxtrace_record *itr, |
|---|
| 520 | | - struct perf_tool *tool, |
|---|
| 521 | | - struct perf_session *session, |
|---|
| 522 | | - perf_event__handler_t process); |
|---|
| 523 | | -int perf_event__process_auxtrace_info(struct perf_tool *tool, |
|---|
| 524 | | - union perf_event *event, |
|---|
| 525 | | - struct perf_session *session); |
|---|
| 526 | | -s64 perf_event__process_auxtrace(struct perf_tool *tool, |
|---|
| 527 | | - union perf_event *event, |
|---|
| 528 | | - struct perf_session *session); |
|---|
| 529 | | -int perf_event__process_auxtrace_error(struct perf_tool *tool, |
|---|
| 530 | | - union perf_event *event, |
|---|
| 531 | | - struct perf_session *session); |
|---|
| 589 | +int perf_event__process_auxtrace_info(struct perf_session *session, |
|---|
| 590 | + union perf_event *event); |
|---|
| 591 | +s64 perf_event__process_auxtrace(struct perf_session *session, |
|---|
| 592 | + union perf_event *event); |
|---|
| 593 | +int perf_event__process_auxtrace_error(struct perf_session *session, |
|---|
| 594 | + union perf_event *event); |
|---|
| 532 | 595 | int itrace_parse_synth_opts(const struct option *opt, const char *str, |
|---|
| 533 | 596 | int unset); |
|---|
| 534 | | -void itrace_synth_opts__set_default(struct itrace_synth_opts *synth_opts); |
|---|
| 597 | +void itrace_synth_opts__set_default(struct itrace_synth_opts *synth_opts, |
|---|
| 598 | + bool no_sample); |
|---|
| 535 | 599 | |
|---|
| 536 | 600 | size_t perf_event__fprintf_auxtrace_error(union perf_event *event, FILE *fp); |
|---|
| 537 | 601 | void perf_session__auxtrace_error_inc(struct perf_session *session, |
|---|
| .. | .. |
|---|
| 542 | 606 | void addr_filters__exit(struct addr_filters *filts); |
|---|
| 543 | 607 | int addr_filters__parse_bare_filter(struct addr_filters *filts, |
|---|
| 544 | 608 | const char *filter); |
|---|
| 545 | | -int auxtrace_parse_filters(struct perf_evlist *evlist); |
|---|
| 609 | +int auxtrace_parse_filters(struct evlist *evlist); |
|---|
| 546 | 610 | |
|---|
| 547 | | -static inline int auxtrace__process_event(struct perf_session *session, |
|---|
| 548 | | - union perf_event *event, |
|---|
| 549 | | - struct perf_sample *sample, |
|---|
| 550 | | - struct perf_tool *tool) |
|---|
| 611 | +int auxtrace__process_event(struct perf_session *session, union perf_event *event, |
|---|
| 612 | + struct perf_sample *sample, struct perf_tool *tool); |
|---|
| 613 | +void auxtrace__dump_auxtrace_sample(struct perf_session *session, |
|---|
| 614 | + struct perf_sample *sample); |
|---|
| 615 | +int auxtrace__flush_events(struct perf_session *session, struct perf_tool *tool); |
|---|
| 616 | +void auxtrace__free_events(struct perf_session *session); |
|---|
| 617 | +void auxtrace__free(struct perf_session *session); |
|---|
| 618 | +bool auxtrace__evsel_is_auxtrace(struct perf_session *session, |
|---|
| 619 | + struct evsel *evsel); |
|---|
| 620 | + |
|---|
| 621 | +#define ITRACE_HELP \ |
|---|
| 622 | +" i[period]: synthesize instructions events\n" \ |
|---|
| 623 | +" b: synthesize branches events (branch misses for Arm SPE)\n" \ |
|---|
| 624 | +" c: synthesize branches events (calls only)\n" \ |
|---|
| 625 | +" r: synthesize branches events (returns only)\n" \ |
|---|
| 626 | +" x: synthesize transactions events\n" \ |
|---|
| 627 | +" w: synthesize ptwrite events\n" \ |
|---|
| 628 | +" p: synthesize power events\n" \ |
|---|
| 629 | +" o: synthesize other events recorded due to the use\n" \ |
|---|
| 630 | +" of aux-output (refer to perf record)\n" \ |
|---|
| 631 | +" e[flags]: synthesize error events\n" \ |
|---|
| 632 | +" each flag must be preceded by + or -\n" \ |
|---|
| 633 | +" error flags are: o (overflow)\n" \ |
|---|
| 634 | +" l (data lost)\n" \ |
|---|
| 635 | +" d[flags]: create a debug log\n" \ |
|---|
| 636 | +" each flag must be preceded by + or -\n" \ |
|---|
| 637 | +" log flags are: a (all perf events)\n" \ |
|---|
| 638 | +" f: synthesize first level cache events\n" \ |
|---|
| 639 | +" m: synthesize last level cache events\n" \ |
|---|
| 640 | +" t: synthesize TLB events\n" \ |
|---|
| 641 | +" a: synthesize remote access events\n" \ |
|---|
| 642 | +" g[len]: synthesize a call chain (use with i or x)\n" \ |
|---|
| 643 | +" G[len]: synthesize a call chain on existing event records\n" \ |
|---|
| 644 | +" l[len]: synthesize last branch entries (use with i or x)\n" \ |
|---|
| 645 | +" L[len]: synthesize last branch entries on existing event records\n" \ |
|---|
| 646 | +" sNUMBER: skip initial number of events\n" \ |
|---|
| 647 | +" q: quicker (less detailed) decoding\n" \ |
|---|
| 648 | +" PERIOD[ns|us|ms|i|t]: specify period to sample stream\n" \ |
|---|
| 649 | +" concatenate multiple options. Default is ibxwpe or cewp\n" |
|---|
| 650 | + |
|---|
| 651 | +static inline |
|---|
| 652 | +void itrace_synth_opts__set_time_range(struct itrace_synth_opts *opts, |
|---|
| 653 | + struct perf_time_interval *ptime_range, |
|---|
| 654 | + int range_num) |
|---|
| 551 | 655 | { |
|---|
| 552 | | - if (!session->auxtrace) |
|---|
| 553 | | - return 0; |
|---|
| 554 | | - |
|---|
| 555 | | - return session->auxtrace->process_event(session, event, sample, tool); |
|---|
| 656 | + opts->ptime_range = ptime_range; |
|---|
| 657 | + opts->range_num = range_num; |
|---|
| 556 | 658 | } |
|---|
| 557 | 659 | |
|---|
| 558 | | -static inline int auxtrace__flush_events(struct perf_session *session, |
|---|
| 559 | | - struct perf_tool *tool) |
|---|
| 660 | +static inline |
|---|
| 661 | +void itrace_synth_opts__clear_time_range(struct itrace_synth_opts *opts) |
|---|
| 560 | 662 | { |
|---|
| 561 | | - if (!session->auxtrace) |
|---|
| 562 | | - return 0; |
|---|
| 563 | | - |
|---|
| 564 | | - return session->auxtrace->flush_events(session, tool); |
|---|
| 565 | | -} |
|---|
| 566 | | - |
|---|
| 567 | | -static inline void auxtrace__free_events(struct perf_session *session) |
|---|
| 568 | | -{ |
|---|
| 569 | | - if (!session->auxtrace) |
|---|
| 570 | | - return; |
|---|
| 571 | | - |
|---|
| 572 | | - return session->auxtrace->free_events(session); |
|---|
| 573 | | -} |
|---|
| 574 | | - |
|---|
| 575 | | -static inline void auxtrace__free(struct perf_session *session) |
|---|
| 576 | | -{ |
|---|
| 577 | | - if (!session->auxtrace) |
|---|
| 578 | | - return; |
|---|
| 579 | | - |
|---|
| 580 | | - return session->auxtrace->free(session); |
|---|
| 663 | + opts->ptime_range = NULL; |
|---|
| 664 | + opts->range_num = 0; |
|---|
| 581 | 665 | } |
|---|
| 582 | 666 | |
|---|
| 583 | 667 | #else |
|---|
| 668 | +#include "debug.h" |
|---|
| 584 | 669 | |
|---|
| 585 | 670 | static inline struct auxtrace_record * |
|---|
| 586 | | -auxtrace_record__init(struct perf_evlist *evlist __maybe_unused, |
|---|
| 671 | +auxtrace_record__init(struct evlist *evlist __maybe_unused, |
|---|
| 587 | 672 | int *err) |
|---|
| 588 | 673 | { |
|---|
| 589 | 674 | *err = 0; |
|---|
| .. | .. |
|---|
| 595 | 680 | { |
|---|
| 596 | 681 | } |
|---|
| 597 | 682 | |
|---|
| 598 | | -static inline int |
|---|
| 599 | | -perf_event__synthesize_auxtrace_info(struct auxtrace_record *itr __maybe_unused, |
|---|
| 600 | | - struct perf_tool *tool __maybe_unused, |
|---|
| 601 | | - struct perf_session *session __maybe_unused, |
|---|
| 602 | | - perf_event__handler_t process __maybe_unused) |
|---|
| 603 | | -{ |
|---|
| 604 | | - return -EINVAL; |
|---|
| 605 | | -} |
|---|
| 606 | | - |
|---|
| 607 | 683 | static inline |
|---|
| 608 | 684 | int auxtrace_record__options(struct auxtrace_record *itr __maybe_unused, |
|---|
| 609 | | - struct perf_evlist *evlist __maybe_unused, |
|---|
| 685 | + struct evlist *evlist __maybe_unused, |
|---|
| 610 | 686 | struct record_opts *opts __maybe_unused) |
|---|
| 611 | 687 | { |
|---|
| 612 | 688 | return 0; |
|---|
| .. | .. |
|---|
| 651 | 727 | } |
|---|
| 652 | 728 | |
|---|
| 653 | 729 | static inline |
|---|
| 730 | +int auxtrace_parse_sample_options(struct auxtrace_record *itr __maybe_unused, |
|---|
| 731 | + struct evlist *evlist __maybe_unused, |
|---|
| 732 | + struct record_opts *opts __maybe_unused, |
|---|
| 733 | + const char *str) |
|---|
| 734 | +{ |
|---|
| 735 | + if (!str) |
|---|
| 736 | + return 0; |
|---|
| 737 | + pr_err("AUX area tracing not supported\n"); |
|---|
| 738 | + return -EINVAL; |
|---|
| 739 | +} |
|---|
| 740 | + |
|---|
| 741 | +static inline |
|---|
| 654 | 742 | int auxtrace__process_event(struct perf_session *session __maybe_unused, |
|---|
| 655 | 743 | union perf_event *event __maybe_unused, |
|---|
| 656 | 744 | struct perf_sample *sample __maybe_unused, |
|---|
| 657 | 745 | struct perf_tool *tool __maybe_unused) |
|---|
| 658 | 746 | { |
|---|
| 659 | 747 | return 0; |
|---|
| 748 | +} |
|---|
| 749 | + |
|---|
| 750 | +static inline |
|---|
| 751 | +void auxtrace__dump_auxtrace_sample(struct perf_session *session __maybe_unused, |
|---|
| 752 | + struct perf_sample *sample __maybe_unused) |
|---|
| 753 | +{ |
|---|
| 660 | 754 | } |
|---|
| 661 | 755 | |
|---|
| 662 | 756 | static inline |
|---|
| .. | .. |
|---|
| 703 | 797 | } |
|---|
| 704 | 798 | |
|---|
| 705 | 799 | static inline |
|---|
| 706 | | -int auxtrace_parse_filters(struct perf_evlist *evlist __maybe_unused) |
|---|
| 800 | +bool auxtrace__evsel_is_auxtrace(struct perf_session *session __maybe_unused, |
|---|
| 801 | + struct evsel *evsel __maybe_unused) |
|---|
| 802 | +{ |
|---|
| 803 | + return false; |
|---|
| 804 | +} |
|---|
| 805 | + |
|---|
| 806 | +static inline |
|---|
| 807 | +int auxtrace_parse_filters(struct evlist *evlist __maybe_unused) |
|---|
| 707 | 808 | { |
|---|
| 708 | 809 | return 0; |
|---|
| 709 | 810 | } |
|---|
| .. | .. |
|---|
| 717 | 818 | unsigned int auxtrace_pages, |
|---|
| 718 | 819 | bool auxtrace_overwrite); |
|---|
| 719 | 820 | void auxtrace_mmap_params__set_idx(struct auxtrace_mmap_params *mp, |
|---|
| 720 | | - struct perf_evlist *evlist, int idx, |
|---|
| 821 | + struct evlist *evlist, int idx, |
|---|
| 721 | 822 | bool per_cpu); |
|---|
| 722 | 823 | |
|---|
| 824 | +#define ITRACE_HELP "" |
|---|
| 825 | + |
|---|
| 826 | +static inline |
|---|
| 827 | +void itrace_synth_opts__set_time_range(struct itrace_synth_opts *opts |
|---|
| 828 | + __maybe_unused, |
|---|
| 829 | + struct perf_time_interval *ptime_range |
|---|
| 830 | + __maybe_unused, |
|---|
| 831 | + int range_num __maybe_unused) |
|---|
| 832 | +{ |
|---|
| 833 | +} |
|---|
| 834 | + |
|---|
| 835 | +static inline |
|---|
| 836 | +void itrace_synth_opts__clear_time_range(struct itrace_synth_opts *opts |
|---|
| 837 | + __maybe_unused) |
|---|
| 838 | +{ |
|---|
| 839 | +} |
|---|
| 840 | + |
|---|
| 723 | 841 | #endif |
|---|
| 724 | 842 | |
|---|
| 725 | 843 | #endif |
|---|