Lines Matching full:sample

452 		pr_err("Display of symbols requested but neither sample IP nor "  in evsel__check_attr()
453 "sample address\navailable. Hence, no addresses to convert " in evsel__check_attr()
468 pr_err("Display of source line number requested but sample IP is not\n" in evsel__check_attr()
678 static int perf_sample__fprintf_iregs(struct perf_sample *sample, in perf_sample__fprintf_iregs() argument
681 return perf_sample__fprintf_regs(&sample->intr_regs, in perf_sample__fprintf_iregs()
685 static int perf_sample__fprintf_uregs(struct perf_sample *sample, in perf_sample__fprintf_uregs() argument
688 return perf_sample__fprintf_regs(&sample->user_regs, in perf_sample__fprintf_uregs()
693 struct perf_sample *sample, in perf_sample__fprintf_start() argument
716 printed += fprintf(fp, "%5d/%-5d ", sample->pid, sample->tid); in perf_sample__fprintf_start()
718 printed += fprintf(fp, "%5d ", sample->pid); in perf_sample__fprintf_start()
720 printed += fprintf(fp, "%5d ", sample->tid); in perf_sample__fprintf_start()
724 printed += fprintf(fp, "%3d ", sample->cpu); in perf_sample__fprintf_start()
726 printed += fprintf(fp, "[%03d] ", sample->cpu); in perf_sample__fprintf_start()
733 (sample->misc & PERF_RECORD_MISC_##m) == PERF_RECORD_MISC_##m in perf_sample__fprintf_start()
760 if (sample->misc & PERF_RECORD_MISC_SWITCH_OUT_PREEMPT) in perf_sample__fprintf_start()
774 tod_scnprintf(script, tstr, sizeof(tstr), sample->time); in perf_sample__fprintf_start()
779 u64 t = sample->time; in perf_sample__fprintf_start()
782 initial_time = sample->time; in perf_sample__fprintf_start()
783 t = sample->time - initial_time; in perf_sample__fprintf_start()
786 t = sample->time - previous_time; in perf_sample__fprintf_start()
790 previous_time = sample->time; in perf_sample__fprintf_start()
817 static int perf_sample__fprintf_brstack(struct perf_sample *sample, in perf_sample__fprintf_brstack() argument
821 struct branch_stack *br = sample->branch_stack; in perf_sample__fprintf_brstack()
822 struct branch_entry *entries = perf_sample__branch_entries(sample); in perf_sample__fprintf_brstack()
837 thread__find_map_fb(thread, sample->cpumode, from, &alf); in perf_sample__fprintf_brstack()
838 thread__find_map_fb(thread, sample->cpumode, to, &alt); in perf_sample__fprintf_brstack()
865 static int perf_sample__fprintf_brstacksym(struct perf_sample *sample, in perf_sample__fprintf_brstacksym() argument
869 struct branch_stack *br = sample->branch_stack; in perf_sample__fprintf_brstacksym()
870 struct branch_entry *entries = perf_sample__branch_entries(sample); in perf_sample__fprintf_brstacksym()
885 thread__find_symbol_fb(thread, sample->cpumode, from, &alf); in perf_sample__fprintf_brstacksym()
886 thread__find_symbol_fb(thread, sample->cpumode, to, &alt); in perf_sample__fprintf_brstacksym()
911 static int perf_sample__fprintf_brstackoff(struct perf_sample *sample, in perf_sample__fprintf_brstackoff() argument
915 struct branch_stack *br = sample->branch_stack; in perf_sample__fprintf_brstackoff()
916 struct branch_entry *entries = perf_sample__branch_entries(sample); in perf_sample__fprintf_brstackoff()
931 if (thread__find_map_fb(thread, sample->cpumode, from, &alf) && in perf_sample__fprintf_brstackoff()
935 if (thread__find_map_fb(thread, sample->cpumode, to, &alt) && in perf_sample__fprintf_brstackoff()
1137 static int perf_sample__fprintf_brstackinsn(struct perf_sample *sample, in perf_sample__fprintf_brstackinsn() argument
1142 struct branch_stack *br = sample->branch_stack; in perf_sample__fprintf_brstackinsn()
1143 struct branch_entry *entries = perf_sample__branch_entries(sample); in perf_sample__fprintf_brstackinsn()
1159 x.cpu = sample->cpu; in perf_sample__fprintf_brstackinsn()
1225 if (entries[0].from == sample->ip) in perf_sample__fprintf_brstackinsn()
1231 * Print final block upto sample in perf_sample__fprintf_brstackinsn()
1235 * between final branch and sample. When this happens just in perf_sample__fprintf_brstackinsn()
1239 end = sample->ip; in perf_sample__fprintf_brstackinsn()
1248 len = grab_bb(buffer, sample->ip, sample->ip, in perf_sample__fprintf_brstackinsn()
1252 printed += fprintf(fp, "\t%016" PRIx64 "\t%s\n", sample->ip, in perf_sample__fprintf_brstackinsn()
1253 dump_insn(&x, sample->ip, buffer, len, NULL)); in perf_sample__fprintf_brstackinsn()
1255 print_srccode(thread, x.cpumode, sample->ip); in perf_sample__fprintf_brstackinsn()
1264 if (arch_is_branch(buffer + off, len - off, x.is64bit) && start + off != sample->ip) { in perf_sample__fprintf_brstackinsn()
1268 printed += fprintf(fp, "\t... not reaching sample ...\n"); in perf_sample__fprintf_brstackinsn()
1278 static int perf_sample__fprintf_addr(struct perf_sample *sample, in perf_sample__fprintf_addr() argument
1283 int printed = fprintf(fp, "%16" PRIx64, sample->addr); in perf_sample__fprintf_addr()
1288 thread__resolve(thread, &al, sample); in perf_sample__fprintf_addr()
1307 static const char *resolve_branch_sym(struct perf_sample *sample, in resolve_branch_sym() argument
1317 if (sample->flags & (PERF_IP_FLAG_CALL | PERF_IP_FLAG_TRACE_BEGIN)) { in resolve_branch_sym()
1319 thread__resolve(thread, &addr_al, sample); in resolve_branch_sym()
1323 *ip = sample->addr; in resolve_branch_sym()
1325 *ip = sample->addr; in resolve_branch_sym()
1327 } else if (sample->flags & (PERF_IP_FLAG_RETURN | PERF_IP_FLAG_TRACE_END)) { in resolve_branch_sym()
1331 *ip = sample->ip; in resolve_branch_sym()
1336 static int perf_sample__fprintf_callindent(struct perf_sample *sample, in perf_sample__fprintf_callindent() argument
1342 size_t depth = thread_stack__depth(thread, sample->cpu); in perf_sample__fprintf_callindent()
1353 if (thread->ts && sample->flags & PERF_IP_FLAG_RETURN) in perf_sample__fprintf_callindent()
1356 name = resolve_branch_sym(sample, evsel, thread, al, &ip); in perf_sample__fprintf_callindent()
1385 __weak void arch_fetch_insn(struct perf_sample *sample __maybe_unused, in arch_fetch_insn()
1391 static int perf_sample__fprintf_insn(struct perf_sample *sample, in perf_sample__fprintf_insn() argument
1398 if (sample->insn_len == 0 && native_arch) in perf_sample__fprintf_insn()
1399 arch_fetch_insn(sample, thread, machine); in perf_sample__fprintf_insn()
1402 printed += fprintf(fp, " ilen: %d", sample->insn_len); in perf_sample__fprintf_insn()
1403 if (PRINT_FIELD(INSN) && sample->insn_len) { in perf_sample__fprintf_insn()
1407 for (i = 0; i < sample->insn_len; i++) in perf_sample__fprintf_insn()
1408 printed += fprintf(fp, " %02x", (unsigned char)sample->insn[i]); in perf_sample__fprintf_insn()
1411 printed += perf_sample__fprintf_brstackinsn(sample, thread, attr, machine, fp); in perf_sample__fprintf_insn()
1416 static int perf_sample__fprintf_ipc(struct perf_sample *sample, in perf_sample__fprintf_ipc() argument
1421 if (!PRINT_FIELD(IPC) || !sample->cyc_cnt || !sample->insn_cnt) in perf_sample__fprintf_ipc()
1424 ipc = (sample->insn_cnt * 100) / sample->cyc_cnt; in perf_sample__fprintf_ipc()
1427 ipc / 100, ipc % 100, sample->insn_cnt, sample->cyc_cnt); in perf_sample__fprintf_ipc()
1430 static int perf_sample__fprintf_bts(struct perf_sample *sample, in perf_sample__fprintf_bts() argument
1442 printed += perf_sample__fprintf_callindent(sample, evsel, thread, al, fp); in perf_sample__fprintf_bts()
1449 if (symbol_conf.use_callchain && sample->callchain && in perf_sample__fprintf_bts()
1451 sample, NULL, NULL, scripting_max_stack) == 0) in perf_sample__fprintf_bts()
1463 printed += sample__fprintf_sym(sample, al, 0, print_opts, cursor, in perf_sample__fprintf_bts()
1472 printed += perf_sample__fprintf_addr(sample, thread, attr, fp); in perf_sample__fprintf_bts()
1475 printed += perf_sample__fprintf_ipc(sample, attr, fp); in perf_sample__fprintf_bts()
1480 printed += perf_sample__fprintf_insn(sample, attr, thread, machine, fp); in perf_sample__fprintf_bts()
1630 static int perf_sample__fprintf_bpf_output(struct perf_sample *sample, FILE *fp) in perf_sample__fprintf_bpf_output() argument
1632 unsigned int nr_bytes = sample->raw_size; in perf_sample__fprintf_bpf_output()
1634 int printed = binary__fprintf(sample->raw_data, nr_bytes, 8, in perf_sample__fprintf_bpf_output()
1638 printed += fprintf(fp, "%17s \"%s\"\n", "BPF string:", (char *)(sample->raw_data)); in perf_sample__fprintf_bpf_output()
1656 static int perf_sample__fprintf_synth_ptwrite(struct perf_sample *sample, FILE *fp) in perf_sample__fprintf_synth_ptwrite() argument
1658 struct perf_synth_intel_ptwrite *data = perf_sample__synth_ptr(sample); in perf_sample__fprintf_synth_ptwrite()
1661 if (perf_sample__bad_synth_size(sample, *data)) in perf_sample__fprintf_synth_ptwrite()
1669 static int perf_sample__fprintf_synth_mwait(struct perf_sample *sample, FILE *fp) in perf_sample__fprintf_synth_mwait() argument
1671 struct perf_synth_intel_mwait *data = perf_sample__synth_ptr(sample); in perf_sample__fprintf_synth_mwait()
1674 if (perf_sample__bad_synth_size(sample, *data)) in perf_sample__fprintf_synth_mwait()
1682 static int perf_sample__fprintf_synth_pwre(struct perf_sample *sample, FILE *fp) in perf_sample__fprintf_synth_pwre() argument
1684 struct perf_synth_intel_pwre *data = perf_sample__synth_ptr(sample); in perf_sample__fprintf_synth_pwre()
1687 if (perf_sample__bad_synth_size(sample, *data)) in perf_sample__fprintf_synth_pwre()
1695 static int perf_sample__fprintf_synth_exstop(struct perf_sample *sample, FILE *fp) in perf_sample__fprintf_synth_exstop() argument
1697 struct perf_synth_intel_exstop *data = perf_sample__synth_ptr(sample); in perf_sample__fprintf_synth_exstop()
1700 if (perf_sample__bad_synth_size(sample, *data)) in perf_sample__fprintf_synth_exstop()
1707 static int perf_sample__fprintf_synth_pwrx(struct perf_sample *sample, FILE *fp) in perf_sample__fprintf_synth_pwrx() argument
1709 struct perf_synth_intel_pwrx *data = perf_sample__synth_ptr(sample); in perf_sample__fprintf_synth_pwrx()
1712 if (perf_sample__bad_synth_size(sample, *data)) in perf_sample__fprintf_synth_pwrx()
1721 static int perf_sample__fprintf_synth_cbr(struct perf_sample *sample, FILE *fp) in perf_sample__fprintf_synth_cbr() argument
1723 struct perf_synth_intel_cbr *data = perf_sample__synth_ptr(sample); in perf_sample__fprintf_synth_cbr()
1727 if (perf_sample__bad_synth_size(sample, *data)) in perf_sample__fprintf_synth_cbr()
1739 static int perf_sample__fprintf_synth(struct perf_sample *sample, in perf_sample__fprintf_synth() argument
1744 return perf_sample__fprintf_synth_ptwrite(sample, fp); in perf_sample__fprintf_synth()
1746 return perf_sample__fprintf_synth_mwait(sample, fp); in perf_sample__fprintf_synth()
1748 return perf_sample__fprintf_synth_pwre(sample, fp); in perf_sample__fprintf_synth()
1750 return perf_sample__fprintf_synth_exstop(sample, fp); in perf_sample__fprintf_synth()
1752 return perf_sample__fprintf_synth_pwrx(sample, fp); in perf_sample__fprintf_synth()
1754 return perf_sample__fprintf_synth_cbr(sample, fp); in perf_sample__fprintf_synth()
1794 struct perf_sample *sample; member
1809 perf_sample__fprintf_start(NULL, mctx->sample, mctx->thread, mctx->evsel, in script_print_metric()
1824 perf_sample__fprintf_start(NULL, mctx->sample, mctx->thread, mctx->evsel, in script_new_line()
1832 struct perf_sample *sample, in perf_sample__fprint_metric() argument
1839 .sample = sample, in perf_sample__fprint_metric()
1853 val = sample->period * evsel->scale; in perf_sample__fprint_metric()
1856 sample->cpu, in perf_sample__fprint_metric()
1863 sample->cpu, in perf_sample__fprint_metric()
1872 static bool show_event(struct perf_sample *sample, in show_event() argument
1877 int depth = thread_stack__depth(thread, sample->cpu); in show_event()
1891 const char *name = resolve_branch_sym(sample, evsel, thread, al, in show_event()
1914 struct perf_sample *sample, struct evsel *evsel, in process_event() argument
1927 if (!show_event(sample, evsel, thread, al)) in process_event()
1935 perf_sample__fprintf_start(script, sample, thread, evsel, in process_event()
1939 fprintf(fp, "%10" PRIu64 " ", sample->period); in process_event()
1951 perf_sample__fprintf_flags(sample->flags, fp); in process_event()
1954 perf_sample__fprintf_bts(sample, evsel, thread, al, machine, fp); in process_event()
1958 if (PRINT_FIELD(TRACE) && sample->raw_data) { in process_event()
1959 event_format__fprintf(evsel->tp_format, sample->cpu, in process_event()
1960 sample->raw_data, sample->raw_size, fp); in process_event()
1964 perf_sample__fprintf_synth(sample, evsel, fp); in process_event()
1967 perf_sample__fprintf_addr(sample, thread, attr, fp); in process_event()
1970 data_src__fprintf(sample->data_src, fp); in process_event()
1973 fprintf(fp, "%16" PRIu64, sample->weight); in process_event()
1981 if (symbol_conf.use_callchain && sample->callchain && in process_event()
1983 sample, NULL, NULL, scripting_max_stack) == 0) in process_event()
1987 sample__fprintf_sym(sample, al, 0, output[type].print_ip_opts, cursor, in process_event()
1992 perf_sample__fprintf_iregs(sample, attr, fp); in process_event()
1995 perf_sample__fprintf_uregs(sample, attr, fp); in process_event()
1998 perf_sample__fprintf_brstack(sample, thread, attr, fp); in process_event()
2000 perf_sample__fprintf_brstacksym(sample, thread, attr, fp); in process_event()
2002 perf_sample__fprintf_brstackoff(sample, thread, attr, fp); in process_event()
2005 perf_sample__fprintf_bpf_output(sample, fp); in process_event()
2006 perf_sample__fprintf_insn(sample, attr, thread, machine, fp); in process_event()
2009 fprintf(fp, "%16" PRIx64, sample->phys_addr); in process_event()
2011 perf_sample__fprintf_ipc(sample, attr, fp); in process_event()
2022 perf_sample__fprint_metric(script, thread, evsel, sample, fp); in process_event()
2096 static bool filter_cpu(struct perf_sample *sample) in filter_cpu() argument
2098 if (cpu_list && sample->cpu != (u32)-1) in filter_cpu()
2099 return !test_bit(sample->cpu, cpu_bitmap); in filter_cpu()
2105 struct perf_sample *sample, in process_sample_event() argument
2113 sample->time)) { in process_sample_event()
2118 if (sample->time < last_timestamp) { in process_sample_event()
2121 sample->time); in process_sample_event()
2124 last_timestamp = sample->time; in process_sample_event()
2128 if (machine__resolve(machine, &al, sample) < 0) { in process_sample_event()
2137 if (filter_cpu(sample)) in process_sample_event()
2141 scripting_ops->process_event(event, sample, evsel, &al); in process_sample_event()
2143 process_event(scr, sample, evsel, &al, machine); in process_sample_event()
2221 struct perf_sample *sample, in print_event_with_time() argument
2227 struct evsel *evsel = perf_evlist__id2evsel(session->evlist, sample->id); in print_event_with_time()
2231 sample->cpu = 0; in print_event_with_time()
2232 sample->time = timestamp; in print_event_with_time()
2233 sample->pid = pid; in print_event_with_time()
2234 sample->tid = tid; in print_event_with_time()
2237 if (filter_cpu(sample)) in print_event_with_time()
2244 perf_sample__fprintf_start(script, sample, thread, evsel, in print_event_with_time()
2256 struct perf_sample *sample, struct machine *machine, in print_event() argument
2259 return print_event_with_time(tool, event, sample, machine, pid, tid, 0); in print_event()
2264 struct perf_sample *sample, in process_comm_event() argument
2267 if (perf_event__process_comm(tool, event, sample, machine) < 0) in process_comm_event()
2270 return print_event(tool, event, sample, machine, event->comm.pid, in process_comm_event()
2276 struct perf_sample *sample, in process_namespaces_event() argument
2279 if (perf_event__process_namespaces(tool, event, sample, machine) < 0) in process_namespaces_event()
2282 return print_event(tool, event, sample, machine, event->namespaces.pid, in process_namespaces_event()
2288 struct perf_sample *sample, in process_cgroup_event() argument
2291 if (perf_event__process_cgroup(tool, event, sample, machine) < 0) in process_cgroup_event()
2294 return print_event(tool, event, sample, machine, sample->pid, in process_cgroup_event()
2295 sample->tid); in process_cgroup_event()
2300 struct perf_sample *sample, in process_fork_event() argument
2303 if (perf_event__process_fork(tool, event, sample, machine) < 0) in process_fork_event()
2306 return print_event_with_time(tool, event, sample, machine, in process_fork_event()
2312 struct perf_sample *sample, in process_exit_event() argument
2316 if (print_event_with_time(tool, event, sample, machine, event->fork.pid, in process_exit_event()
2320 return perf_event__process_exit(tool, event, sample, machine); in process_exit_event()
2325 struct perf_sample *sample, in process_mmap_event() argument
2328 if (perf_event__process_mmap(tool, event, sample, machine) < 0) in process_mmap_event()
2331 return print_event(tool, event, sample, machine, event->mmap.pid, in process_mmap_event()
2337 struct perf_sample *sample, in process_mmap2_event() argument
2340 if (perf_event__process_mmap2(tool, event, sample, machine) < 0) in process_mmap2_event()
2343 return print_event(tool, event, sample, machine, event->mmap2.pid, in process_mmap2_event()
2349 struct perf_sample *sample, in process_switch_event() argument
2354 if (perf_event__process_switch(tool, event, sample, machine) < 0) in process_switch_event()
2358 scripting_ops->process_switch(event, sample, machine); in process_switch_event()
2363 return print_event(tool, event, sample, machine, sample->pid, in process_switch_event()
2364 sample->tid); in process_switch_event()
2370 struct perf_sample *sample, in process_lost_event() argument
2373 return print_event(tool, event, sample, machine, sample->pid, in process_lost_event()
2374 sample->tid); in process_lost_event()
2390 struct perf_sample *sample, in process_bpf_events() argument
2393 if (machine__process_ksymbol(machine, event, sample) < 0) in process_bpf_events()
2396 return print_event(tool, event, sample, machine, sample->pid, in process_bpf_events()
2397 sample->tid); in process_bpf_events()
2402 struct perf_sample *sample, in process_text_poke_events() argument
2405 if (perf_event__process_text_poke(tool, event, sample, machine) < 0) in process_text_poke_events()
2408 return print_event(tool, event, sample, machine, sample->pid, in process_text_poke_events()
2409 sample->tid); in process_text_poke_events()
3445 .sample = process_sample_event, in cmd_script()
3618 * Enable guest sample processing. in cmd_script()