Lines Matching refs:spe
72 struct arm_spe *spe; member
88 static void arm_spe_dump(struct arm_spe *spe __maybe_unused, in arm_spe_dump()
127 static void arm_spe_dump_event(struct arm_spe *spe, unsigned char *buf, in arm_spe_dump_event() argument
131 arm_spe_dump(spe, buf, len); in arm_spe_dump_event()
141 queue = &speq->spe->queues.queue_array[speq->queue_nr]; in arm_spe_get_trace()
157 int fd = perf_data__fd(speq->spe->session->data); in arm_spe_get_trace()
179 static struct arm_spe_queue *arm_spe__alloc_queue(struct arm_spe *spe, in arm_spe__alloc_queue() argument
193 speq->spe = spe; in arm_spe__alloc_queue()
217 static inline u8 arm_spe_cpumode(struct arm_spe *spe, u64 ip) in arm_spe_cpumode() argument
219 return ip >= spe->kernel_start ? in arm_spe_cpumode()
224 static void arm_spe_prep_sample(struct arm_spe *spe, in arm_spe_prep_sample() argument
231 if (!spe->timeless_decoding) in arm_spe_prep_sample()
235 sample->cpumode = arm_spe_cpumode(spe, sample->ip); in arm_spe_prep_sample()
248 arm_spe_deliver_synth_event(struct arm_spe *spe, in arm_spe_deliver_synth_event() argument
255 ret = perf_session__deliver_synth_event(spe->session, event, sample); in arm_spe_deliver_synth_event()
266 struct arm_spe *spe = speq->spe; in arm_spe_synth_spe_events_sample() local
270 arm_spe_prep_sample(spe, speq, event, &sample); in arm_spe_synth_spe_events_sample()
275 return arm_spe_deliver_synth_event(spe, speq, event, &sample); in arm_spe_synth_spe_events_sample()
281 struct arm_spe *spe = speq->spe; in arm_spe_sample() local
284 if (spe->sample_flc) { in arm_spe_sample()
287 speq, spe->l1d_miss_id); in arm_spe_sample()
294 speq, spe->l1d_access_id); in arm_spe_sample()
300 if (spe->sample_llc) { in arm_spe_sample()
303 speq, spe->llc_miss_id); in arm_spe_sample()
310 speq, spe->llc_access_id); in arm_spe_sample()
316 if (spe->sample_tlb) { in arm_spe_sample()
319 speq, spe->tlb_miss_id); in arm_spe_sample()
326 speq, spe->tlb_access_id); in arm_spe_sample()
332 if (spe->sample_branch && (record->type & ARM_SPE_BRANCH_MISS)) { in arm_spe_sample()
334 spe->branch_miss_id); in arm_spe_sample()
339 if (spe->sample_remote_access && in arm_spe_sample()
342 spe->remote_access_id); in arm_spe_sample()
352 struct arm_spe *spe = speq->spe; in arm_spe_run_decoder() local
355 if (!spe->kernel_start) in arm_spe_run_decoder()
356 spe->kernel_start = machine__kernel_start(spe->machine); in arm_spe_run_decoder()
376 if (!spe->timeless_decoding && speq->timestamp >= *timestamp) { in arm_spe_run_decoder()
385 static int arm_spe__setup_queue(struct arm_spe *spe, in arm_spe__setup_queue() argument
395 speq = arm_spe__alloc_queue(spe, queue_nr); in arm_spe__setup_queue()
408 if (spe->timeless_decoding) in arm_spe__setup_queue()
423 ret = auxtrace_heap__add(&spe->heap, queue_nr, speq->timestamp); in arm_spe__setup_queue()
432 static int arm_spe__setup_queues(struct arm_spe *spe) in arm_spe__setup_queues() argument
437 for (i = 0; i < spe->queues.nr_queues; i++) { in arm_spe__setup_queues()
438 ret = arm_spe__setup_queue(spe, &spe->queues.queue_array[i], i); in arm_spe__setup_queues()
446 static int arm_spe__update_queues(struct arm_spe *spe) in arm_spe__update_queues() argument
448 if (spe->queues.new_data) { in arm_spe__update_queues()
449 spe->queues.new_data = false; in arm_spe__update_queues()
450 return arm_spe__setup_queues(spe); in arm_spe__update_queues()
456 static bool arm_spe__is_timeless_decoding(struct arm_spe *spe) in arm_spe__is_timeless_decoding() argument
459 struct evlist *evlist = spe->session->evlist; in arm_spe__is_timeless_decoding()
474 static void arm_spe_set_pid_tid_cpu(struct arm_spe *spe, in arm_spe_set_pid_tid_cpu() argument
480 tid = machine__get_current_tid(spe->machine, speq->cpu); in arm_spe_set_pid_tid_cpu()
488 speq->thread = machine__find_thread(spe->machine, -1, in arm_spe_set_pid_tid_cpu()
499 static int arm_spe_process_queues(struct arm_spe *spe, u64 timestamp) in arm_spe_process_queues() argument
509 if (!spe->heap.heap_cnt) in arm_spe_process_queues()
512 if (spe->heap.heap_array[0].ordinal >= timestamp) in arm_spe_process_queues()
515 queue_nr = spe->heap.heap_array[0].queue_nr; in arm_spe_process_queues()
516 queue = &spe->queues.queue_array[queue_nr]; in arm_spe_process_queues()
519 auxtrace_heap__pop(&spe->heap); in arm_spe_process_queues()
521 if (spe->heap.heap_cnt) { in arm_spe_process_queues()
522 ts = spe->heap.heap_array[0].ordinal + 1; in arm_spe_process_queues()
529 arm_spe_set_pid_tid_cpu(spe, queue); in arm_spe_process_queues()
533 auxtrace_heap__add(&spe->heap, queue_nr, ts); in arm_spe_process_queues()
538 ret = auxtrace_heap__add(&spe->heap, queue_nr, ts); in arm_spe_process_queues()
549 static int arm_spe_process_timeless_queues(struct arm_spe *spe, pid_t tid, in arm_spe_process_timeless_queues() argument
552 struct auxtrace_queues *queues = &spe->queues; in arm_spe_process_timeless_queues()
557 struct auxtrace_queue *queue = &spe->queues.queue_array[i]; in arm_spe_process_timeless_queues()
562 arm_spe_set_pid_tid_cpu(spe, queue); in arm_spe_process_timeless_queues()
576 struct arm_spe *spe = container_of(session->auxtrace, in arm_spe_process_event() local
592 if (timestamp || spe->timeless_decoding) { in arm_spe_process_event()
593 err = arm_spe__update_queues(spe); in arm_spe_process_event()
598 if (spe->timeless_decoding) { in arm_spe_process_event()
600 err = arm_spe_process_timeless_queues(spe, in arm_spe_process_event()
606 err = arm_spe_process_queues(spe, timestamp); in arm_spe_process_event()
619 struct arm_spe *spe = container_of(session->auxtrace, struct arm_spe, in arm_spe_process_auxtrace_event() local
622 if (!spe->data_queued) { in arm_spe_process_auxtrace_event()
636 err = auxtrace_queues__add_event(&spe->queues, session, event, in arm_spe_process_auxtrace_event()
644 arm_spe_dump_event(spe, buffer->data, in arm_spe_process_auxtrace_event()
657 struct arm_spe *spe = container_of(session->auxtrace, struct arm_spe, in arm_spe_flush() local
667 ret = arm_spe__update_queues(spe); in arm_spe_flush()
671 if (spe->timeless_decoding) in arm_spe_flush()
672 return arm_spe_process_timeless_queues(spe, -1, in arm_spe_flush()
675 return arm_spe_process_queues(spe, MAX_TIMESTAMP); in arm_spe_flush()
692 struct arm_spe *spe = container_of(session->auxtrace, struct arm_spe, in arm_spe_free_events() local
694 struct auxtrace_queues *queues = &spe->queues; in arm_spe_free_events()
706 struct arm_spe *spe = container_of(session->auxtrace, struct arm_spe, in arm_spe_free() local
709 auxtrace_heap__free(&spe->heap); in arm_spe_free()
712 free(spe); in arm_spe_free()
718 struct arm_spe *spe = container_of(session->auxtrace, struct arm_spe, auxtrace); in arm_spe_evsel_is_auxtrace() local
720 return evsel->core.attr.type == spe->pmu_type; in arm_spe_evsel_is_auxtrace()
780 arm_spe_synth_events(struct arm_spe *spe, struct perf_session *session) in arm_spe_synth_events() argument
790 if (evsel->core.attr.type == spe->pmu_type) { in arm_spe_synth_events()
807 if (spe->timeless_decoding) in arm_spe_synth_events()
826 if (spe->synth_opts.flc) { in arm_spe_synth_events()
827 spe->sample_flc = true; in arm_spe_synth_events()
833 spe->l1d_miss_id = id; in arm_spe_synth_events()
841 spe->l1d_access_id = id; in arm_spe_synth_events()
846 if (spe->synth_opts.llc) { in arm_spe_synth_events()
847 spe->sample_llc = true; in arm_spe_synth_events()
853 spe->llc_miss_id = id; in arm_spe_synth_events()
861 spe->llc_access_id = id; in arm_spe_synth_events()
866 if (spe->synth_opts.tlb) { in arm_spe_synth_events()
867 spe->sample_tlb = true; in arm_spe_synth_events()
873 spe->tlb_miss_id = id; in arm_spe_synth_events()
881 spe->tlb_access_id = id; in arm_spe_synth_events()
886 if (spe->synth_opts.branches) { in arm_spe_synth_events()
887 spe->sample_branch = true; in arm_spe_synth_events()
893 spe->branch_miss_id = id; in arm_spe_synth_events()
898 if (spe->synth_opts.remote_access) { in arm_spe_synth_events()
899 spe->sample_remote_access = true; in arm_spe_synth_events()
905 spe->remote_access_id = id; in arm_spe_synth_events()
918 struct arm_spe *spe; in arm_spe_process_auxtrace_info() local
925 spe = zalloc(sizeof(struct arm_spe)); in arm_spe_process_auxtrace_info()
926 if (!spe) in arm_spe_process_auxtrace_info()
929 err = auxtrace_queues__init(&spe->queues); in arm_spe_process_auxtrace_info()
933 spe->session = session; in arm_spe_process_auxtrace_info()
934 spe->machine = &session->machines.host; /* No kvm support */ in arm_spe_process_auxtrace_info()
935 spe->auxtrace_type = auxtrace_info->type; in arm_spe_process_auxtrace_info()
936 spe->pmu_type = auxtrace_info->priv[ARM_SPE_PMU_TYPE]; in arm_spe_process_auxtrace_info()
938 spe->timeless_decoding = arm_spe__is_timeless_decoding(spe); in arm_spe_process_auxtrace_info()
939 spe->auxtrace.process_event = arm_spe_process_event; in arm_spe_process_auxtrace_info()
940 spe->auxtrace.process_auxtrace_event = arm_spe_process_auxtrace_event; in arm_spe_process_auxtrace_info()
941 spe->auxtrace.flush_events = arm_spe_flush; in arm_spe_process_auxtrace_info()
942 spe->auxtrace.free_events = arm_spe_free_events; in arm_spe_process_auxtrace_info()
943 spe->auxtrace.free = arm_spe_free; in arm_spe_process_auxtrace_info()
944 spe->auxtrace.evsel_is_auxtrace = arm_spe_evsel_is_auxtrace; in arm_spe_process_auxtrace_info()
945 session->auxtrace = &spe->auxtrace; in arm_spe_process_auxtrace_info()
953 spe->synth_opts = *session->itrace_synth_opts; in arm_spe_process_auxtrace_info()
955 itrace_synth_opts__set_default(&spe->synth_opts, false); in arm_spe_process_auxtrace_info()
957 err = arm_spe_synth_events(spe, session); in arm_spe_process_auxtrace_info()
961 err = auxtrace_queues__process_index(&spe->queues, session); in arm_spe_process_auxtrace_info()
965 if (spe->queues.populated) in arm_spe_process_auxtrace_info()
966 spe->data_queued = true; in arm_spe_process_auxtrace_info()
971 auxtrace_queues__free(&spe->queues); in arm_spe_process_auxtrace_info()
974 free(spe); in arm_spe_process_auxtrace_info()