auxtrace.h (75bf465f0bc33e9b776a46d6a1b9b990f5fb7c37) | auxtrace.h (72932371e78012cea96edb9e833d81f1c32dd892) |
---|---|
1/* SPDX-License-Identifier: GPL-2.0-only */ 2/* 3 * auxtrace.h: AUX area trace support 4 * Copyright (c) 2013-2015, Intel Corporation. 5 */ 6 7#ifndef __PERF_AUXTRACE_H 8#define __PERF_AUXTRACE_H --- 9 unchanged lines hidden (view full) --- 18 19#include "../perf.h" 20#include "event.h" 21#include "session.h" 22#include "debug.h" 23 24union perf_event; 25struct perf_session; | 1/* SPDX-License-Identifier: GPL-2.0-only */ 2/* 3 * auxtrace.h: AUX area trace support 4 * Copyright (c) 2013-2015, Intel Corporation. 5 */ 6 7#ifndef __PERF_AUXTRACE_H 8#define __PERF_AUXTRACE_H --- 9 unchanged lines hidden (view full) --- 18 19#include "../perf.h" 20#include "event.h" 21#include "session.h" 22#include "debug.h" 23 24union perf_event; 25struct perf_session; |
26struct perf_evlist; | 26struct evlist; |
27struct perf_tool; 28struct perf_mmap; 29struct option; 30struct record_opts; | 27struct perf_tool; 28struct perf_mmap; 29struct option; 30struct record_opts; |
31struct auxtrace_info_event; | 31struct perf_record_auxtrace_info; |
32struct events_stats; 33 34/* Auxtrace records must have the same alignment as perf event records */ 35#define PERF_AUXTRACE_RECORD_ALIGNMENT 8 36 37enum auxtrace_type { 38 PERF_AUXTRACE_UNKNOWN, 39 PERF_AUXTRACE_INTEL_PT, --- 15 unchanged lines hidden (view full) --- 55 * @default_no_sample: Default to no sampling. 56 * @inject: indicates the event (not just the sample) must be fully synthesized 57 * because 'perf inject' will write it out 58 * @instructions: whether to synthesize 'instructions' events 59 * @branches: whether to synthesize 'branches' events 60 * @transactions: whether to synthesize events for transactions 61 * @ptwrites: whether to synthesize events for ptwrites 62 * @pwr_events: whether to synthesize power events | 32struct events_stats; 33 34/* Auxtrace records must have the same alignment as perf event records */ 35#define PERF_AUXTRACE_RECORD_ALIGNMENT 8 36 37enum auxtrace_type { 38 PERF_AUXTRACE_UNKNOWN, 39 PERF_AUXTRACE_INTEL_PT, --- 15 unchanged lines hidden (view full) --- 55 * @default_no_sample: Default to no sampling. 56 * @inject: indicates the event (not just the sample) must be fully synthesized 57 * because 'perf inject' will write it out 58 * @instructions: whether to synthesize 'instructions' events 59 * @branches: whether to synthesize 'branches' events 60 * @transactions: whether to synthesize events for transactions 61 * @ptwrites: whether to synthesize events for ptwrites 62 * @pwr_events: whether to synthesize power events |
63 * @other_events: whether to synthesize other events recorded due to the use of 64 * aux_output |
|
63 * @errors: whether to synthesize decoder error events 64 * @dont_decode: whether to skip decoding entirely 65 * @log: write a decoding log 66 * @calls: limit branch samples to calls (can be combined with @returns) 67 * @returns: limit branch samples to returns (can be combined with @calls) 68 * @callchain: add callchain to 'instructions' events 69 * @thread_stack: feed branches to the thread_stack 70 * @last_branch: add branch context to 'instruction' events --- 10 unchanged lines hidden (view full) --- 81 bool set; 82 bool default_no_sample; 83 bool inject; 84 bool instructions; 85 bool branches; 86 bool transactions; 87 bool ptwrites; 88 bool pwr_events; | 65 * @errors: whether to synthesize decoder error events 66 * @dont_decode: whether to skip decoding entirely 67 * @log: write a decoding log 68 * @calls: limit branch samples to calls (can be combined with @returns) 69 * @returns: limit branch samples to returns (can be combined with @calls) 70 * @callchain: add callchain to 'instructions' events 71 * @thread_stack: feed branches to the thread_stack 72 * @last_branch: add branch context to 'instruction' events --- 10 unchanged lines hidden (view full) --- 83 bool set; 84 bool default_no_sample; 85 bool inject; 86 bool instructions; 87 bool branches; 88 bool transactions; 89 bool ptwrites; 90 bool pwr_events; |
91 bool other_events; |
|
89 bool errors; 90 bool dont_decode; 91 bool log; 92 bool calls; 93 bool returns; 94 bool callchain; 95 bool thread_stack; 96 bool last_branch; --- 207 unchanged lines hidden (view full) --- 304 * @find_snapshot: find data to snapshot within auxtrace mmap 305 * @parse_snapshot_options: parse snapshot options 306 * @reference: provide a 64-bit reference number for auxtrace_event 307 * @read_finish: called after reading from an auxtrace mmap 308 * @alignment: alignment (if any) for AUX area data 309 */ 310struct auxtrace_record { 311 int (*recording_options)(struct auxtrace_record *itr, | 92 bool errors; 93 bool dont_decode; 94 bool log; 95 bool calls; 96 bool returns; 97 bool callchain; 98 bool thread_stack; 99 bool last_branch; --- 207 unchanged lines hidden (view full) --- 307 * @find_snapshot: find data to snapshot within auxtrace mmap 308 * @parse_snapshot_options: parse snapshot options 309 * @reference: provide a 64-bit reference number for auxtrace_event 310 * @read_finish: called after reading from an auxtrace mmap 311 * @alignment: alignment (if any) for AUX area data 312 */ 313struct auxtrace_record { 314 int (*recording_options)(struct auxtrace_record *itr, |
312 struct perf_evlist *evlist, | 315 struct evlist *evlist, |
313 struct record_opts *opts); 314 size_t (*info_priv_size)(struct auxtrace_record *itr, | 316 struct record_opts *opts); 317 size_t (*info_priv_size)(struct auxtrace_record *itr, |
315 struct perf_evlist *evlist); | 318 struct evlist *evlist); |
316 int (*info_fill)(struct auxtrace_record *itr, 317 struct perf_session *session, | 319 int (*info_fill)(struct auxtrace_record *itr, 320 struct perf_session *session, |
318 struct auxtrace_info_event *auxtrace_info, | 321 struct perf_record_auxtrace_info *auxtrace_info, |
319 size_t priv_size); 320 void (*free)(struct auxtrace_record *itr); 321 int (*snapshot_start)(struct auxtrace_record *itr); 322 int (*snapshot_finish)(struct auxtrace_record *itr); 323 int (*find_snapshot)(struct auxtrace_record *itr, int idx, 324 struct auxtrace_mmap *mm, unsigned char *data, 325 u64 *head, u64 *old); 326 int (*parse_snapshot_options)(struct auxtrace_record *itr, --- 100 unchanged lines hidden (view full) --- 427 struct auxtrace_mmap_params *mp, 428 void *userpg, int fd); 429void auxtrace_mmap__munmap(struct auxtrace_mmap *mm); 430void auxtrace_mmap_params__init(struct auxtrace_mmap_params *mp, 431 off_t auxtrace_offset, 432 unsigned int auxtrace_pages, 433 bool auxtrace_overwrite); 434void auxtrace_mmap_params__set_idx(struct auxtrace_mmap_params *mp, | 322 size_t priv_size); 323 void (*free)(struct auxtrace_record *itr); 324 int (*snapshot_start)(struct auxtrace_record *itr); 325 int (*snapshot_finish)(struct auxtrace_record *itr); 326 int (*find_snapshot)(struct auxtrace_record *itr, int idx, 327 struct auxtrace_mmap *mm, unsigned char *data, 328 u64 *head, u64 *old); 329 int (*parse_snapshot_options)(struct auxtrace_record *itr, --- 100 unchanged lines hidden (view full) --- 430 struct auxtrace_mmap_params *mp, 431 void *userpg, int fd); 432void auxtrace_mmap__munmap(struct auxtrace_mmap *mm); 433void auxtrace_mmap_params__init(struct auxtrace_mmap_params *mp, 434 off_t auxtrace_offset, 435 unsigned int auxtrace_pages, 436 bool auxtrace_overwrite); 437void auxtrace_mmap_params__set_idx(struct auxtrace_mmap_params *mp, |
435 struct perf_evlist *evlist, int idx, | 438 struct evlist *evlist, int idx, |
436 bool per_cpu); 437 438typedef int (*process_auxtrace_t)(struct perf_tool *tool, 439 struct perf_mmap *map, 440 union perf_event *event, void *data1, 441 size_t len1, void *data2, size_t len2); 442 443int auxtrace_mmap__read(struct perf_mmap *map, struct auxtrace_record *itr, --- 33 unchanged lines hidden (view full) --- 477 unsigned int limit_percent); 478void auxtrace_cache__free(struct auxtrace_cache *auxtrace_cache); 479void *auxtrace_cache__alloc_entry(struct auxtrace_cache *c); 480void auxtrace_cache__free_entry(struct auxtrace_cache *c, void *entry); 481int auxtrace_cache__add(struct auxtrace_cache *c, u32 key, 482 struct auxtrace_cache_entry *entry); 483void *auxtrace_cache__lookup(struct auxtrace_cache *c, u32 key); 484 | 439 bool per_cpu); 440 441typedef int (*process_auxtrace_t)(struct perf_tool *tool, 442 struct perf_mmap *map, 443 union perf_event *event, void *data1, 444 size_t len1, void *data2, size_t len2); 445 446int auxtrace_mmap__read(struct perf_mmap *map, struct auxtrace_record *itr, --- 33 unchanged lines hidden (view full) --- 480 unsigned int limit_percent); 481void auxtrace_cache__free(struct auxtrace_cache *auxtrace_cache); 482void *auxtrace_cache__alloc_entry(struct auxtrace_cache *c); 483void auxtrace_cache__free_entry(struct auxtrace_cache *c, void *entry); 484int auxtrace_cache__add(struct auxtrace_cache *c, u32 key, 485 struct auxtrace_cache_entry *entry); 486void *auxtrace_cache__lookup(struct auxtrace_cache *c, u32 key); 487 |
485struct auxtrace_record *auxtrace_record__init(struct perf_evlist *evlist, | 488struct auxtrace_record *auxtrace_record__init(struct evlist *evlist, |
486 int *err); 487 488int auxtrace_parse_snapshot_options(struct auxtrace_record *itr, 489 struct record_opts *opts, 490 const char *str); 491int auxtrace_record__options(struct auxtrace_record *itr, | 489 int *err); 490 491int auxtrace_parse_snapshot_options(struct auxtrace_record *itr, 492 struct record_opts *opts, 493 const char *str); 494int auxtrace_record__options(struct auxtrace_record *itr, |
492 struct perf_evlist *evlist, | 495 struct evlist *evlist, |
493 struct record_opts *opts); 494size_t auxtrace_record__info_priv_size(struct auxtrace_record *itr, | 496 struct record_opts *opts); 497size_t auxtrace_record__info_priv_size(struct auxtrace_record *itr, |
495 struct perf_evlist *evlist); | 498 struct evlist *evlist); |
496int auxtrace_record__info_fill(struct auxtrace_record *itr, 497 struct perf_session *session, | 499int auxtrace_record__info_fill(struct auxtrace_record *itr, 500 struct perf_session *session, |
498 struct auxtrace_info_event *auxtrace_info, | 501 struct perf_record_auxtrace_info *auxtrace_info, |
499 size_t priv_size); 500void auxtrace_record__free(struct auxtrace_record *itr); 501int auxtrace_record__snapshot_start(struct auxtrace_record *itr); | 502 size_t priv_size); 503void auxtrace_record__free(struct auxtrace_record *itr); 504int auxtrace_record__snapshot_start(struct auxtrace_record *itr); |
502int auxtrace_record__snapshot_finish(struct auxtrace_record *itr); | 505int auxtrace_record__snapshot_finish(struct auxtrace_record *itr, bool on_exit); |
503int auxtrace_record__find_snapshot(struct auxtrace_record *itr, int idx, 504 struct auxtrace_mmap *mm, 505 unsigned char *data, u64 *head, u64 *old); 506u64 auxtrace_record__reference(struct auxtrace_record *itr); 507 508int auxtrace_index__auxtrace_event(struct list_head *head, union perf_event *event, 509 off_t file_offset); 510int auxtrace_index__write(int fd, struct list_head *head); 511int auxtrace_index__process(int fd, u64 size, struct perf_session *session, 512 bool needs_swap); 513void auxtrace_index__free(struct list_head *head); 514 | 506int auxtrace_record__find_snapshot(struct auxtrace_record *itr, int idx, 507 struct auxtrace_mmap *mm, 508 unsigned char *data, u64 *head, u64 *old); 509u64 auxtrace_record__reference(struct auxtrace_record *itr); 510 511int auxtrace_index__auxtrace_event(struct list_head *head, union perf_event *event, 512 off_t file_offset); 513int auxtrace_index__write(int fd, struct list_head *head); 514int auxtrace_index__process(int fd, u64 size, struct perf_session *session, 515 bool needs_swap); 516void auxtrace_index__free(struct list_head *head); 517 |
515void auxtrace_synth_error(struct auxtrace_error_event *auxtrace_error, int type, | 518void auxtrace_synth_error(struct perf_record_auxtrace_error *auxtrace_error, int type, |
516 int code, int cpu, pid_t pid, pid_t tid, u64 ip, 517 const char *msg, u64 timestamp); 518 519int 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); 523int perf_event__process_auxtrace_info(struct perf_session *session, --- 11 unchanged lines hidden (view full) --- 535void perf_session__auxtrace_error_inc(struct perf_session *session, 536 union perf_event *event); 537void events_stats__auxtrace_error_warn(const struct events_stats *stats); 538 539void addr_filters__init(struct addr_filters *filts); 540void addr_filters__exit(struct addr_filters *filts); 541int addr_filters__parse_bare_filter(struct addr_filters *filts, 542 const char *filter); | 519 int code, int cpu, pid_t pid, pid_t tid, u64 ip, 520 const char *msg, u64 timestamp); 521 522int perf_event__synthesize_auxtrace_info(struct auxtrace_record *itr, 523 struct perf_tool *tool, 524 struct perf_session *session, 525 perf_event__handler_t process); 526int perf_event__process_auxtrace_info(struct perf_session *session, --- 11 unchanged lines hidden (view full) --- 538void perf_session__auxtrace_error_inc(struct perf_session *session, 539 union perf_event *event); 540void events_stats__auxtrace_error_warn(const struct events_stats *stats); 541 542void addr_filters__init(struct addr_filters *filts); 543void addr_filters__exit(struct addr_filters *filts); 544int addr_filters__parse_bare_filter(struct addr_filters *filts, 545 const char *filter); |
543int auxtrace_parse_filters(struct perf_evlist *evlist); | 546int auxtrace_parse_filters(struct evlist *evlist); |
544 545static inline int auxtrace__process_event(struct perf_session *session, 546 union perf_event *event, 547 struct perf_sample *sample, 548 struct perf_tool *tool) 549{ 550 if (!session->auxtrace) 551 return 0; --- 56 unchanged lines hidden (view full) --- 608{ 609 opts->ptime_range = NULL; 610 opts->range_num = 0; 611} 612 613#else 614 615static inline struct auxtrace_record * | 547 548static inline int auxtrace__process_event(struct perf_session *session, 549 union perf_event *event, 550 struct perf_sample *sample, 551 struct perf_tool *tool) 552{ 553 if (!session->auxtrace) 554 return 0; --- 56 unchanged lines hidden (view full) --- 611{ 612 opts->ptime_range = NULL; 613 opts->range_num = 0; 614} 615 616#else 617 618static inline struct auxtrace_record * |
616auxtrace_record__init(struct perf_evlist *evlist __maybe_unused, | 619auxtrace_record__init(struct evlist *evlist __maybe_unused, |
617 int *err) 618{ 619 *err = 0; 620 return NULL; 621} 622 623static inline 624void auxtrace_record__free(struct auxtrace_record *itr __maybe_unused) --- 6 unchanged lines hidden (view full) --- 631 struct perf_session *session __maybe_unused, 632 perf_event__handler_t process __maybe_unused) 633{ 634 return -EINVAL; 635} 636 637static inline 638int auxtrace_record__options(struct auxtrace_record *itr __maybe_unused, | 620 int *err) 621{ 622 *err = 0; 623 return NULL; 624} 625 626static inline 627void auxtrace_record__free(struct auxtrace_record *itr __maybe_unused) --- 6 unchanged lines hidden (view full) --- 634 struct perf_session *session __maybe_unused, 635 perf_event__handler_t process __maybe_unused) 636{ 637 return -EINVAL; 638} 639 640static inline 641int auxtrace_record__options(struct auxtrace_record *itr __maybe_unused, |
639 struct perf_evlist *evlist __maybe_unused, | 642 struct evlist *evlist __maybe_unused, |
640 struct record_opts *opts __maybe_unused) 641{ 642 return 0; 643} 644 645#define perf_event__process_auxtrace_info 0 646#define perf_event__process_auxtrace 0 647#define perf_event__process_auxtrace_error 0 --- 80 unchanged lines hidden (view full) --- 728} 729 730static inline 731void auxtrace_index__free(struct list_head *head __maybe_unused) 732{ 733} 734 735static inline | 643 struct record_opts *opts __maybe_unused) 644{ 645 return 0; 646} 647 648#define perf_event__process_auxtrace_info 0 649#define perf_event__process_auxtrace 0 650#define perf_event__process_auxtrace_error 0 --- 80 unchanged lines hidden (view full) --- 731} 732 733static inline 734void auxtrace_index__free(struct list_head *head __maybe_unused) 735{ 736} 737 738static inline |
736int auxtrace_parse_filters(struct perf_evlist *evlist __maybe_unused) | 739int auxtrace_parse_filters(struct evlist *evlist __maybe_unused) |
737{ 738 return 0; 739} 740 741int auxtrace_mmap__mmap(struct auxtrace_mmap *mm, 742 struct auxtrace_mmap_params *mp, 743 void *userpg, int fd); 744void auxtrace_mmap__munmap(struct auxtrace_mmap *mm); 745void auxtrace_mmap_params__init(struct auxtrace_mmap_params *mp, 746 off_t auxtrace_offset, 747 unsigned int auxtrace_pages, 748 bool auxtrace_overwrite); 749void auxtrace_mmap_params__set_idx(struct auxtrace_mmap_params *mp, | 740{ 741 return 0; 742} 743 744int auxtrace_mmap__mmap(struct auxtrace_mmap *mm, 745 struct auxtrace_mmap_params *mp, 746 void *userpg, int fd); 747void auxtrace_mmap__munmap(struct auxtrace_mmap *mm); 748void auxtrace_mmap_params__init(struct auxtrace_mmap_params *mp, 749 off_t auxtrace_offset, 750 unsigned int auxtrace_pages, 751 bool auxtrace_overwrite); 752void auxtrace_mmap_params__set_idx(struct auxtrace_mmap_params *mp, |
750 struct perf_evlist *evlist, int idx, | 753 struct evlist *evlist, int idx, |
751 bool per_cpu); 752 753#define ITRACE_HELP "" 754 755static inline 756void itrace_synth_opts__set_time_range(struct itrace_synth_opts *opts 757 __maybe_unused, 758 struct perf_time_interval *ptime_range --- 14 unchanged lines hidden --- | 754 bool per_cpu); 755 756#define ITRACE_HELP "" 757 758static inline 759void itrace_synth_opts__set_time_range(struct itrace_synth_opts *opts 760 __maybe_unused, 761 struct perf_time_interval *ptime_range --- 14 unchanged lines hidden --- |