Lines Matching +full:event +full:-
15 #include "event.h"
24 #include "time-utils.h"
33 #include "bpf-event.h"
106 type == 'A') || strcmp(name, args->name)) in find_func_symbol_cb()
109 args->start = start; in find_func_symbol_cb()
118 if (strcmp(name, args->name)) in find_any_symbol_cb()
121 args->start = start; in find_any_symbol_cb()
131 return -1; in kallsyms__get_function_start()
143 return -1; in kallsyms__get_symbol_start()
150 struct perf_record_stat_config *event) in perf_event__read_stat_config() argument
154 for (i = 0; i < event->nr; i++) { in perf_event__read_stat_config()
156 switch (event->data[i].tag) { in perf_event__read_stat_config()
159 config->__val = event->data[i].val; \ in perf_event__read_stat_config()
169 event->data[i].tag); in perf_event__read_stat_config()
174 size_t perf_event__fprintf_comm(union perf_event *event, FILE *fp) in perf_event__fprintf_comm() argument
178 if (event->header.misc & PERF_RECORD_MISC_COMM_EXEC) in perf_event__fprintf_comm()
183 return fprintf(fp, "%s: %s:%d/%d\n", s, event->comm.comm, event->comm.pid, event->comm.tid); in perf_event__fprintf_comm()
186 size_t perf_event__fprintf_namespaces(union perf_event *event, FILE *fp) in perf_event__fprintf_namespaces() argument
192 ns_link_info = event->namespaces.link_info; in perf_event__fprintf_namespaces()
193 nr_namespaces = event->namespaces.nr_namespaces; in perf_event__fprintf_namespaces()
195 ret += fprintf(fp, " %d/%d - nr_namespaces: %u\n\t\t[", in perf_event__fprintf_namespaces()
196 event->namespaces.pid, in perf_event__fprintf_namespaces()
197 event->namespaces.tid, in perf_event__fprintf_namespaces()
213 size_t perf_event__fprintf_cgroup(union perf_event *event, FILE *fp) in perf_event__fprintf_cgroup() argument
216 event->cgroup.id, event->cgroup.path); in perf_event__fprintf_cgroup()
220 union perf_event *event, in perf_event__process_comm() argument
224 return machine__process_comm_event(machine, event, sample); in perf_event__process_comm()
228 union perf_event *event, in perf_event__process_namespaces() argument
232 return machine__process_namespaces_event(machine, event, sample); in perf_event__process_namespaces()
236 union perf_event *event, in perf_event__process_cgroup() argument
240 return machine__process_cgroup_event(machine, event, sample); in perf_event__process_cgroup()
244 union perf_event *event, in perf_event__process_lost() argument
248 return machine__process_lost_event(machine, event, sample); in perf_event__process_lost()
252 union perf_event *event, in perf_event__process_aux() argument
256 return machine__process_aux_event(machine, event); in perf_event__process_aux()
260 union perf_event *event, in perf_event__process_itrace_start() argument
264 return machine__process_itrace_start_event(machine, event); in perf_event__process_itrace_start()
268 union perf_event *event, in perf_event__process_aux_output_hw_id() argument
272 return machine__process_aux_output_hw_id_event(machine, event); in perf_event__process_aux_output_hw_id()
276 union perf_event *event, in perf_event__process_lost_samples() argument
280 return machine__process_lost_samples_event(machine, event, sample); in perf_event__process_lost_samples()
284 union perf_event *event, in perf_event__process_switch() argument
288 return machine__process_switch_event(machine, event); in perf_event__process_switch()
292 union perf_event *event, in perf_event__process_ksymbol() argument
296 return machine__process_ksymbol(machine, event, sample); in perf_event__process_ksymbol()
300 union perf_event *event, in perf_event__process_bpf() argument
304 return machine__process_bpf(machine, event, sample); in perf_event__process_bpf()
308 union perf_event *event, in perf_event__process_text_poke() argument
312 return machine__process_text_poke(machine, event, sample); in perf_event__process_text_poke()
315 size_t perf_event__fprintf_mmap(union perf_event *event, FILE *fp) in perf_event__fprintf_mmap() argument
318 event->mmap.pid, event->mmap.tid, event->mmap.start, in perf_event__fprintf_mmap()
319 event->mmap.len, event->mmap.pgoff, in perf_event__fprintf_mmap()
320 (event->header.misc & PERF_RECORD_MISC_MMAP_DATA) ? 'r' : 'x', in perf_event__fprintf_mmap()
321 event->mmap.filename); in perf_event__fprintf_mmap()
324 size_t perf_event__fprintf_mmap2(union perf_event *event, FILE *fp) in perf_event__fprintf_mmap2() argument
326 if (event->header.misc & PERF_RECORD_MISC_MMAP_BUILD_ID) { in perf_event__fprintf_mmap2()
330 build_id__init(&bid, event->mmap2.build_id, in perf_event__fprintf_mmap2()
331 event->mmap2.build_id_size); in perf_event__fprintf_mmap2()
336 event->mmap2.pid, event->mmap2.tid, event->mmap2.start, in perf_event__fprintf_mmap2()
337 event->mmap2.len, event->mmap2.pgoff, sbuild_id, in perf_event__fprintf_mmap2()
338 (event->mmap2.prot & PROT_READ) ? 'r' : '-', in perf_event__fprintf_mmap2()
339 (event->mmap2.prot & PROT_WRITE) ? 'w' : '-', in perf_event__fprintf_mmap2()
340 (event->mmap2.prot & PROT_EXEC) ? 'x' : '-', in perf_event__fprintf_mmap2()
341 (event->mmap2.flags & MAP_SHARED) ? 's' : 'p', in perf_event__fprintf_mmap2()
342 event->mmap2.filename); in perf_event__fprintf_mmap2()
346 event->mmap2.pid, event->mmap2.tid, event->mmap2.start, in perf_event__fprintf_mmap2()
347 event->mmap2.len, event->mmap2.pgoff, event->mmap2.maj, in perf_event__fprintf_mmap2()
348 event->mmap2.min, event->mmap2.ino, in perf_event__fprintf_mmap2()
349 event->mmap2.ino_generation, in perf_event__fprintf_mmap2()
350 (event->mmap2.prot & PROT_READ) ? 'r' : '-', in perf_event__fprintf_mmap2()
351 (event->mmap2.prot & PROT_WRITE) ? 'w' : '-', in perf_event__fprintf_mmap2()
352 (event->mmap2.prot & PROT_EXEC) ? 'x' : '-', in perf_event__fprintf_mmap2()
353 (event->mmap2.flags & MAP_SHARED) ? 's' : 'p', in perf_event__fprintf_mmap2()
354 event->mmap2.filename); in perf_event__fprintf_mmap2()
358 size_t perf_event__fprintf_thread_map(union perf_event *event, FILE *fp) in perf_event__fprintf_thread_map() argument
360 struct perf_thread_map *threads = thread_map__new_event(&event->thread_map); in perf_event__fprintf_thread_map()
368 ret += fprintf(fp, "failed to get threads from event\n"); in perf_event__fprintf_thread_map()
374 size_t perf_event__fprintf_cpu_map(union perf_event *event, FILE *fp) in perf_event__fprintf_cpu_map() argument
376 struct perf_cpu_map *cpus = cpu_map__new_data(&event->cpu_map.data); in perf_event__fprintf_cpu_map()
384 ret += fprintf(fp, "failed to get cpumap from event\n"); in perf_event__fprintf_cpu_map()
391 union perf_event *event, in perf_event__process_mmap() argument
395 return machine__process_mmap_event(machine, event, sample); in perf_event__process_mmap()
399 union perf_event *event, in perf_event__process_mmap2() argument
403 return machine__process_mmap2_event(machine, event, sample); in perf_event__process_mmap2()
406 size_t perf_event__fprintf_task(union perf_event *event, FILE *fp) in perf_event__fprintf_task() argument
409 event->fork.pid, event->fork.tid, in perf_event__fprintf_task()
410 event->fork.ppid, event->fork.ptid); in perf_event__fprintf_task()
414 union perf_event *event, in perf_event__process_fork() argument
418 return machine__process_fork_event(machine, event, sample); in perf_event__process_fork()
422 union perf_event *event, in perf_event__process_exit() argument
426 return machine__process_exit_event(machine, event, sample); in perf_event__process_exit()
430 union perf_event *event, in perf_event__exit_del_thread() argument
435 event->fork.pid, in perf_event__exit_del_thread()
436 event->fork.tid); in perf_event__exit_del_thread()
438 dump_printf("(%d:%d):(%d:%d)\n", event->fork.pid, event->fork.tid, in perf_event__exit_del_thread()
439 event->fork.ppid, event->fork.ptid); in perf_event__exit_del_thread()
449 size_t perf_event__fprintf_aux(union perf_event *event, FILE *fp) in perf_event__fprintf_aux() argument
452 event->aux.aux_offset, event->aux.aux_size, in perf_event__fprintf_aux()
453 event->aux.flags, in perf_event__fprintf_aux()
454 event->aux.flags & PERF_AUX_FLAG_TRUNCATED ? "T" : "", in perf_event__fprintf_aux()
455 event->aux.flags & PERF_AUX_FLAG_OVERWRITE ? "O" : "", in perf_event__fprintf_aux()
456 event->aux.flags & PERF_AUX_FLAG_PARTIAL ? "P" : ""); in perf_event__fprintf_aux()
459 size_t perf_event__fprintf_itrace_start(union perf_event *event, FILE *fp) in perf_event__fprintf_itrace_start() argument
462 event->itrace_start.pid, event->itrace_start.tid); in perf_event__fprintf_itrace_start()
465 size_t perf_event__fprintf_aux_output_hw_id(union perf_event *event, FILE *fp) in perf_event__fprintf_aux_output_hw_id() argument
468 event->aux_output_hw_id.hw_id); in perf_event__fprintf_aux_output_hw_id()
471 size_t perf_event__fprintf_switch(union perf_event *event, FILE *fp) in perf_event__fprintf_switch() argument
473 bool out = event->header.misc & PERF_RECORD_MISC_SWITCH_OUT; in perf_event__fprintf_switch()
475 !(event->header.misc & PERF_RECORD_MISC_SWITCH_OUT_PREEMPT) ? in perf_event__fprintf_switch()
478 if (event->header.type == PERF_RECORD_SWITCH) in perf_event__fprintf_switch()
481 return fprintf(fp, " %s %s pid/tid: %5d/%-5d\n", in perf_event__fprintf_switch()
483 event->context_switch.next_prev_pid, in perf_event__fprintf_switch()
484 event->context_switch.next_prev_tid); in perf_event__fprintf_switch()
487 static size_t perf_event__fprintf_lost(union perf_event *event, FILE *fp) in perf_event__fprintf_lost() argument
489 return fprintf(fp, " lost %" PRI_lu64 "\n", event->lost.lost); in perf_event__fprintf_lost()
492 size_t perf_event__fprintf_ksymbol(union perf_event *event, FILE *fp) in perf_event__fprintf_ksymbol() argument
495 event->ksymbol.addr, event->ksymbol.len, in perf_event__fprintf_ksymbol()
496 event->ksymbol.ksym_type, in perf_event__fprintf_ksymbol()
497 event->ksymbol.flags, event->ksymbol.name); in perf_event__fprintf_ksymbol()
500 size_t perf_event__fprintf_bpf(union perf_event *event, FILE *fp) in perf_event__fprintf_bpf() argument
503 event->bpf.type, event->bpf.flags, event->bpf.id); in perf_event__fprintf_bpf()
523 size_t perf_event__fprintf_text_poke(union perf_event *event, struct machine *machine, FILE *fp) in perf_event__fprintf_text_poke() argument
525 struct perf_record_text_poke_event *tp = &event->text_poke; in perf_event__fprintf_text_poke()
529 ret = fprintf(fp, " %" PRI_lx64 " ", tp->addr); in perf_event__fprintf_text_poke()
534 al.map = maps__find(machine__kernel_maps(machine), tp->addr); in perf_event__fprintf_text_poke()
536 al.addr = map__map_ip(al.map, tp->addr); in perf_event__fprintf_text_poke()
543 ret += fprintf(fp, " old len %u new len %u\n", tp->old_len, tp->new_len); in perf_event__fprintf_text_poke()
545 ret += binary__fprintf(tp->bytes, tp->old_len, 16, text_poke_printer, in perf_event__fprintf_text_poke()
548 ret += binary__fprintf(tp->bytes + tp->old_len, tp->new_len, 16, in perf_event__fprintf_text_poke()
553 size_t perf_event__fprintf(union perf_event *event, struct machine *machine, FILE *fp) in perf_event__fprintf() argument
556 perf_event__name(event->header.type)); in perf_event__fprintf()
558 switch (event->header.type) { in perf_event__fprintf()
560 ret += perf_event__fprintf_comm(event, fp); in perf_event__fprintf()
564 ret += perf_event__fprintf_task(event, fp); in perf_event__fprintf()
567 ret += perf_event__fprintf_mmap(event, fp); in perf_event__fprintf()
570 ret += perf_event__fprintf_namespaces(event, fp); in perf_event__fprintf()
573 ret += perf_event__fprintf_cgroup(event, fp); in perf_event__fprintf()
576 ret += perf_event__fprintf_mmap2(event, fp); in perf_event__fprintf()
579 ret += perf_event__fprintf_aux(event, fp); in perf_event__fprintf()
582 ret += perf_event__fprintf_itrace_start(event, fp); in perf_event__fprintf()
586 ret += perf_event__fprintf_switch(event, fp); in perf_event__fprintf()
589 ret += perf_event__fprintf_lost(event, fp); in perf_event__fprintf()
592 ret += perf_event__fprintf_ksymbol(event, fp); in perf_event__fprintf()
595 ret += perf_event__fprintf_bpf(event, fp); in perf_event__fprintf()
598 ret += perf_event__fprintf_text_poke(event, machine, fp); in perf_event__fprintf()
601 ret += perf_event__fprintf_aux_output_hw_id(event, fp); in perf_event__fprintf()
611 union perf_event *event, in perf_event__process() argument
615 return machine__process_event(machine, event, sample); in perf_event__process()
625 maps__zput(al->maps); in thread__find_map()
626 map__zput(al->map); in thread__find_map()
627 thread__zput(al->thread); in thread__find_map()
628 al->thread = thread__get(thread); in thread__find_map()
630 al->addr = addr; in thread__find_map()
631 al->cpumode = cpumode; in thread__find_map()
632 al->filtered = 0; in thread__find_map()
638 al->level = 'k'; in thread__find_map()
642 al->level = '.'; in thread__find_map()
644 al->level = 'g'; in thread__find_map()
648 al->level = 'u'; in thread__find_map()
650 al->level = 'H'; in thread__find_map()
655 al->filtered |= (1 << HIST_FILTER__GUEST); in thread__find_map()
659 al->filtered |= (1 << HIST_FILTER__HOST); in thread__find_map()
663 al->maps = maps__get(maps); in thread__find_map()
664 al->map = maps__find(maps, al->addr); in thread__find_map()
665 if (al->map != NULL) { in thread__find_map()
671 map__load(al->map); in thread__find_map()
672 al->addr = map__map_ip(al->map, al->addr); in thread__find_map()
675 return al->map; in thread__find_map()
699 al->sym = NULL; in thread__find_symbol()
701 al->sym = map__find_symbol(al->map, al->addr); in thread__find_symbol()
702 return al->sym; in thread__find_symbol()
708 al->sym = NULL; in thread__find_symbol_fb()
710 al->sym = map__find_symbol(al->map, al->addr); in thread__find_symbol_fb()
711 return al->sym; in thread__find_symbol_fb()
720 if (addr >= pos->i && addr < pos->i + addr_range) in check_address_range()
728 * Callers need to drop the reference to al->thread, obtained in
738 thread = machine__findnew_guest_code(machine, sample->pid); in machine__resolve()
740 thread = machine__findnew_thread(machine, sample->pid, sample->tid); in machine__resolve()
742 return -1; in machine__resolve()
745 thread__find_map(thread, sample->cpumode, sample->ip, al); in machine__resolve()
746 dso = al->map ? map__dso(al->map) : NULL; in machine__resolve()
750 : (al->level == 'H' ? "[hypervisor]" : "<not found>")); in machine__resolve()
753 al->filtered |= (1 << HIST_FILTER__THREAD); in machine__resolve()
758 al->sym = NULL; in machine__resolve()
759 al->cpu = sample->cpu; in machine__resolve()
760 al->socket = -1; in machine__resolve()
761 al->srcline = NULL; in machine__resolve()
763 if (al->cpu >= 0) { in machine__resolve()
764 struct perf_env *env = machine->env; in machine__resolve()
766 if (env && env->cpu) in machine__resolve()
767 al->socket = env->cpu[al->cpu].socket_id; in machine__resolve()
770 if (al->map) { in machine__resolve()
777 al->filtered |= (1 << HIST_FILTER__DSO); in machine__resolve()
780 al->sym = map__find_symbol(al->map, al->addr); in machine__resolve()
782 al->filtered |= (1 << HIST_FILTER__DSO); in machine__resolve()
790 if (al->sym) { in machine__resolve()
792 al->sym->name); in machine__resolve()
794 if (!ret && al->sym) { in machine__resolve()
796 map__unmap_ip(al->map, al->sym->start)); in machine__resolve()
800 if (!ret && symbol_conf.addr_list && al->map) { in machine__resolve()
801 unsigned long addr = map__unmap_ip(al->map, al->addr); in machine__resolve()
812 al->filtered |= (1 << HIST_FILTER__SYMBOL); in machine__resolve()
820 return attr->type == PERF_TYPE_HARDWARE && in is_bts_event()
821 (attr->config & PERF_COUNT_HW_BRANCH_INSTRUCTIONS) && in is_bts_event()
822 attr->sample_period == 1; in is_bts_event()
827 if (attr->type == PERF_TYPE_SOFTWARE && in sample_addr_correlates_sym()
828 (attr->config == PERF_COUNT_SW_PAGE_FAULTS || in sample_addr_correlates_sym()
829 attr->config == PERF_COUNT_SW_PAGE_FAULTS_MIN || in sample_addr_correlates_sym()
830 attr->config == PERF_COUNT_SW_PAGE_FAULTS_MAJ)) in sample_addr_correlates_sym()
842 thread__find_map_fb(thread, sample->cpumode, sample->addr, al); in thread__resolve()
844 al->cpu = sample->cpu; in thread__resolve()
845 al->sym = NULL; in thread__resolve()
847 if (al->map) in thread__resolve()
848 al->sym = map__find_symbol(al->map, al->addr); in thread__resolve()