Lines Matching refs:speq

149 	struct arm_spe_queue *speq = data;  in arm_spe_get_trace()  local
150 struct auxtrace_buffer *buffer = speq->buffer; in arm_spe_get_trace()
151 struct auxtrace_buffer *old_buffer = speq->old_buffer; in arm_spe_get_trace()
154 queue = &speq->spe->queues.queue_array[speq->queue_nr]; in arm_spe_get_trace()
165 speq->buffer = buffer; in arm_spe_get_trace()
170 int fd = perf_data__fd(speq->spe->session->data); in arm_spe_get_trace()
183 speq->old_buffer = buffer; in arm_spe_get_trace()
196 struct arm_spe_queue *speq; in arm_spe__alloc_queue() local
198 speq = zalloc(sizeof(*speq)); in arm_spe__alloc_queue()
199 if (!speq) in arm_spe__alloc_queue()
202 speq->event_buf = malloc(PERF_SAMPLE_MAX_SIZE); in arm_spe__alloc_queue()
203 if (!speq->event_buf) in arm_spe__alloc_queue()
206 speq->spe = spe; in arm_spe__alloc_queue()
207 speq->queue_nr = queue_nr; in arm_spe__alloc_queue()
208 speq->pid = -1; in arm_spe__alloc_queue()
209 speq->tid = -1; in arm_spe__alloc_queue()
210 speq->cpu = -1; in arm_spe__alloc_queue()
211 speq->period_instructions = 0; in arm_spe__alloc_queue()
215 params.data = speq; in arm_spe__alloc_queue()
218 speq->decoder = arm_spe_decoder_new(&params); in arm_spe__alloc_queue()
219 if (!speq->decoder) in arm_spe__alloc_queue()
222 return speq; in arm_spe__alloc_queue()
225 zfree(&speq->event_buf); in arm_spe__alloc_queue()
226 free(speq); in arm_spe__alloc_queue()
241 struct arm_spe_queue *speq = queue->priv; in arm_spe_set_pid_tid_cpu() local
244 tid = machine__get_current_tid(spe->machine, speq->cpu); in arm_spe_set_pid_tid_cpu()
246 speq->tid = tid; in arm_spe_set_pid_tid_cpu()
247 thread__zput(speq->thread); in arm_spe_set_pid_tid_cpu()
249 speq->tid = queue->tid; in arm_spe_set_pid_tid_cpu()
251 if ((!speq->thread) && (speq->tid != -1)) { in arm_spe_set_pid_tid_cpu()
252 speq->thread = machine__find_thread(spe->machine, -1, in arm_spe_set_pid_tid_cpu()
253 speq->tid); in arm_spe_set_pid_tid_cpu()
256 if (speq->thread) { in arm_spe_set_pid_tid_cpu()
257 speq->pid = speq->thread->pid_; in arm_spe_set_pid_tid_cpu()
259 speq->cpu = speq->thread->cpu; in arm_spe_set_pid_tid_cpu()
263 static int arm_spe_set_tid(struct arm_spe_queue *speq, pid_t tid) in arm_spe_set_tid() argument
265 struct arm_spe *spe = speq->spe; in arm_spe_set_tid()
266 int err = machine__set_current_tid(spe->machine, speq->cpu, -1, tid); in arm_spe_set_tid()
271 arm_spe_set_pid_tid_cpu(spe, &spe->queues.queue_array[speq->queue_nr]); in arm_spe_set_tid()
277 struct arm_spe_queue *speq, in arm_spe_prep_sample() argument
281 struct arm_spe_record *record = &speq->decoder->record; in arm_spe_prep_sample()
288 sample->pid = speq->pid; in arm_spe_prep_sample()
289 sample->tid = speq->tid; in arm_spe_prep_sample()
291 sample->cpu = speq->cpu; in arm_spe_prep_sample()
306 struct arm_spe_queue *speq __maybe_unused, in arm_spe_deliver_synth_event()
325 static int arm_spe__synth_mem_sample(struct arm_spe_queue *speq, in arm_spe__synth_mem_sample() argument
328 struct arm_spe *spe = speq->spe; in arm_spe__synth_mem_sample()
329 struct arm_spe_record *record = &speq->decoder->record; in arm_spe__synth_mem_sample()
330 union perf_event *event = speq->event_buf; in arm_spe__synth_mem_sample()
333 arm_spe_prep_sample(spe, speq, event, &sample); in arm_spe__synth_mem_sample()
342 return arm_spe_deliver_synth_event(spe, speq, event, &sample); in arm_spe__synth_mem_sample()
345 static int arm_spe__synth_branch_sample(struct arm_spe_queue *speq, in arm_spe__synth_branch_sample() argument
348 struct arm_spe *spe = speq->spe; in arm_spe__synth_branch_sample()
349 struct arm_spe_record *record = &speq->decoder->record; in arm_spe__synth_branch_sample()
350 union perf_event *event = speq->event_buf; in arm_spe__synth_branch_sample()
353 arm_spe_prep_sample(spe, speq, event, &sample); in arm_spe__synth_branch_sample()
360 return arm_spe_deliver_synth_event(spe, speq, event, &sample); in arm_spe__synth_branch_sample()
363 static int arm_spe__synth_instruction_sample(struct arm_spe_queue *speq, in arm_spe__synth_instruction_sample() argument
366 struct arm_spe *spe = speq->spe; in arm_spe__synth_instruction_sample()
367 struct arm_spe_record *record = &speq->decoder->record; in arm_spe__synth_instruction_sample()
368 union perf_event *event = speq->event_buf; in arm_spe__synth_instruction_sample()
374 speq->period_instructions++; in arm_spe__synth_instruction_sample()
375 if (speq->period_instructions < spe->instructions_sample_period) in arm_spe__synth_instruction_sample()
377 speq->period_instructions = 0; in arm_spe__synth_instruction_sample()
379 arm_spe_prep_sample(spe, speq, event, &sample); in arm_spe__synth_instruction_sample()
389 return arm_spe_deliver_synth_event(spe, speq, event, &sample); in arm_spe__synth_instruction_sample()
527 static int arm_spe_sample(struct arm_spe_queue *speq) in arm_spe_sample() argument
529 const struct arm_spe_record *record = &speq->decoder->record; in arm_spe_sample()
530 struct arm_spe *spe = speq->spe; in arm_spe_sample()
538 err = arm_spe__synth_mem_sample(speq, spe->l1d_miss_id, in arm_spe_sample()
545 err = arm_spe__synth_mem_sample(speq, spe->l1d_access_id, in arm_spe_sample()
554 err = arm_spe__synth_mem_sample(speq, spe->llc_miss_id, in arm_spe_sample()
561 err = arm_spe__synth_mem_sample(speq, spe->llc_access_id, in arm_spe_sample()
570 err = arm_spe__synth_mem_sample(speq, spe->tlb_miss_id, in arm_spe_sample()
577 err = arm_spe__synth_mem_sample(speq, spe->tlb_access_id, in arm_spe_sample()
585 err = arm_spe__synth_branch_sample(speq, spe->branch_miss_id); in arm_spe_sample()
592 err = arm_spe__synth_mem_sample(speq, spe->remote_access_id, in arm_spe_sample()
603 err = arm_spe__synth_mem_sample(speq, spe->memory_id, data_src); in arm_spe_sample()
609 err = arm_spe__synth_instruction_sample(speq, spe->instructions_id, data_src); in arm_spe_sample()
617 static int arm_spe_run_decoder(struct arm_spe_queue *speq, u64 *timestamp) in arm_spe_run_decoder() argument
619 struct arm_spe *spe = speq->spe; in arm_spe_run_decoder()
650 record = &speq->decoder->record; in arm_spe_run_decoder()
652 ret = arm_spe_set_tid(speq, record->context_id); in arm_spe_run_decoder()
659 ret = arm_spe_sample(speq); in arm_spe_run_decoder()
663 ret = arm_spe_decode(speq->decoder); in arm_spe_run_decoder()
676 record = &speq->decoder->record; in arm_spe_run_decoder()
679 if (record->timestamp > speq->timestamp) in arm_spe_run_decoder()
680 speq->timestamp = record->timestamp; in arm_spe_run_decoder()
687 if (!spe->timeless_decoding && speq->timestamp >= *timestamp) { in arm_spe_run_decoder()
688 *timestamp = speq->timestamp; in arm_spe_run_decoder()
700 struct arm_spe_queue *speq = queue->priv; in arm_spe__setup_queue() local
703 if (list_empty(&queue->head) || speq) in arm_spe__setup_queue()
706 speq = arm_spe__alloc_queue(spe, queue_nr); in arm_spe__setup_queue()
708 if (!speq) in arm_spe__setup_queue()
711 queue->priv = speq; in arm_spe__setup_queue()
714 speq->cpu = queue->cpu; in arm_spe__setup_queue()
716 if (!speq->on_heap) { in arm_spe__setup_queue()
723 ret = arm_spe_decode(speq->decoder); in arm_spe__setup_queue()
731 record = &speq->decoder->record; in arm_spe__setup_queue()
733 speq->timestamp = record->timestamp; in arm_spe__setup_queue()
734 ret = auxtrace_heap__add(&spe->heap, queue_nr, speq->timestamp); in arm_spe__setup_queue()
737 speq->on_heap = true; in arm_spe__setup_queue()
793 struct arm_spe_queue *speq; in arm_spe_process_queues() local
803 speq = queue->priv; in arm_spe_process_queues()
822 ret = arm_spe_run_decoder(speq, &ts); in arm_spe_process_queues()
833 speq->on_heap = false; in arm_spe_process_queues()
849 struct arm_spe_queue *speq = queue->priv; in arm_spe_process_timeless_queues() local
851 if (speq && (tid == -1 || speq->tid == tid)) { in arm_spe_process_timeless_queues()
852 speq->time = time_; in arm_spe_process_timeless_queues()
854 arm_spe_run_decoder(speq, &ts); in arm_spe_process_timeless_queues()
1001 struct arm_spe_queue *speq = priv; in arm_spe_free_queue() local
1003 if (!speq) in arm_spe_free_queue()
1005 thread__zput(speq->thread); in arm_spe_free_queue()
1006 arm_spe_decoder_free(speq->decoder); in arm_spe_free_queue()
1007 zfree(&speq->event_buf); in arm_spe_free_queue()
1008 free(speq); in arm_spe_free_queue()