s390/vdso: drop unnecessary cc-ldoption
[linux-2.6-microblaze.git] / tools / perf / util / event.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __PERF_RECORD_H
3 #define __PERF_RECORD_H
4
5 #include <limits.h>
6 #include <stdio.h>
7 #include <linux/kernel.h>
8 #include <linux/bpf.h>
9
10 #include "../perf.h"
11 #include "build-id.h"
12 #include "perf_regs.h"
13
14 struct mmap_event {
15         struct perf_event_header header;
16         u32 pid, tid;
17         u64 start;
18         u64 len;
19         u64 pgoff;
20         char filename[PATH_MAX];
21 };
22
23 struct mmap2_event {
24         struct perf_event_header header;
25         u32 pid, tid;
26         u64 start;
27         u64 len;
28         u64 pgoff;
29         u32 maj;
30         u32 min;
31         u64 ino;
32         u64 ino_generation;
33         u32 prot;
34         u32 flags;
35         char filename[PATH_MAX];
36 };
37
38 struct comm_event {
39         struct perf_event_header header;
40         u32 pid, tid;
41         char comm[16];
42 };
43
44 struct namespaces_event {
45         struct perf_event_header header;
46         u32 pid, tid;
47         u64 nr_namespaces;
48         struct perf_ns_link_info link_info[];
49 };
50
51 struct fork_event {
52         struct perf_event_header header;
53         u32 pid, ppid;
54         u32 tid, ptid;
55         u64 time;
56 };
57
58 struct lost_event {
59         struct perf_event_header header;
60         u64 id;
61         u64 lost;
62 };
63
64 struct lost_samples_event {
65         struct perf_event_header header;
66         u64 lost;
67 };
68
69 /*
70  * PERF_FORMAT_ENABLED | PERF_FORMAT_RUNNING | PERF_FORMAT_ID
71  */
72 struct read_event {
73         struct perf_event_header header;
74         u32 pid, tid;
75         u64 value;
76         u64 time_enabled;
77         u64 time_running;
78         u64 id;
79 };
80
81 struct throttle_event {
82         struct perf_event_header header;
83         u64 time;
84         u64 id;
85         u64 stream_id;
86 };
87
88 #ifndef KSYM_NAME_LEN
89 #define KSYM_NAME_LEN 256
90 #endif
91
92 struct ksymbol_event {
93         struct perf_event_header header;
94         u64 addr;
95         u32 len;
96         u16 ksym_type;
97         u16 flags;
98         char name[KSYM_NAME_LEN];
99 };
100
101 struct bpf_event {
102         struct perf_event_header header;
103         u16 type;
104         u16 flags;
105         u32 id;
106
107         /* for bpf_prog types */
108         u8 tag[BPF_TAG_SIZE];  // prog tag
109 };
110
111 #define PERF_SAMPLE_MASK                                \
112         (PERF_SAMPLE_IP | PERF_SAMPLE_TID |             \
113          PERF_SAMPLE_TIME | PERF_SAMPLE_ADDR |          \
114         PERF_SAMPLE_ID | PERF_SAMPLE_STREAM_ID |        \
115          PERF_SAMPLE_CPU | PERF_SAMPLE_PERIOD |         \
116          PERF_SAMPLE_IDENTIFIER)
117
118 /* perf sample has 16 bits size limit */
119 #define PERF_SAMPLE_MAX_SIZE (1 << 16)
120
121 struct sample_event {
122         struct perf_event_header        header;
123         u64 array[];
124 };
125
126 struct regs_dump {
127         u64 abi;
128         u64 mask;
129         u64 *regs;
130
131         /* Cached values/mask filled by first register access. */
132         u64 cache_regs[PERF_REGS_MAX];
133         u64 cache_mask;
134 };
135
136 struct stack_dump {
137         u16 offset;
138         u64 size;
139         char *data;
140 };
141
142 struct sample_read_value {
143         u64 value;
144         u64 id;
145 };
146
147 struct sample_read {
148         u64 time_enabled;
149         u64 time_running;
150         union {
151                 struct {
152                         u64 nr;
153                         struct sample_read_value *values;
154                 } group;
155                 struct sample_read_value one;
156         };
157 };
158
159 struct ip_callchain {
160         u64 nr;
161         u64 ips[0];
162 };
163
164 struct branch_stack;
165
166 enum {
167         PERF_IP_FLAG_BRANCH             = 1ULL << 0,
168         PERF_IP_FLAG_CALL               = 1ULL << 1,
169         PERF_IP_FLAG_RETURN             = 1ULL << 2,
170         PERF_IP_FLAG_CONDITIONAL        = 1ULL << 3,
171         PERF_IP_FLAG_SYSCALLRET         = 1ULL << 4,
172         PERF_IP_FLAG_ASYNC              = 1ULL << 5,
173         PERF_IP_FLAG_INTERRUPT          = 1ULL << 6,
174         PERF_IP_FLAG_TX_ABORT           = 1ULL << 7,
175         PERF_IP_FLAG_TRACE_BEGIN        = 1ULL << 8,
176         PERF_IP_FLAG_TRACE_END          = 1ULL << 9,
177         PERF_IP_FLAG_IN_TX              = 1ULL << 10,
178 };
179
180 #define PERF_IP_FLAG_CHARS "bcrosyiABEx"
181
182 #define PERF_BRANCH_MASK                (\
183         PERF_IP_FLAG_BRANCH             |\
184         PERF_IP_FLAG_CALL               |\
185         PERF_IP_FLAG_RETURN             |\
186         PERF_IP_FLAG_CONDITIONAL        |\
187         PERF_IP_FLAG_SYSCALLRET         |\
188         PERF_IP_FLAG_ASYNC              |\
189         PERF_IP_FLAG_INTERRUPT          |\
190         PERF_IP_FLAG_TX_ABORT           |\
191         PERF_IP_FLAG_TRACE_BEGIN        |\
192         PERF_IP_FLAG_TRACE_END)
193
194 #define MAX_INSN 16
195
196 struct perf_sample {
197         u64 ip;
198         u32 pid, tid;
199         u64 time;
200         u64 addr;
201         u64 id;
202         u64 stream_id;
203         u64 period;
204         u64 weight;
205         u64 transaction;
206         u32 cpu;
207         u32 raw_size;
208         u64 data_src;
209         u64 phys_addr;
210         u32 flags;
211         u16 insn_len;
212         u8  cpumode;
213         u16 misc;
214         char insn[MAX_INSN];
215         void *raw_data;
216         struct ip_callchain *callchain;
217         struct branch_stack *branch_stack;
218         struct regs_dump  user_regs;
219         struct regs_dump  intr_regs;
220         struct stack_dump user_stack;
221         struct sample_read read;
222 };
223
224 #define PERF_MEM_DATA_SRC_NONE \
225         (PERF_MEM_S(OP, NA) |\
226          PERF_MEM_S(LVL, NA) |\
227          PERF_MEM_S(SNOOP, NA) |\
228          PERF_MEM_S(LOCK, NA) |\
229          PERF_MEM_S(TLB, NA))
230
231 struct build_id_event {
232         struct perf_event_header header;
233         pid_t                    pid;
234         u8                       build_id[PERF_ALIGN(BUILD_ID_SIZE, sizeof(u64))];
235         char                     filename[];
236 };
237
238 enum perf_user_event_type { /* above any possible kernel type */
239         PERF_RECORD_USER_TYPE_START             = 64,
240         PERF_RECORD_HEADER_ATTR                 = 64,
241         PERF_RECORD_HEADER_EVENT_TYPE           = 65, /* deprecated */
242         PERF_RECORD_HEADER_TRACING_DATA         = 66,
243         PERF_RECORD_HEADER_BUILD_ID             = 67,
244         PERF_RECORD_FINISHED_ROUND              = 68,
245         PERF_RECORD_ID_INDEX                    = 69,
246         PERF_RECORD_AUXTRACE_INFO               = 70,
247         PERF_RECORD_AUXTRACE                    = 71,
248         PERF_RECORD_AUXTRACE_ERROR              = 72,
249         PERF_RECORD_THREAD_MAP                  = 73,
250         PERF_RECORD_CPU_MAP                     = 74,
251         PERF_RECORD_STAT_CONFIG                 = 75,
252         PERF_RECORD_STAT                        = 76,
253         PERF_RECORD_STAT_ROUND                  = 77,
254         PERF_RECORD_EVENT_UPDATE                = 78,
255         PERF_RECORD_TIME_CONV                   = 79,
256         PERF_RECORD_HEADER_FEATURE              = 80,
257         PERF_RECORD_HEADER_MAX
258 };
259
260 enum auxtrace_error_type {
261         PERF_AUXTRACE_ERROR_ITRACE  = 1,
262         PERF_AUXTRACE_ERROR_MAX
263 };
264
265 /* Attribute type for custom synthesized events */
266 #define PERF_TYPE_SYNTH         (INT_MAX + 1U)
267
268 /* Attribute config for custom synthesized events */
269 enum perf_synth_id {
270         PERF_SYNTH_INTEL_PTWRITE,
271         PERF_SYNTH_INTEL_MWAIT,
272         PERF_SYNTH_INTEL_PWRE,
273         PERF_SYNTH_INTEL_EXSTOP,
274         PERF_SYNTH_INTEL_PWRX,
275         PERF_SYNTH_INTEL_CBR,
276 };
277
278 /*
279  * Raw data formats for synthesized events. Note that 4 bytes of padding are
280  * present to match the 'size' member of PERF_SAMPLE_RAW data which is always
281  * 8-byte aligned. That means we must dereference raw_data with an offset of 4.
282  * Refer perf_sample__synth_ptr() and perf_synth__raw_data().  It also means the
283  * structure sizes are 4 bytes bigger than the raw_size, refer
284  * perf_synth__raw_size().
285  */
286
287 struct perf_synth_intel_ptwrite {
288         u32 padding;
289         union {
290                 struct {
291                         u32     ip              :  1,
292                                 reserved        : 31;
293                 };
294                 u32     flags;
295         };
296         u64     payload;
297 };
298
299 struct perf_synth_intel_mwait {
300         u32 padding;
301         u32 reserved;
302         union {
303                 struct {
304                         u64     hints           :  8,
305                                 reserved1       : 24,
306                                 extensions      :  2,
307                                 reserved2       : 30;
308                 };
309                 u64     payload;
310         };
311 };
312
313 struct perf_synth_intel_pwre {
314         u32 padding;
315         u32 reserved;
316         union {
317                 struct {
318                         u64     reserved1       :  7,
319                                 hw              :  1,
320                                 subcstate       :  4,
321                                 cstate          :  4,
322                                 reserved2       : 48;
323                 };
324                 u64     payload;
325         };
326 };
327
328 struct perf_synth_intel_exstop {
329         u32 padding;
330         union {
331                 struct {
332                         u32     ip              :  1,
333                                 reserved        : 31;
334                 };
335                 u32     flags;
336         };
337 };
338
339 struct perf_synth_intel_pwrx {
340         u32 padding;
341         u32 reserved;
342         union {
343                 struct {
344                         u64     deepest_cstate  :  4,
345                                 last_cstate     :  4,
346                                 wake_reason     :  4,
347                                 reserved1       : 52;
348                 };
349                 u64     payload;
350         };
351 };
352
353 struct perf_synth_intel_cbr {
354         u32 padding;
355         union {
356                 struct {
357                         u32     cbr             :  8,
358                                 reserved1       :  8,
359                                 max_nonturbo    :  8,
360                                 reserved2       :  8;
361                 };
362                 u32     flags;
363         };
364         u32 freq;
365         u32 reserved3;
366 };
367
368 /*
369  * raw_data is always 4 bytes from an 8-byte boundary, so subtract 4 to get
370  * 8-byte alignment.
371  */
372 static inline void *perf_sample__synth_ptr(struct perf_sample *sample)
373 {
374         return sample->raw_data - 4;
375 }
376
377 static inline void *perf_synth__raw_data(void *p)
378 {
379         return p + 4;
380 }
381
382 #define perf_synth__raw_size(d) (sizeof(d) - 4)
383
384 #define perf_sample__bad_synth_size(s, d) ((s)->raw_size < sizeof(d) - 4)
385
386 /*
387  * The kernel collects the number of events it couldn't send in a stretch and
388  * when possible sends this number in a PERF_RECORD_LOST event. The number of
389  * such "chunks" of lost events is stored in .nr_events[PERF_EVENT_LOST] while
390  * total_lost tells exactly how many events the kernel in fact lost, i.e. it is
391  * the sum of all struct lost_event.lost fields reported.
392  *
393  * The kernel discards mixed up samples and sends the number in a
394  * PERF_RECORD_LOST_SAMPLES event. The number of lost-samples events is stored
395  * in .nr_events[PERF_RECORD_LOST_SAMPLES] while total_lost_samples tells
396  * exactly how many samples the kernel in fact dropped, i.e. it is the sum of
397  * all struct lost_samples_event.lost fields reported.
398  *
399  * The total_period is needed because by default auto-freq is used, so
400  * multipling nr_events[PERF_EVENT_SAMPLE] by a frequency isn't possible to get
401  * the total number of low level events, it is necessary to to sum all struct
402  * sample_event.period and stash the result in total_period.
403  */
404 struct events_stats {
405         u64 total_period;
406         u64 total_non_filtered_period;
407         u64 total_lost;
408         u64 total_lost_samples;
409         u64 total_aux_lost;
410         u64 total_aux_partial;
411         u64 total_invalid_chains;
412         u32 nr_events[PERF_RECORD_HEADER_MAX];
413         u32 nr_non_filtered_samples;
414         u32 nr_lost_warned;
415         u32 nr_unknown_events;
416         u32 nr_invalid_chains;
417         u32 nr_unknown_id;
418         u32 nr_unprocessable_samples;
419         u32 nr_auxtrace_errors[PERF_AUXTRACE_ERROR_MAX];
420         u32 nr_proc_map_timeout;
421 };
422
423 enum {
424         PERF_CPU_MAP__CPUS = 0,
425         PERF_CPU_MAP__MASK = 1,
426 };
427
428 struct cpu_map_entries {
429         u16     nr;
430         u16     cpu[];
431 };
432
433 struct cpu_map_mask {
434         u16     nr;
435         u16     long_size;
436         unsigned long mask[];
437 };
438
439 struct cpu_map_data {
440         u16     type;
441         char    data[];
442 };
443
444 struct cpu_map_event {
445         struct perf_event_header        header;
446         struct cpu_map_data             data;
447 };
448
449 struct attr_event {
450         struct perf_event_header header;
451         struct perf_event_attr attr;
452         u64 id[];
453 };
454
455 enum {
456         PERF_EVENT_UPDATE__UNIT  = 0,
457         PERF_EVENT_UPDATE__SCALE = 1,
458         PERF_EVENT_UPDATE__NAME  = 2,
459         PERF_EVENT_UPDATE__CPUS  = 3,
460 };
461
462 struct event_update_event_cpus {
463         struct cpu_map_data cpus;
464 };
465
466 struct event_update_event_scale {
467         double scale;
468 };
469
470 struct event_update_event {
471         struct perf_event_header header;
472         u64 type;
473         u64 id;
474
475         char data[];
476 };
477
478 #define MAX_EVENT_NAME 64
479
480 struct perf_trace_event_type {
481         u64     event_id;
482         char    name[MAX_EVENT_NAME];
483 };
484
485 struct event_type_event {
486         struct perf_event_header header;
487         struct perf_trace_event_type event_type;
488 };
489
490 struct tracing_data_event {
491         struct perf_event_header header;
492         u32 size;
493 };
494
495 struct id_index_entry {
496         u64 id;
497         u64 idx;
498         u64 cpu;
499         u64 tid;
500 };
501
502 struct id_index_event {
503         struct perf_event_header header;
504         u64 nr;
505         struct id_index_entry entries[0];
506 };
507
508 struct auxtrace_info_event {
509         struct perf_event_header header;
510         u32 type;
511         u32 reserved__; /* For alignment */
512         u64 priv[];
513 };
514
515 struct auxtrace_event {
516         struct perf_event_header header;
517         u64 size;
518         u64 offset;
519         u64 reference;
520         u32 idx;
521         u32 tid;
522         u32 cpu;
523         u32 reserved__; /* For alignment */
524 };
525
526 #define MAX_AUXTRACE_ERROR_MSG 64
527
528 struct auxtrace_error_event {
529         struct perf_event_header header;
530         u32 type;
531         u32 code;
532         u32 cpu;
533         u32 pid;
534         u32 tid;
535         u32 fmt;
536         u64 ip;
537         u64 time;
538         char msg[MAX_AUXTRACE_ERROR_MSG];
539 };
540
541 struct aux_event {
542         struct perf_event_header header;
543         u64     aux_offset;
544         u64     aux_size;
545         u64     flags;
546 };
547
548 struct itrace_start_event {
549         struct perf_event_header header;
550         u32 pid, tid;
551 };
552
553 struct context_switch_event {
554         struct perf_event_header header;
555         u32 next_prev_pid;
556         u32 next_prev_tid;
557 };
558
559 struct thread_map_event_entry {
560         u64     pid;
561         char    comm[16];
562 };
563
564 struct thread_map_event {
565         struct perf_event_header        header;
566         u64                             nr;
567         struct thread_map_event_entry   entries[];
568 };
569
570 enum {
571         PERF_STAT_CONFIG_TERM__AGGR_MODE        = 0,
572         PERF_STAT_CONFIG_TERM__INTERVAL         = 1,
573         PERF_STAT_CONFIG_TERM__SCALE            = 2,
574         PERF_STAT_CONFIG_TERM__MAX              = 3,
575 };
576
577 struct stat_config_event_entry {
578         u64     tag;
579         u64     val;
580 };
581
582 struct stat_config_event {
583         struct perf_event_header        header;
584         u64                             nr;
585         struct stat_config_event_entry  data[];
586 };
587
588 struct stat_event {
589         struct perf_event_header        header;
590
591         u64     id;
592         u32     cpu;
593         u32     thread;
594
595         union {
596                 struct {
597                         u64 val;
598                         u64 ena;
599                         u64 run;
600                 };
601                 u64 values[3];
602         };
603 };
604
605 enum {
606         PERF_STAT_ROUND_TYPE__INTERVAL  = 0,
607         PERF_STAT_ROUND_TYPE__FINAL     = 1,
608 };
609
610 struct stat_round_event {
611         struct perf_event_header        header;
612         u64                             type;
613         u64                             time;
614 };
615
616 struct time_conv_event {
617         struct perf_event_header header;
618         u64 time_shift;
619         u64 time_mult;
620         u64 time_zero;
621 };
622
623 struct feature_event {
624         struct perf_event_header        header;
625         u64                             feat_id;
626         char                            data[];
627 };
628
629 union perf_event {
630         struct perf_event_header        header;
631         struct mmap_event               mmap;
632         struct mmap2_event              mmap2;
633         struct comm_event               comm;
634         struct namespaces_event         namespaces;
635         struct fork_event               fork;
636         struct lost_event               lost;
637         struct lost_samples_event       lost_samples;
638         struct read_event               read;
639         struct throttle_event           throttle;
640         struct sample_event             sample;
641         struct attr_event               attr;
642         struct event_update_event       event_update;
643         struct event_type_event         event_type;
644         struct tracing_data_event       tracing_data;
645         struct build_id_event           build_id;
646         struct id_index_event           id_index;
647         struct auxtrace_info_event      auxtrace_info;
648         struct auxtrace_event           auxtrace;
649         struct auxtrace_error_event     auxtrace_error;
650         struct aux_event                aux;
651         struct itrace_start_event       itrace_start;
652         struct context_switch_event     context_switch;
653         struct thread_map_event         thread_map;
654         struct cpu_map_event            cpu_map;
655         struct stat_config_event        stat_config;
656         struct stat_event               stat;
657         struct stat_round_event         stat_round;
658         struct time_conv_event          time_conv;
659         struct feature_event            feat;
660         struct ksymbol_event            ksymbol_event;
661         struct bpf_event                bpf_event;
662 };
663
664 void perf_event__print_totals(void);
665
666 struct perf_tool;
667 struct thread_map;
668 struct cpu_map;
669 struct perf_stat_config;
670 struct perf_counts_values;
671
672 typedef int (*perf_event__handler_t)(struct perf_tool *tool,
673                                      union perf_event *event,
674                                      struct perf_sample *sample,
675                                      struct machine *machine);
676
677 int perf_event__synthesize_thread_map(struct perf_tool *tool,
678                                       struct thread_map *threads,
679                                       perf_event__handler_t process,
680                                       struct machine *machine, bool mmap_data);
681 int perf_event__synthesize_thread_map2(struct perf_tool *tool,
682                                       struct thread_map *threads,
683                                       perf_event__handler_t process,
684                                       struct machine *machine);
685 int perf_event__synthesize_cpu_map(struct perf_tool *tool,
686                                    struct cpu_map *cpus,
687                                    perf_event__handler_t process,
688                                    struct machine *machine);
689 int perf_event__synthesize_threads(struct perf_tool *tool,
690                                    perf_event__handler_t process,
691                                    struct machine *machine, bool mmap_data,
692                                    unsigned int nr_threads_synthesize);
693 int perf_event__synthesize_kernel_mmap(struct perf_tool *tool,
694                                        perf_event__handler_t process,
695                                        struct machine *machine);
696 int perf_event__synthesize_stat_config(struct perf_tool *tool,
697                                        struct perf_stat_config *config,
698                                        perf_event__handler_t process,
699                                        struct machine *machine);
700 void perf_event__read_stat_config(struct perf_stat_config *config,
701                                   struct stat_config_event *event);
702 int perf_event__synthesize_stat(struct perf_tool *tool,
703                                 u32 cpu, u32 thread, u64 id,
704                                 struct perf_counts_values *count,
705                                 perf_event__handler_t process,
706                                 struct machine *machine);
707 int perf_event__synthesize_stat_round(struct perf_tool *tool,
708                                       u64 time, u64 type,
709                                       perf_event__handler_t process,
710                                       struct machine *machine);
711 int perf_event__synthesize_modules(struct perf_tool *tool,
712                                    perf_event__handler_t process,
713                                    struct machine *machine);
714
715 int perf_event__process_comm(struct perf_tool *tool,
716                              union perf_event *event,
717                              struct perf_sample *sample,
718                              struct machine *machine);
719 int perf_event__process_lost(struct perf_tool *tool,
720                              union perf_event *event,
721                              struct perf_sample *sample,
722                              struct machine *machine);
723 int perf_event__process_lost_samples(struct perf_tool *tool,
724                                      union perf_event *event,
725                                      struct perf_sample *sample,
726                                      struct machine *machine);
727 int perf_event__process_aux(struct perf_tool *tool,
728                             union perf_event *event,
729                             struct perf_sample *sample,
730                             struct machine *machine);
731 int perf_event__process_itrace_start(struct perf_tool *tool,
732                                      union perf_event *event,
733                                      struct perf_sample *sample,
734                                      struct machine *machine);
735 int perf_event__process_switch(struct perf_tool *tool,
736                                union perf_event *event,
737                                struct perf_sample *sample,
738                                struct machine *machine);
739 int perf_event__process_namespaces(struct perf_tool *tool,
740                                    union perf_event *event,
741                                    struct perf_sample *sample,
742                                    struct machine *machine);
743 int perf_event__process_mmap(struct perf_tool *tool,
744                              union perf_event *event,
745                              struct perf_sample *sample,
746                              struct machine *machine);
747 int perf_event__process_mmap2(struct perf_tool *tool,
748                              union perf_event *event,
749                              struct perf_sample *sample,
750                              struct machine *machine);
751 int perf_event__process_fork(struct perf_tool *tool,
752                              union perf_event *event,
753                              struct perf_sample *sample,
754                              struct machine *machine);
755 int perf_event__process_exit(struct perf_tool *tool,
756                              union perf_event *event,
757                              struct perf_sample *sample,
758                              struct machine *machine);
759 int perf_event__process_ksymbol(struct perf_tool *tool,
760                                 union perf_event *event,
761                                 struct perf_sample *sample,
762                                 struct machine *machine);
763 int perf_event__process_bpf_event(struct perf_tool *tool,
764                                   union perf_event *event,
765                                   struct perf_sample *sample,
766                                   struct machine *machine);
767 int perf_tool__process_synth_event(struct perf_tool *tool,
768                                    union perf_event *event,
769                                    struct machine *machine,
770                                    perf_event__handler_t process);
771 int perf_event__process(struct perf_tool *tool,
772                         union perf_event *event,
773                         struct perf_sample *sample,
774                         struct machine *machine);
775
776 struct addr_location;
777
778 int machine__resolve(struct machine *machine, struct addr_location *al,
779                      struct perf_sample *sample);
780
781 void addr_location__put(struct addr_location *al);
782
783 struct thread;
784
785 bool is_bts_event(struct perf_event_attr *attr);
786 bool sample_addr_correlates_sym(struct perf_event_attr *attr);
787 void thread__resolve(struct thread *thread, struct addr_location *al,
788                      struct perf_sample *sample);
789
790 const char *perf_event__name(unsigned int id);
791
792 size_t perf_event__sample_event_size(const struct perf_sample *sample, u64 type,
793                                      u64 read_format);
794 int perf_event__synthesize_sample(union perf_event *event, u64 type,
795                                   u64 read_format,
796                                   const struct perf_sample *sample);
797
798 pid_t perf_event__synthesize_comm(struct perf_tool *tool,
799                                   union perf_event *event, pid_t pid,
800                                   perf_event__handler_t process,
801                                   struct machine *machine);
802
803 int perf_event__synthesize_namespaces(struct perf_tool *tool,
804                                       union perf_event *event,
805                                       pid_t pid, pid_t tgid,
806                                       perf_event__handler_t process,
807                                       struct machine *machine);
808
809 int perf_event__synthesize_mmap_events(struct perf_tool *tool,
810                                        union perf_event *event,
811                                        pid_t pid, pid_t tgid,
812                                        perf_event__handler_t process,
813                                        struct machine *machine,
814                                        bool mmap_data);
815
816 int perf_event__synthesize_extra_kmaps(struct perf_tool *tool,
817                                        perf_event__handler_t process,
818                                        struct machine *machine);
819
820 size_t perf_event__fprintf_comm(union perf_event *event, FILE *fp);
821 size_t perf_event__fprintf_mmap(union perf_event *event, FILE *fp);
822 size_t perf_event__fprintf_mmap2(union perf_event *event, FILE *fp);
823 size_t perf_event__fprintf_task(union perf_event *event, FILE *fp);
824 size_t perf_event__fprintf_aux(union perf_event *event, FILE *fp);
825 size_t perf_event__fprintf_itrace_start(union perf_event *event, FILE *fp);
826 size_t perf_event__fprintf_switch(union perf_event *event, FILE *fp);
827 size_t perf_event__fprintf_thread_map(union perf_event *event, FILE *fp);
828 size_t perf_event__fprintf_cpu_map(union perf_event *event, FILE *fp);
829 size_t perf_event__fprintf_namespaces(union perf_event *event, FILE *fp);
830 size_t perf_event__fprintf_ksymbol(union perf_event *event, FILE *fp);
831 size_t perf_event__fprintf_bpf_event(union perf_event *event, FILE *fp);
832 size_t perf_event__fprintf(union perf_event *event, FILE *fp);
833
834 int kallsyms__get_function_start(const char *kallsyms_filename,
835                                  const char *symbol_name, u64 *addr);
836
837 void *cpu_map_data__alloc(struct cpu_map *map, size_t *size, u16 *type, int *max);
838 void  cpu_map_data__synthesize(struct cpu_map_data *data, struct cpu_map *map,
839                                u16 type, int max);
840
841 void event_attr_init(struct perf_event_attr *attr);
842
843 int perf_event_paranoid(void);
844
845 extern int sysctl_perf_event_max_stack;
846 extern int sysctl_perf_event_max_contexts_per_stack;
847 extern unsigned int proc_map_timeout;
848
849 #endif /* __PERF_RECORD_H */