Lines Matching full:sample
289 struct perf_sample *sample) in intel_pt_dump_sample() argument
295 intel_pt_dump(pt, sample->aux_sample.data, sample->aux_sample.size); in intel_pt_dump_sample()
1236 struct perf_sample *sample) in intel_pt_add_callchain() argument
1239 sample->pid, in intel_pt_add_callchain()
1240 sample->tid); in intel_pt_add_callchain()
1242 thread_stack__sample_late(thread, sample->cpu, pt->chain, in intel_pt_add_callchain()
1243 pt->synth_opts.callchain_sz + 1, sample->ip, in intel_pt_add_callchain()
1246 sample->callchain = pt->chain; in intel_pt_add_callchain()
1274 struct perf_sample *sample) in intel_pt_add_br_stack() argument
1277 sample->pid, in intel_pt_add_br_stack()
1278 sample->tid); in intel_pt_add_br_stack()
1280 thread_stack__br_sample_late(thread, sample->cpu, pt->br_stack, in intel_pt_add_br_stack()
1281 pt->br_stack_sz, sample->ip, in intel_pt_add_br_stack()
1284 sample->branch_stack = pt->br_stack; in intel_pt_add_br_stack()
1687 struct perf_sample *sample) in intel_pt_prep_a_sample() argument
1689 event->sample.header.type = PERF_RECORD_SAMPLE; in intel_pt_prep_a_sample()
1690 event->sample.header.size = sizeof(struct perf_event_header); in intel_pt_prep_a_sample()
1692 sample->pid = ptq->pid; in intel_pt_prep_a_sample()
1693 sample->tid = ptq->tid; in intel_pt_prep_a_sample()
1698 sample->pid = ptq->guest_pid; in intel_pt_prep_a_sample()
1699 sample->tid = ptq->guest_tid; in intel_pt_prep_a_sample()
1700 sample->machine_pid = ptq->guest_machine_pid; in intel_pt_prep_a_sample()
1701 sample->vcpu = ptq->vcpu; in intel_pt_prep_a_sample()
1705 sample->cpu = ptq->cpu; in intel_pt_prep_a_sample()
1706 sample->insn_len = ptq->insn_len; in intel_pt_prep_a_sample()
1707 memcpy(sample->insn, ptq->insn, INTEL_PT_INSN_BUF_SZ); in intel_pt_prep_a_sample()
1713 struct perf_sample *sample) in intel_pt_prep_b_sample() argument
1715 intel_pt_prep_a_sample(ptq, event, sample); in intel_pt_prep_b_sample()
1718 sample->time = tsc_to_perf_time(ptq->timestamp, &pt->tc); in intel_pt_prep_b_sample()
1720 sample->ip = ptq->state->from_ip; in intel_pt_prep_b_sample()
1721 sample->addr = ptq->state->to_ip; in intel_pt_prep_b_sample()
1722 sample->cpumode = intel_pt_cpumode(ptq, sample->ip, sample->addr); in intel_pt_prep_b_sample()
1723 sample->period = 1; in intel_pt_prep_b_sample()
1724 sample->flags = ptq->flags; in intel_pt_prep_b_sample()
1726 event->sample.header.misc = sample->cpumode; in intel_pt_prep_b_sample()
1730 struct perf_sample *sample, u64 type) in intel_pt_inject_event() argument
1732 event->header.size = perf_event__sample_event_size(sample, type, 0); in intel_pt_inject_event()
1733 return perf_event__synthesize_sample(event, type, 0, sample); in intel_pt_inject_event()
1738 struct perf_sample *sample, u64 type) in intel_pt_opt_inject() argument
1743 return intel_pt_inject_event(event, sample, type); in intel_pt_opt_inject()
1748 struct perf_sample *sample, u64 type) in intel_pt_deliver_synth_event() argument
1752 ret = intel_pt_opt_inject(pt, event, sample, type); in intel_pt_deliver_synth_event()
1756 ret = perf_session__deliver_synth_event(pt->session, event, sample); in intel_pt_deliver_synth_event()
1767 struct perf_sample sample = { .ip = 0, }; in intel_pt_synth_branch_sample() local
1780 intel_pt_prep_b_sample(pt, ptq, event, &sample); in intel_pt_synth_branch_sample()
1782 sample.id = ptq->pt->branches_id; in intel_pt_synth_branch_sample()
1783 sample.stream_id = ptq->pt->branches_id; in intel_pt_synth_branch_sample()
1794 .from = sample.ip, in intel_pt_synth_branch_sample()
1795 .to = sample.addr, in intel_pt_synth_branch_sample()
1798 sample.branch_stack = (struct branch_stack *)&dummy_bs; in intel_pt_synth_branch_sample()
1802 sample.cyc_cnt = ptq->ipc_cyc_cnt - ptq->last_br_cyc_cnt; in intel_pt_synth_branch_sample()
1803 if (sample.cyc_cnt) { in intel_pt_synth_branch_sample()
1804 sample.insn_cnt = ptq->ipc_insn_cnt - ptq->last_br_insn_cnt; in intel_pt_synth_branch_sample()
1809 return intel_pt_deliver_synth_event(pt, event, &sample, in intel_pt_synth_branch_sample()
1816 struct perf_sample *sample) in intel_pt_prep_sample() argument
1818 intel_pt_prep_b_sample(pt, ptq, event, sample); in intel_pt_prep_sample()
1823 sample->ip, pt->kernel_start); in intel_pt_prep_sample()
1824 sample->callchain = ptq->chain; in intel_pt_prep_sample()
1830 sample->branch_stack = ptq->last_branch; in intel_pt_prep_sample()
1838 struct perf_sample sample = { .ip = 0, }; in intel_pt_synth_instruction_sample() local
1843 intel_pt_prep_sample(pt, ptq, event, &sample); in intel_pt_synth_instruction_sample()
1845 sample.id = ptq->pt->instructions_id; in intel_pt_synth_instruction_sample()
1846 sample.stream_id = ptq->pt->instructions_id; in intel_pt_synth_instruction_sample()
1848 sample.period = 1; in intel_pt_synth_instruction_sample()
1850 sample.period = ptq->state->tot_insn_cnt - ptq->last_insn_cnt; in intel_pt_synth_instruction_sample()
1853 sample.cyc_cnt = ptq->ipc_cyc_cnt - ptq->last_in_cyc_cnt; in intel_pt_synth_instruction_sample()
1854 if (sample.cyc_cnt) { in intel_pt_synth_instruction_sample()
1855 sample.insn_cnt = ptq->ipc_insn_cnt - ptq->last_in_insn_cnt; in intel_pt_synth_instruction_sample()
1862 return intel_pt_deliver_synth_event(pt, event, &sample, in intel_pt_synth_instruction_sample()
1870 struct perf_sample sample = { .ip = 0, }; in intel_pt_synth_cycle_sample() local
1879 intel_pt_prep_sample(pt, ptq, event, &sample); in intel_pt_synth_cycle_sample()
1881 sample.id = ptq->pt->cycles_id; in intel_pt_synth_cycle_sample()
1882 sample.stream_id = ptq->pt->cycles_id; in intel_pt_synth_cycle_sample()
1883 sample.period = period; in intel_pt_synth_cycle_sample()
1885 sample.cyc_cnt = period; in intel_pt_synth_cycle_sample()
1886 sample.insn_cnt = ptq->ipc_insn_cnt - ptq->last_cy_insn_cnt; in intel_pt_synth_cycle_sample()
1890 return intel_pt_deliver_synth_event(pt, event, &sample, pt->cycles_sample_type); in intel_pt_synth_cycle_sample()
1897 struct perf_sample sample = { .ip = 0, }; in intel_pt_synth_transaction_sample() local
1902 intel_pt_prep_sample(pt, ptq, event, &sample); in intel_pt_synth_transaction_sample()
1904 sample.id = ptq->pt->transactions_id; in intel_pt_synth_transaction_sample()
1905 sample.stream_id = ptq->pt->transactions_id; in intel_pt_synth_transaction_sample()
1907 return intel_pt_deliver_synth_event(pt, event, &sample, in intel_pt_synth_transaction_sample()
1914 struct perf_sample *sample) in intel_pt_prep_p_sample() argument
1916 intel_pt_prep_sample(pt, ptq, event, sample); in intel_pt_prep_p_sample()
1922 if (!sample->ip) in intel_pt_prep_p_sample()
1923 sample->flags = 0; in intel_pt_prep_p_sample()
1930 struct perf_sample sample = { .ip = 0, }; in intel_pt_synth_ptwrite_sample() local
1936 intel_pt_prep_p_sample(pt, ptq, event, &sample); in intel_pt_synth_ptwrite_sample()
1938 sample.id = ptq->pt->ptwrites_id; in intel_pt_synth_ptwrite_sample()
1939 sample.stream_id = ptq->pt->ptwrites_id; in intel_pt_synth_ptwrite_sample()
1945 sample.raw_size = perf_synth__raw_size(raw); in intel_pt_synth_ptwrite_sample()
1946 sample.raw_data = perf_synth__raw_data(&raw); in intel_pt_synth_ptwrite_sample()
1948 return intel_pt_deliver_synth_event(pt, event, &sample, in intel_pt_synth_ptwrite_sample()
1956 struct perf_sample sample = { .ip = 0, }; in intel_pt_synth_cbr_sample() local
1965 intel_pt_prep_p_sample(pt, ptq, event, &sample); in intel_pt_synth_cbr_sample()
1967 sample.id = ptq->pt->cbr_id; in intel_pt_synth_cbr_sample()
1968 sample.stream_id = ptq->pt->cbr_id; in intel_pt_synth_cbr_sample()
1975 sample.raw_size = perf_synth__raw_size(raw); in intel_pt_synth_cbr_sample()
1976 sample.raw_data = perf_synth__raw_data(&raw); in intel_pt_synth_cbr_sample()
1978 return intel_pt_deliver_synth_event(pt, event, &sample, in intel_pt_synth_cbr_sample()
1986 struct perf_sample sample = { .ip = 0, }; in intel_pt_synth_psb_sample() local
1992 intel_pt_prep_p_sample(pt, ptq, event, &sample); in intel_pt_synth_psb_sample()
1994 sample.id = ptq->pt->psb_id; in intel_pt_synth_psb_sample()
1995 sample.stream_id = ptq->pt->psb_id; in intel_pt_synth_psb_sample()
1996 sample.flags = 0; in intel_pt_synth_psb_sample()
2001 sample.raw_size = perf_synth__raw_size(raw); in intel_pt_synth_psb_sample()
2002 sample.raw_data = perf_synth__raw_data(&raw); in intel_pt_synth_psb_sample()
2004 return intel_pt_deliver_synth_event(pt, event, &sample, in intel_pt_synth_psb_sample()
2012 struct perf_sample sample = { .ip = 0, }; in intel_pt_synth_mwait_sample() local
2018 intel_pt_prep_p_sample(pt, ptq, event, &sample); in intel_pt_synth_mwait_sample()
2020 sample.id = ptq->pt->mwait_id; in intel_pt_synth_mwait_sample()
2021 sample.stream_id = ptq->pt->mwait_id; in intel_pt_synth_mwait_sample()
2026 sample.raw_size = perf_synth__raw_size(raw); in intel_pt_synth_mwait_sample()
2027 sample.raw_data = perf_synth__raw_data(&raw); in intel_pt_synth_mwait_sample()
2029 return intel_pt_deliver_synth_event(pt, event, &sample, in intel_pt_synth_mwait_sample()
2037 struct perf_sample sample = { .ip = 0, }; in intel_pt_synth_pwre_sample() local
2043 intel_pt_prep_p_sample(pt, ptq, event, &sample); in intel_pt_synth_pwre_sample()
2045 sample.id = ptq->pt->pwre_id; in intel_pt_synth_pwre_sample()
2046 sample.stream_id = ptq->pt->pwre_id; in intel_pt_synth_pwre_sample()
2051 sample.raw_size = perf_synth__raw_size(raw); in intel_pt_synth_pwre_sample()
2052 sample.raw_data = perf_synth__raw_data(&raw); in intel_pt_synth_pwre_sample()
2054 return intel_pt_deliver_synth_event(pt, event, &sample, in intel_pt_synth_pwre_sample()
2062 struct perf_sample sample = { .ip = 0, }; in intel_pt_synth_exstop_sample() local
2068 intel_pt_prep_p_sample(pt, ptq, event, &sample); in intel_pt_synth_exstop_sample()
2070 sample.id = ptq->pt->exstop_id; in intel_pt_synth_exstop_sample()
2071 sample.stream_id = ptq->pt->exstop_id; in intel_pt_synth_exstop_sample()
2076 sample.raw_size = perf_synth__raw_size(raw); in intel_pt_synth_exstop_sample()
2077 sample.raw_data = perf_synth__raw_data(&raw); in intel_pt_synth_exstop_sample()
2079 return intel_pt_deliver_synth_event(pt, event, &sample, in intel_pt_synth_exstop_sample()
2087 struct perf_sample sample = { .ip = 0, }; in intel_pt_synth_pwrx_sample() local
2093 intel_pt_prep_p_sample(pt, ptq, event, &sample); in intel_pt_synth_pwrx_sample()
2095 sample.id = ptq->pt->pwrx_id; in intel_pt_synth_pwrx_sample()
2096 sample.stream_id = ptq->pt->pwrx_id; in intel_pt_synth_pwrx_sample()
2101 sample.raw_size = perf_synth__raw_size(raw); in intel_pt_synth_pwrx_sample()
2102 sample.raw_data = perf_synth__raw_data(&raw); in intel_pt_synth_pwrx_sample()
2104 return intel_pt_deliver_synth_event(pt, event, &sample, in intel_pt_synth_pwrx_sample()
2238 struct perf_sample sample = { .ip = 0, }; in intel_pt_do_synth_pebs_sample() local
2243 u64 regs[8 * sizeof(sample.intr_regs.mask)]; in intel_pt_do_synth_pebs_sample()
2248 intel_pt_prep_a_sample(ptq, event, &sample); in intel_pt_do_synth_pebs_sample()
2250 sample.id = id; in intel_pt_do_synth_pebs_sample()
2251 sample.stream_id = id; in intel_pt_do_synth_pebs_sample()
2254 sample.period = evsel->core.attr.sample_period; in intel_pt_do_synth_pebs_sample()
2258 sample.ip = items->ip; in intel_pt_do_synth_pebs_sample()
2260 sample.ip = items->rip; in intel_pt_do_synth_pebs_sample()
2262 sample.ip = ptq->state->from_ip; in intel_pt_do_synth_pebs_sample()
2264 cpumode = intel_pt_cpumode(ptq, sample.ip, 0); in intel_pt_do_synth_pebs_sample()
2266 event->sample.header.misc = cpumode | PERF_RECORD_MISC_EXACT_IP; in intel_pt_do_synth_pebs_sample()
2268 sample.cpumode = cpumode; in intel_pt_do_synth_pebs_sample()
2278 sample.time = tsc_to_perf_time(timestamp, &pt->tc); in intel_pt_do_synth_pebs_sample()
2284 pt->synth_opts.callchain_sz, sample.ip, in intel_pt_do_synth_pebs_sample()
2286 sample.callchain = ptq->chain; in intel_pt_do_synth_pebs_sample()
2295 sample.intr_regs.abi = items->is_32_bit ? in intel_pt_do_synth_pebs_sample()
2298 sample.intr_regs.regs = regs; in intel_pt_do_synth_pebs_sample()
2300 pos = intel_pt_add_gp_regs(&sample.intr_regs, regs, items, regs_mask); in intel_pt_do_synth_pebs_sample()
2302 intel_pt_add_xmm(&sample.intr_regs, pos, items, regs_mask); in intel_pt_do_synth_pebs_sample()
2317 sample.branch_stack = ptq->last_branch; in intel_pt_do_synth_pebs_sample()
2321 sample.addr = items->mem_access_address; in intel_pt_do_synth_pebs_sample()
2342 sample.weight = weight & 0xffff; in intel_pt_do_synth_pebs_sample()
2343 sample.ins_lat = items->mem_access_latency & 0xffff; in intel_pt_do_synth_pebs_sample()
2345 sample.weight = items->mem_access_latency; in intel_pt_do_synth_pebs_sample()
2347 if (!sample.weight && items->has_tsx_aux_info) { in intel_pt_do_synth_pebs_sample()
2349 sample.weight = (u32)items->tsx_aux_info; in intel_pt_do_synth_pebs_sample()
2361 sample.transaction = txn; in intel_pt_do_synth_pebs_sample()
2364 return intel_pt_deliver_synth_event(pt, event, &sample, sample_type); in intel_pt_do_synth_pebs_sample()
2410 struct perf_sample sample = { .ip = 0, }; in intel_pt_synth_events_sample() local
2420 intel_pt_prep_p_sample(pt, ptq, event, &sample); in intel_pt_synth_events_sample()
2422 sample.id = ptq->pt->evt_id; in intel_pt_synth_events_sample()
2423 sample.stream_id = ptq->pt->evt_id; in intel_pt_synth_events_sample()
2437 sample.raw_size = perf_synth__raw_size(raw) + in intel_pt_synth_events_sample()
2439 sample.raw_data = perf_synth__raw_data(&raw); in intel_pt_synth_events_sample()
2441 return intel_pt_deliver_synth_event(pt, event, &sample, in intel_pt_synth_events_sample()
2449 struct perf_sample sample = { .ip = 0, }; in intel_pt_synth_iflag_chg_sample() local
2455 intel_pt_prep_p_sample(pt, ptq, event, &sample); in intel_pt_synth_iflag_chg_sample()
2457 sample.id = ptq->pt->iflag_chg_id; in intel_pt_synth_iflag_chg_sample()
2458 sample.stream_id = ptq->pt->iflag_chg_id; in intel_pt_synth_iflag_chg_sample()
2467 sample.addr = 0; in intel_pt_synth_iflag_chg_sample()
2469 sample.flags = ptq->flags; in intel_pt_synth_iflag_chg_sample()
2471 sample.raw_size = perf_synth__raw_size(raw); in intel_pt_synth_iflag_chg_sample()
2472 sample.raw_data = perf_synth__raw_data(&raw); in intel_pt_synth_iflag_chg_sample()
2474 return intel_pt_deliver_synth_event(pt, event, &sample, in intel_pt_synth_iflag_chg_sample()
3084 struct perf_sample *sample) in intel_pt_sample_set_pid_tid_cpu() argument
3088 ptq->pid = sample->pid; in intel_pt_sample_set_pid_tid_cpu()
3089 ptq->tid = sample->tid; in intel_pt_sample_set_pid_tid_cpu()
3111 struct perf_sample *sample) in intel_pt_process_timeless_sample() argument
3117 queue = auxtrace_queues__sample_queue(&pt->queues, sample, pt->session); in intel_pt_process_timeless_sample()
3126 ptq->time = sample->time; in intel_pt_process_timeless_sample()
3127 intel_pt_sample_set_pid_tid_cpu(ptq, queue, sample); in intel_pt_process_timeless_sample()
3132 static int intel_pt_lost(struct intel_pt *pt, struct perf_sample *sample) in intel_pt_lost() argument
3134 return intel_pt_synth_error(pt, INTEL_PT_ERR_LOST, sample->cpu, in intel_pt_lost()
3135 sample->pid, sample->tid, 0, sample->time, in intel_pt_lost()
3136 sample->machine_pid, sample->vcpu); in intel_pt_lost()
3214 struct perf_sample *sample) in intel_pt_process_switch() argument
3218 struct evsel *evsel = evlist__id2evsel(pt->session->evlist, sample->id); in intel_pt_process_switch()
3223 tid = evsel__intval(evsel, sample, "next_pid"); in intel_pt_process_switch()
3224 cpu = sample->cpu; in intel_pt_process_switch()
3227 cpu, tid, sample->time, perf_time_to_tsc(sample->time, in intel_pt_process_switch()
3230 ret = intel_pt_sync_switch(pt, cpu, tid, sample->time); in intel_pt_process_switch()
3239 struct perf_sample *sample) in intel_pt_context_switch_in() argument
3241 pid_t pid = sample->pid; in intel_pt_context_switch_in()
3242 pid_t tid = sample->tid; in intel_pt_context_switch_in()
3243 int cpu = sample->cpu; in intel_pt_context_switch_in()
3278 struct perf_sample *sample) in intel_pt_guest_context_switch() argument
3282 struct machine *machine = machines__find(machines, sample->machine_pid); in intel_pt_guest_context_switch()
3300 return machine__set_current_tid(machine, sample->vcpu, sample->pid, sample->tid); in intel_pt_guest_context_switch()
3304 struct perf_sample *sample) in intel_pt_context_switch() argument
3311 return intel_pt_guest_context_switch(pt, event, sample); in intel_pt_context_switch()
3313 cpu = sample->cpu; in intel_pt_context_switch()
3317 return intel_pt_context_switch_in(pt, sample); in intel_pt_context_switch()
3327 pid = sample->pid; in intel_pt_context_switch()
3328 tid = sample->tid; in intel_pt_context_switch()
3334 ret = intel_pt_sync_switch(pt, cpu, tid, sample->time); in intel_pt_context_switch()
3343 struct perf_sample *sample) in intel_pt_process_itrace_start() argument
3349 sample->cpu, event->itrace_start.pid, in intel_pt_process_itrace_start()
3350 event->itrace_start.tid, sample->time, in intel_pt_process_itrace_start()
3351 perf_time_to_tsc(sample->time, &pt->tc)); in intel_pt_process_itrace_start()
3353 return machine__set_current_tid(pt->machine, sample->cpu, in intel_pt_process_itrace_start()
3360 struct perf_sample *sample) in intel_pt_process_aux_output_hw_id() argument
3367 queue = auxtrace_queues__sample_queue(&pt->queues, sample, pt->session); in intel_pt_process_aux_output_hw_id()
3368 evsel = evlist__id2evsel_strict(pt->session->evlist, sample->id); in intel_pt_process_aux_output_hw_id()
3377 ptq->pebs[hw_id].id = sample->id; in intel_pt_process_aux_output_hw_id()
3451 struct perf_sample *sample, in intel_pt_process_event() argument
3467 if (sample->time && sample->time != (u64)-1) in intel_pt_process_event()
3468 timestamp = perf_time_to_tsc(sample->time, &pt->tc); in intel_pt_process_event()
3480 if (sample->aux_sample.size) in intel_pt_process_event()
3482 sample); in intel_pt_process_event()
3486 sample->time); in intel_pt_process_event()
3497 if (pt->synth_opts.add_callchain && !sample->callchain) in intel_pt_process_event()
3498 intel_pt_add_callchain(pt, sample); in intel_pt_process_event()
3499 if (pt->synth_opts.add_last_branch && !sample->branch_stack) in intel_pt_process_event()
3500 intel_pt_add_br_stack(pt, sample); in intel_pt_process_event()
3506 err = intel_pt_lost(pt, sample); in intel_pt_process_event()
3513 err = intel_pt_process_switch(pt, sample); in intel_pt_process_event()
3517 err = intel_pt_process_itrace_start(pt, event, sample); in intel_pt_process_event()
3519 err = intel_pt_process_aux_output_hw_id(pt, event, sample); in intel_pt_process_event()
3522 err = intel_pt_context_switch(pt, event, sample); in intel_pt_process_event()
3527 if (intel_pt_enable_logging && intel_pt_log_events(pt, sample->time)) { in intel_pt_process_event()
3529 event->header.type, sample->cpu, sample->time, timestamp); in intel_pt_process_event()
3641 struct perf_sample *sample, in intel_pt_queue_data() argument
3653 if (sample->time && sample->time != (u64)-1) in intel_pt_queue_data()
3654 timestamp = perf_time_to_tsc(sample->time, &pt->tc); in intel_pt_queue_data()
3658 return auxtrace_queues__add_sample(&pt->queues, session, sample, in intel_pt_queue_data()
3667 pr_debug("Synthesizing '%s' event with id %" PRIu64 " sample type %#" PRIx64 "\n", in intel_pt_synth_event()
3763 * We don't use the hardware index, but the sample generation in intel_pt_synth_events()
4415 * actual sample ip to where the sample time is recorded. in intel_pt_process_auxtrace_info()