1 #include <linux/types.h>
11 #include "thread_map.h"
12 #include "symbol/kallsyms.h"
14 static const char *perf_event__names[] = {
16 [PERF_RECORD_MMAP] = "MMAP",
17 [PERF_RECORD_MMAP2] = "MMAP2",
18 [PERF_RECORD_LOST] = "LOST",
19 [PERF_RECORD_COMM] = "COMM",
20 [PERF_RECORD_EXIT] = "EXIT",
21 [PERF_RECORD_THROTTLE] = "THROTTLE",
22 [PERF_RECORD_UNTHROTTLE] = "UNTHROTTLE",
23 [PERF_RECORD_FORK] = "FORK",
24 [PERF_RECORD_READ] = "READ",
25 [PERF_RECORD_SAMPLE] = "SAMPLE",
26 [PERF_RECORD_HEADER_ATTR] = "ATTR",
27 [PERF_RECORD_HEADER_EVENT_TYPE] = "EVENT_TYPE",
28 [PERF_RECORD_HEADER_TRACING_DATA] = "TRACING_DATA",
29 [PERF_RECORD_HEADER_BUILD_ID] = "BUILD_ID",
30 [PERF_RECORD_FINISHED_ROUND] = "FINISHED_ROUND",
31 [PERF_RECORD_ID_INDEX] = "ID_INDEX",
32 [PERF_RECORD_AUXTRACE_INFO] = "AUXTRACE_INFO",
33 [PERF_RECORD_AUXTRACE] = "AUXTRACE",
34 [PERF_RECORD_AUXTRACE_ERROR] = "AUXTRACE_ERROR",
37 const char *perf_event__name(unsigned int id)
39 if (id >= ARRAY_SIZE(perf_event__names))
41 if (!perf_event__names[id])
43 return perf_event__names[id];
46 static struct perf_sample synth_sample = {
56 * Assumes that the first 4095 bytes of /proc/pid/stat contains
57 * the comm, tgid and ppid.
59 static int perf_event__get_comm_ids(pid_t pid, char *comm, size_t len,
60 pid_t *tgid, pid_t *ppid)
62 char filename[PATH_MAX];
66 char *nl, *name, *tgids, *ppids;
71 snprintf(filename, sizeof(filename), "/proc/%d/status", pid);
73 fd = open(filename, O_RDONLY);
75 pr_debug("couldn't open %s\n", filename);
79 n = read(fd, bf, sizeof(bf) - 1);
82 pr_warning("Couldn't get COMM, tigd and ppid for pid %d\n",
88 name = strstr(bf, "Name:");
89 tgids = strstr(bf, "Tgid:");
90 ppids = strstr(bf, "PPid:");
93 name += 5; /* strlen("Name:") */
95 while (*name && isspace(*name))
98 nl = strchr(name, '\n');
105 memcpy(comm, name, size);
108 pr_debug("Name: string not found for pid %d\n", pid);
112 tgids += 5; /* strlen("Tgid:") */
115 pr_debug("Tgid: string not found for pid %d\n", pid);
119 ppids += 5; /* strlen("PPid:") */
122 pr_debug("PPid: string not found for pid %d\n", pid);
128 static int perf_event__prepare_comm(union perf_event *event, pid_t pid,
129 struct machine *machine,
130 pid_t *tgid, pid_t *ppid)
136 memset(&event->comm, 0, sizeof(event->comm));
138 if (machine__is_host(machine)) {
139 if (perf_event__get_comm_ids(pid, event->comm.comm,
140 sizeof(event->comm.comm),
145 *tgid = machine->pid;
151 event->comm.pid = *tgid;
152 event->comm.header.type = PERF_RECORD_COMM;
154 size = strlen(event->comm.comm) + 1;
155 size = PERF_ALIGN(size, sizeof(u64));
156 memset(event->comm.comm + size, 0, machine->id_hdr_size);
157 event->comm.header.size = (sizeof(event->comm) -
158 (sizeof(event->comm.comm) - size) +
159 machine->id_hdr_size);
160 event->comm.tid = pid;
165 static pid_t perf_event__synthesize_comm(struct perf_tool *tool,
166 union perf_event *event, pid_t pid,
167 perf_event__handler_t process,
168 struct machine *machine)
172 if (perf_event__prepare_comm(event, pid, machine, &tgid, &ppid) != 0)
175 if (process(tool, event, &synth_sample, machine) != 0)
181 static int perf_event__synthesize_fork(struct perf_tool *tool,
182 union perf_event *event,
183 pid_t pid, pid_t tgid, pid_t ppid,
184 perf_event__handler_t process,
185 struct machine *machine)
187 memset(&event->fork, 0, sizeof(event->fork) + machine->id_hdr_size);
190 * for main thread set parent to ppid from status file. For other
191 * threads set parent pid to main thread. ie., assume main thread
192 * spawns all threads in a process
195 event->fork.ppid = ppid;
196 event->fork.ptid = ppid;
198 event->fork.ppid = tgid;
199 event->fork.ptid = tgid;
201 event->fork.pid = tgid;
202 event->fork.tid = pid;
203 event->fork.header.type = PERF_RECORD_FORK;
205 event->fork.header.size = (sizeof(event->fork) + machine->id_hdr_size);
207 if (process(tool, event, &synth_sample, machine) != 0)
213 int perf_event__synthesize_mmap_events(struct perf_tool *tool,
214 union perf_event *event,
215 pid_t pid, pid_t tgid,
216 perf_event__handler_t process,
217 struct machine *machine,
220 char filename[PATH_MAX];
224 if (machine__is_default_guest(machine))
227 snprintf(filename, sizeof(filename), "%s/proc/%d/maps",
228 machine->root_dir, pid);
230 fp = fopen(filename, "r");
233 * We raced with a task exiting - just return:
235 pr_debug("couldn't open %s\n", filename);
239 event->header.type = PERF_RECORD_MMAP2;
244 char execname[PATH_MAX];
245 char anonstr[] = "//anon";
250 if (fgets(bf, sizeof(bf), fp) == NULL)
253 /* ensure null termination since stack will be reused. */
254 strcpy(execname, "");
256 /* 00400000-0040c000 r-xp 00000000 fd:01 41038 /bin/cat */
257 n = sscanf(bf, "%"PRIx64"-%"PRIx64" %s %"PRIx64" %x:%x %u %s\n",
258 &event->mmap2.start, &event->mmap2.len, prot,
259 &event->mmap2.pgoff, &event->mmap2.maj,
264 * Anon maps don't have the execname.
269 event->mmap2.ino = (u64)ino;
272 * Just like the kernel, see __perf_event_mmap in kernel/perf_event.c
274 if (machine__is_host(machine))
275 event->header.misc = PERF_RECORD_MISC_USER;
277 event->header.misc = PERF_RECORD_MISC_GUEST_USER;
279 /* map protection and flags bits */
280 event->mmap2.prot = 0;
281 event->mmap2.flags = 0;
283 event->mmap2.prot |= PROT_READ;
285 event->mmap2.prot |= PROT_WRITE;
287 event->mmap2.prot |= PROT_EXEC;
290 event->mmap2.flags |= MAP_SHARED;
292 event->mmap2.flags |= MAP_PRIVATE;
294 if (prot[2] != 'x') {
295 if (!mmap_data || prot[0] != 'r')
298 event->header.misc |= PERF_RECORD_MISC_MMAP_DATA;
301 if (!strcmp(execname, ""))
302 strcpy(execname, anonstr);
304 size = strlen(execname) + 1;
305 memcpy(event->mmap2.filename, execname, size);
306 size = PERF_ALIGN(size, sizeof(u64));
307 event->mmap2.len -= event->mmap.start;
308 event->mmap2.header.size = (sizeof(event->mmap2) -
309 (sizeof(event->mmap2.filename) - size));
310 memset(event->mmap2.filename + size, 0, machine->id_hdr_size);
311 event->mmap2.header.size += machine->id_hdr_size;
312 event->mmap2.pid = tgid;
313 event->mmap2.tid = pid;
315 if (process(tool, event, &synth_sample, machine) != 0) {
325 int perf_event__synthesize_modules(struct perf_tool *tool,
326 perf_event__handler_t process,
327 struct machine *machine)
331 struct map_groups *kmaps = &machine->kmaps;
332 union perf_event *event = zalloc((sizeof(event->mmap) +
333 machine->id_hdr_size));
335 pr_debug("Not enough memory synthesizing mmap event "
336 "for kernel modules\n");
340 event->header.type = PERF_RECORD_MMAP;
343 * kernel uses 0 for user space maps, see kernel/perf_event.c
346 if (machine__is_host(machine))
347 event->header.misc = PERF_RECORD_MISC_KERNEL;
349 event->header.misc = PERF_RECORD_MISC_GUEST_KERNEL;
351 for (nd = rb_first(&kmaps->maps[MAP__FUNCTION]);
352 nd; nd = rb_next(nd)) {
354 struct map *pos = rb_entry(nd, struct map, rb_node);
356 if (pos->dso->kernel)
359 size = PERF_ALIGN(pos->dso->long_name_len + 1, sizeof(u64));
360 event->mmap.header.type = PERF_RECORD_MMAP;
361 event->mmap.header.size = (sizeof(event->mmap) -
362 (sizeof(event->mmap.filename) - size));
363 memset(event->mmap.filename + size, 0, machine->id_hdr_size);
364 event->mmap.header.size += machine->id_hdr_size;
365 event->mmap.start = pos->start;
366 event->mmap.len = pos->end - pos->start;
367 event->mmap.pid = machine->pid;
369 memcpy(event->mmap.filename, pos->dso->long_name,
370 pos->dso->long_name_len + 1);
371 if (process(tool, event, &synth_sample, machine) != 0) {
381 static int __event__synthesize_thread(union perf_event *comm_event,
382 union perf_event *mmap_event,
383 union perf_event *fork_event,
385 perf_event__handler_t process,
386 struct perf_tool *tool,
387 struct machine *machine, bool mmap_data)
389 char filename[PATH_MAX];
391 struct dirent dirent, *next;
395 /* special case: only send one comm event using passed in pid */
397 tgid = perf_event__synthesize_comm(tool, comm_event, pid,
403 return perf_event__synthesize_mmap_events(tool, mmap_event, pid, tgid,
404 process, machine, mmap_data);
407 if (machine__is_default_guest(machine))
410 snprintf(filename, sizeof(filename), "%s/proc/%d/task",
411 machine->root_dir, pid);
413 tasks = opendir(filename);
415 pr_debug("couldn't open %s\n", filename);
419 while (!readdir_r(tasks, &dirent, &next) && next) {
423 _pid = strtol(dirent.d_name, &end, 10);
428 if (perf_event__prepare_comm(comm_event, _pid, machine,
432 if (perf_event__synthesize_fork(tool, fork_event, _pid, tgid,
433 ppid, process, machine) < 0)
436 * Send the prepared comm event
438 if (process(tool, comm_event, &synth_sample, machine) != 0)
443 /* process the parent's maps too */
444 rc = perf_event__synthesize_mmap_events(tool, mmap_event, pid, tgid,
445 process, machine, mmap_data);
455 int perf_event__synthesize_thread_map(struct perf_tool *tool,
456 struct thread_map *threads,
457 perf_event__handler_t process,
458 struct machine *machine,
461 union perf_event *comm_event, *mmap_event, *fork_event;
462 int err = -1, thread, j;
464 comm_event = malloc(sizeof(comm_event->comm) + machine->id_hdr_size);
465 if (comm_event == NULL)
468 mmap_event = malloc(sizeof(mmap_event->mmap) + machine->id_hdr_size);
469 if (mmap_event == NULL)
472 fork_event = malloc(sizeof(fork_event->fork) + machine->id_hdr_size);
473 if (fork_event == NULL)
477 for (thread = 0; thread < threads->nr; ++thread) {
478 if (__event__synthesize_thread(comm_event, mmap_event,
480 threads->map[thread], 0,
481 process, tool, machine,
488 * comm.pid is set to thread group id by
489 * perf_event__synthesize_comm
491 if ((int) comm_event->comm.pid != threads->map[thread]) {
492 bool need_leader = true;
494 /* is thread group leader in thread_map? */
495 for (j = 0; j < threads->nr; ++j) {
496 if ((int) comm_event->comm.pid == threads->map[j]) {
502 /* if not, generate events for it */
504 __event__synthesize_thread(comm_event, mmap_event,
506 comm_event->comm.pid, 0,
507 process, tool, machine,
523 int perf_event__synthesize_threads(struct perf_tool *tool,
524 perf_event__handler_t process,
525 struct machine *machine, bool mmap_data)
528 char proc_path[PATH_MAX];
529 struct dirent dirent, *next;
530 union perf_event *comm_event, *mmap_event, *fork_event;
533 if (machine__is_default_guest(machine))
536 comm_event = malloc(sizeof(comm_event->comm) + machine->id_hdr_size);
537 if (comm_event == NULL)
540 mmap_event = malloc(sizeof(mmap_event->mmap) + machine->id_hdr_size);
541 if (mmap_event == NULL)
544 fork_event = malloc(sizeof(fork_event->fork) + machine->id_hdr_size);
545 if (fork_event == NULL)
548 snprintf(proc_path, sizeof(proc_path), "%s/proc", machine->root_dir);
549 proc = opendir(proc_path);
554 while (!readdir_r(proc, &dirent, &next) && next) {
556 pid_t pid = strtol(dirent.d_name, &end, 10);
558 if (*end) /* only interested in proper numerical dirents */
561 * We may race with exiting thread, so don't stop just because
562 * one thread couldn't be synthesized.
564 __event__synthesize_thread(comm_event, mmap_event, fork_event, pid,
565 1, process, tool, machine, mmap_data);
580 struct process_symbol_args {
585 static int find_symbol_cb(void *arg, const char *name, char type,
588 struct process_symbol_args *args = arg;
591 * Must be a function or at least an alias, as in PARISC64, where "_text" is
592 * an 'A' to the same address as "_stext".
594 if (!(symbol_type__is_a(type, MAP__FUNCTION) ||
595 type == 'A') || strcmp(name, args->name))
602 u64 kallsyms__get_function_start(const char *kallsyms_filename,
603 const char *symbol_name)
605 struct process_symbol_args args = { .name = symbol_name, };
607 if (kallsyms__parse(kallsyms_filename, &args, find_symbol_cb) <= 0)
613 int perf_event__synthesize_kernel_mmap(struct perf_tool *tool,
614 perf_event__handler_t process,
615 struct machine *machine)
618 const char *mmap_name;
619 char name_buff[PATH_MAX];
623 union perf_event *event;
625 if (machine->vmlinux_maps[0] == NULL)
629 * We should get this from /sys/kernel/sections/.text, but till that is
630 * available use this, and after it is use this as a fallback for older
633 event = zalloc((sizeof(event->mmap) + machine->id_hdr_size));
635 pr_debug("Not enough memory synthesizing mmap event "
636 "for kernel modules\n");
640 mmap_name = machine__mmap_name(machine, name_buff, sizeof(name_buff));
641 if (machine__is_host(machine)) {
643 * kernel uses PERF_RECORD_MISC_USER for user space maps,
644 * see kernel/perf_event.c __perf_event_mmap
646 event->header.misc = PERF_RECORD_MISC_KERNEL;
648 event->header.misc = PERF_RECORD_MISC_GUEST_KERNEL;
651 map = machine->vmlinux_maps[MAP__FUNCTION];
652 kmap = map__kmap(map);
653 size = snprintf(event->mmap.filename, sizeof(event->mmap.filename),
654 "%s%s", mmap_name, kmap->ref_reloc_sym->name) + 1;
655 size = PERF_ALIGN(size, sizeof(u64));
656 event->mmap.header.type = PERF_RECORD_MMAP;
657 event->mmap.header.size = (sizeof(event->mmap) -
658 (sizeof(event->mmap.filename) - size) + machine->id_hdr_size);
659 event->mmap.pgoff = kmap->ref_reloc_sym->addr;
660 event->mmap.start = map->start;
661 event->mmap.len = map->end - event->mmap.start;
662 event->mmap.pid = machine->pid;
664 err = process(tool, event, &synth_sample, machine);
670 size_t perf_event__fprintf_comm(union perf_event *event, FILE *fp)
674 if (event->header.misc & PERF_RECORD_MISC_COMM_EXEC)
679 return fprintf(fp, "%s: %s:%d/%d\n", s, event->comm.comm, event->comm.pid, event->comm.tid);
682 int perf_event__process_comm(struct perf_tool *tool __maybe_unused,
683 union perf_event *event,
684 struct perf_sample *sample,
685 struct machine *machine)
687 return machine__process_comm_event(machine, event, sample);
690 int perf_event__process_lost(struct perf_tool *tool __maybe_unused,
691 union perf_event *event,
692 struct perf_sample *sample,
693 struct machine *machine)
695 return machine__process_lost_event(machine, event, sample);
698 size_t perf_event__fprintf_mmap(union perf_event *event, FILE *fp)
700 return fprintf(fp, " %d/%d: [%#" PRIx64 "(%#" PRIx64 ") @ %#" PRIx64 "]: %c %s\n",
701 event->mmap.pid, event->mmap.tid, event->mmap.start,
702 event->mmap.len, event->mmap.pgoff,
703 (event->header.misc & PERF_RECORD_MISC_MMAP_DATA) ? 'r' : 'x',
704 event->mmap.filename);
707 size_t perf_event__fprintf_mmap2(union perf_event *event, FILE *fp)
709 return fprintf(fp, " %d/%d: [%#" PRIx64 "(%#" PRIx64 ") @ %#" PRIx64
710 " %02x:%02x %"PRIu64" %"PRIu64"]: %c%c%c%c %s\n",
711 event->mmap2.pid, event->mmap2.tid, event->mmap2.start,
712 event->mmap2.len, event->mmap2.pgoff, event->mmap2.maj,
713 event->mmap2.min, event->mmap2.ino,
714 event->mmap2.ino_generation,
715 (event->mmap2.prot & PROT_READ) ? 'r' : '-',
716 (event->mmap2.prot & PROT_WRITE) ? 'w' : '-',
717 (event->mmap2.prot & PROT_EXEC) ? 'x' : '-',
718 (event->mmap2.flags & MAP_SHARED) ? 's' : 'p',
719 event->mmap2.filename);
722 int perf_event__process_mmap(struct perf_tool *tool __maybe_unused,
723 union perf_event *event,
724 struct perf_sample *sample,
725 struct machine *machine)
727 return machine__process_mmap_event(machine, event, sample);
730 int perf_event__process_mmap2(struct perf_tool *tool __maybe_unused,
731 union perf_event *event,
732 struct perf_sample *sample,
733 struct machine *machine)
735 return machine__process_mmap2_event(machine, event, sample);
738 size_t perf_event__fprintf_task(union perf_event *event, FILE *fp)
740 return fprintf(fp, "(%d:%d):(%d:%d)\n",
741 event->fork.pid, event->fork.tid,
742 event->fork.ppid, event->fork.ptid);
745 int perf_event__process_fork(struct perf_tool *tool __maybe_unused,
746 union perf_event *event,
747 struct perf_sample *sample,
748 struct machine *machine)
750 return machine__process_fork_event(machine, event, sample);
753 int perf_event__process_exit(struct perf_tool *tool __maybe_unused,
754 union perf_event *event,
755 struct perf_sample *sample,
756 struct machine *machine)
758 return machine__process_exit_event(machine, event, sample);
761 size_t perf_event__fprintf(union perf_event *event, FILE *fp)
763 size_t ret = fprintf(fp, "PERF_RECORD_%s",
764 perf_event__name(event->header.type));
766 switch (event->header.type) {
767 case PERF_RECORD_COMM:
768 ret += perf_event__fprintf_comm(event, fp);
770 case PERF_RECORD_FORK:
771 case PERF_RECORD_EXIT:
772 ret += perf_event__fprintf_task(event, fp);
774 case PERF_RECORD_MMAP:
775 ret += perf_event__fprintf_mmap(event, fp);
777 case PERF_RECORD_MMAP2:
778 ret += perf_event__fprintf_mmap2(event, fp);
781 ret += fprintf(fp, "\n");
787 int perf_event__process(struct perf_tool *tool __maybe_unused,
788 union perf_event *event,
789 struct perf_sample *sample,
790 struct machine *machine)
792 return machine__process_event(machine, event, sample);
795 void thread__find_addr_map(struct thread *thread, u8 cpumode,
796 enum map_type type, u64 addr,
797 struct addr_location *al)
799 struct map_groups *mg = thread->mg;
800 struct machine *machine = mg->machine;
801 bool load_map = false;
803 al->machine = machine;
806 al->cpumode = cpumode;
809 if (machine == NULL) {
814 if (cpumode == PERF_RECORD_MISC_KERNEL && perf_host) {
816 mg = &machine->kmaps;
818 } else if (cpumode == PERF_RECORD_MISC_USER && perf_host) {
820 } else if (cpumode == PERF_RECORD_MISC_GUEST_KERNEL && perf_guest) {
822 mg = &machine->kmaps;
824 } else if (cpumode == PERF_RECORD_MISC_GUEST_USER && perf_guest) {
830 if ((cpumode == PERF_RECORD_MISC_GUEST_USER ||
831 cpumode == PERF_RECORD_MISC_GUEST_KERNEL) &&
833 al->filtered |= (1 << HIST_FILTER__GUEST);
834 if ((cpumode == PERF_RECORD_MISC_USER ||
835 cpumode == PERF_RECORD_MISC_KERNEL) &&
837 al->filtered |= (1 << HIST_FILTER__HOST);
842 al->map = map_groups__find(mg, type, al->addr);
843 if (al->map == NULL) {
845 * If this is outside of all known maps, and is a negative
846 * address, try to look it up in the kernel dso, as it might be
847 * a vsyscall or vdso (which executes in user-mode).
849 * XXX This is nasty, we should have a symbol list in the
850 * "[vdso]" dso, but for now lets use the old trick of looking
851 * in the whole kernel symbol list.
853 if (cpumode == PERF_RECORD_MISC_USER && machine &&
854 mg != &machine->kmaps &&
855 machine__kernel_ip(machine, al->addr)) {
856 mg = &machine->kmaps;
862 * Kernel maps might be changed when loading symbols so loading
863 * must be done prior to using kernel maps.
866 map__load(al->map, machine->symbol_filter);
867 al->addr = al->map->map_ip(al->map, al->addr);
871 void thread__find_addr_location(struct thread *thread,
872 u8 cpumode, enum map_type type, u64 addr,
873 struct addr_location *al)
875 thread__find_addr_map(thread, cpumode, type, addr, al);
877 al->sym = map__find_symbol(al->map, al->addr,
878 thread->mg->machine->symbol_filter);
883 int perf_event__preprocess_sample(const union perf_event *event,
884 struct machine *machine,
885 struct addr_location *al,
886 struct perf_sample *sample)
888 u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
889 struct thread *thread = machine__findnew_thread(machine, sample->pid,
895 dump_printf(" ... thread: %s:%d\n", thread__comm_str(thread), thread->tid);
897 * Have we already created the kernel maps for this machine?
899 * This should have happened earlier, when we processed the kernel MMAP
900 * events, but for older perf.data files there was no such thing, so do
903 if (cpumode == PERF_RECORD_MISC_KERNEL &&
904 machine->vmlinux_maps[MAP__FUNCTION] == NULL)
905 machine__create_kernel_maps(machine);
907 thread__find_addr_map(thread, cpumode, MAP__FUNCTION, sample->ip, al);
908 dump_printf(" ...... dso: %s\n",
909 al->map ? al->map->dso->long_name :
910 al->level == 'H' ? "[hypervisor]" : "<not found>");
912 if (thread__is_filtered(thread))
913 al->filtered |= (1 << HIST_FILTER__THREAD);
916 al->cpu = sample->cpu;
919 struct dso *dso = al->map->dso;
921 if (symbol_conf.dso_list &&
922 (!dso || !(strlist__has_entry(symbol_conf.dso_list,
924 (dso->short_name != dso->long_name &&
925 strlist__has_entry(symbol_conf.dso_list,
926 dso->long_name))))) {
927 al->filtered |= (1 << HIST_FILTER__DSO);
930 al->sym = map__find_symbol(al->map, al->addr,
931 machine->symbol_filter);
934 if (symbol_conf.sym_list &&
935 (!al->sym || !strlist__has_entry(symbol_conf.sym_list,
937 al->filtered |= (1 << HIST_FILTER__SYMBOL);
943 bool is_bts_event(struct perf_event_attr *attr)
945 return attr->type == PERF_TYPE_HARDWARE &&
946 (attr->config & PERF_COUNT_HW_BRANCH_INSTRUCTIONS) &&
947 attr->sample_period == 1;
950 bool sample_addr_correlates_sym(struct perf_event_attr *attr)
952 if (attr->type == PERF_TYPE_SOFTWARE &&
953 (attr->config == PERF_COUNT_SW_PAGE_FAULTS ||
954 attr->config == PERF_COUNT_SW_PAGE_FAULTS_MIN ||
955 attr->config == PERF_COUNT_SW_PAGE_FAULTS_MAJ))
958 if (is_bts_event(attr))
964 void perf_event__preprocess_sample_addr(union perf_event *event,
965 struct perf_sample *sample,
966 struct thread *thread,
967 struct addr_location *al)
969 u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
971 thread__find_addr_map(thread, cpumode, MAP__FUNCTION, sample->addr, al);
973 thread__find_addr_map(thread, cpumode, MAP__VARIABLE,
976 al->cpu = sample->cpu;
980 al->sym = map__find_symbol(al->map, al->addr, NULL);