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 = thread__pid(speq->thread); in arm_spe_set_pid_tid_cpu()
259 speq->cpu = thread__cpu(speq->thread); 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()
296 struct arm_spe_queue *speq, in arm_spe_prep_sample() argument
300 struct arm_spe_record *record = &speq->decoder->record; in arm_spe_prep_sample()
307 sample->pid = speq->pid; in arm_spe_prep_sample()
308 sample->tid = speq->tid; in arm_spe_prep_sample()
310 sample->cpu = speq->cpu; in arm_spe_prep_sample()
326 struct arm_spe_queue *speq __maybe_unused, in arm_spe_deliver_synth_event()
345 static int arm_spe__synth_mem_sample(struct arm_spe_queue *speq, in arm_spe__synth_mem_sample() argument
348 struct arm_spe *spe = speq->spe; in arm_spe__synth_mem_sample()
349 struct arm_spe_record *record = &speq->decoder->record; in arm_spe__synth_mem_sample()
350 union perf_event *event = speq->event_buf; in arm_spe__synth_mem_sample()
353 arm_spe_prep_sample(spe, speq, event, &sample); in arm_spe__synth_mem_sample()
362 return arm_spe_deliver_synth_event(spe, speq, event, &sample); in arm_spe__synth_mem_sample()
365 static int arm_spe__synth_branch_sample(struct arm_spe_queue *speq, in arm_spe__synth_branch_sample() argument
368 struct arm_spe *spe = speq->spe; in arm_spe__synth_branch_sample()
369 struct arm_spe_record *record = &speq->decoder->record; in arm_spe__synth_branch_sample()
370 union perf_event *event = speq->event_buf; in arm_spe__synth_branch_sample()
373 arm_spe_prep_sample(spe, speq, event, &sample); in arm_spe__synth_branch_sample()
380 return arm_spe_deliver_synth_event(spe, speq, event, &sample); in arm_spe__synth_branch_sample()
383 static int arm_spe__synth_instruction_sample(struct arm_spe_queue *speq, in arm_spe__synth_instruction_sample() argument
386 struct arm_spe *spe = speq->spe; in arm_spe__synth_instruction_sample()
387 struct arm_spe_record *record = &speq->decoder->record; in arm_spe__synth_instruction_sample()
388 union perf_event *event = speq->event_buf; in arm_spe__synth_instruction_sample()
394 speq->period_instructions++; in arm_spe__synth_instruction_sample()
395 if (speq->period_instructions < spe->instructions_sample_period) in arm_spe__synth_instruction_sample()
397 speq->period_instructions = 0; in arm_spe__synth_instruction_sample()
399 arm_spe_prep_sample(spe, speq, event, &sample); in arm_spe__synth_instruction_sample()
409 return arm_spe_deliver_synth_event(spe, speq, event, &sample); in arm_spe__synth_instruction_sample()
547 static int arm_spe_sample(struct arm_spe_queue *speq) in arm_spe_sample() argument
549 const struct arm_spe_record *record = &speq->decoder->record; in arm_spe_sample()
550 struct arm_spe *spe = speq->spe; in arm_spe_sample()
558 err = arm_spe__synth_mem_sample(speq, spe->l1d_miss_id, in arm_spe_sample()
565 err = arm_spe__synth_mem_sample(speq, spe->l1d_access_id, in arm_spe_sample()
574 err = arm_spe__synth_mem_sample(speq, spe->llc_miss_id, in arm_spe_sample()
581 err = arm_spe__synth_mem_sample(speq, spe->llc_access_id, in arm_spe_sample()
590 err = arm_spe__synth_mem_sample(speq, spe->tlb_miss_id, in arm_spe_sample()
597 err = arm_spe__synth_mem_sample(speq, spe->tlb_access_id, in arm_spe_sample()
605 err = arm_spe__synth_branch_sample(speq, spe->branch_miss_id); in arm_spe_sample()
612 err = arm_spe__synth_mem_sample(speq, spe->remote_access_id, in arm_spe_sample()
623 err = arm_spe__synth_mem_sample(speq, spe->memory_id, data_src); in arm_spe_sample()
629 err = arm_spe__synth_instruction_sample(speq, spe->instructions_id, data_src); in arm_spe_sample()
637 static int arm_spe_run_decoder(struct arm_spe_queue *speq, u64 *timestamp) in arm_spe_run_decoder() argument
639 struct arm_spe *spe = speq->spe; in arm_spe_run_decoder()
670 record = &speq->decoder->record; in arm_spe_run_decoder()
672 ret = arm_spe_set_tid(speq, record->context_id); in arm_spe_run_decoder()
679 ret = arm_spe_sample(speq); in arm_spe_run_decoder()
683 ret = arm_spe_decode(speq->decoder); in arm_spe_run_decoder()
696 record = &speq->decoder->record; in arm_spe_run_decoder()
699 if (record->timestamp > speq->timestamp) in arm_spe_run_decoder()
700 speq->timestamp = record->timestamp; in arm_spe_run_decoder()
707 if (!spe->timeless_decoding && speq->timestamp >= *timestamp) { in arm_spe_run_decoder()
708 *timestamp = speq->timestamp; in arm_spe_run_decoder()
720 struct arm_spe_queue *speq = queue->priv; in arm_spe__setup_queue() local
723 if (list_empty(&queue->head) || speq) in arm_spe__setup_queue()
726 speq = arm_spe__alloc_queue(spe, queue_nr); in arm_spe__setup_queue()
728 if (!speq) in arm_spe__setup_queue()
731 queue->priv = speq; in arm_spe__setup_queue()
734 speq->cpu = queue->cpu; in arm_spe__setup_queue()
736 if (!speq->on_heap) { in arm_spe__setup_queue()
743 ret = arm_spe_decode(speq->decoder); in arm_spe__setup_queue()
751 record = &speq->decoder->record; in arm_spe__setup_queue()
753 speq->timestamp = record->timestamp; in arm_spe__setup_queue()
754 ret = auxtrace_heap__add(&spe->heap, queue_nr, speq->timestamp); in arm_spe__setup_queue()
757 speq->on_heap = true; in arm_spe__setup_queue()
813 struct arm_spe_queue *speq; in arm_spe_process_queues() local
823 speq = queue->priv; in arm_spe_process_queues()
842 ret = arm_spe_run_decoder(speq, &ts); in arm_spe_process_queues()
853 speq->on_heap = false; in arm_spe_process_queues()
869 struct arm_spe_queue *speq = queue->priv; in arm_spe_process_timeless_queues() local
871 if (speq && (tid == -1 || speq->tid == tid)) { in arm_spe_process_timeless_queues()
872 speq->time = time_; in arm_spe_process_timeless_queues()
874 arm_spe_run_decoder(speq, &ts); in arm_spe_process_timeless_queues()
1021 struct arm_spe_queue *speq = priv; in arm_spe_free_queue() local
1023 if (!speq) in arm_spe_free_queue()
1025 thread__zput(speq->thread); in arm_spe_free_queue()
1026 arm_spe_decoder_free(speq->decoder); in arm_spe_free_queue()
1027 zfree(&speq->event_buf); in arm_spe_free_queue()
1028 free(speq); in arm_spe_free_queue()