btsq 151 tools/perf/util/intel-bts.c struct intel_bts_queue *btsq; btsq 153 tools/perf/util/intel-bts.c btsq = zalloc(sizeof(struct intel_bts_queue)); btsq 154 tools/perf/util/intel-bts.c if (!btsq) btsq 157 tools/perf/util/intel-bts.c btsq->bts = bts; btsq 158 tools/perf/util/intel-bts.c btsq->queue_nr = queue_nr; btsq 159 tools/perf/util/intel-bts.c btsq->pid = -1; btsq 160 tools/perf/util/intel-bts.c btsq->tid = -1; btsq 161 tools/perf/util/intel-bts.c btsq->cpu = -1; btsq 163 tools/perf/util/intel-bts.c return btsq; btsq 170 tools/perf/util/intel-bts.c struct intel_bts_queue *btsq = queue->priv; btsq 175 tools/perf/util/intel-bts.c if (!btsq) { btsq 176 tools/perf/util/intel-bts.c btsq = intel_bts_alloc_queue(bts, queue_nr); btsq 177 tools/perf/util/intel-bts.c if (!btsq) btsq 179 tools/perf/util/intel-bts.c queue->priv = btsq; btsq 182 tools/perf/util/intel-bts.c btsq->cpu = queue->cpu; btsq 183 tools/perf/util/intel-bts.c btsq->tid = queue->tid; btsq 189 tools/perf/util/intel-bts.c if (!btsq->on_heap && !btsq->buffer) { btsq 192 tools/perf/util/intel-bts.c btsq->buffer = auxtrace_buffer__next(queue, NULL); btsq 193 tools/perf/util/intel-bts.c if (!btsq->buffer) btsq 197 tools/perf/util/intel-bts.c btsq->buffer->reference); btsq 200 tools/perf/util/intel-bts.c btsq->on_heap = true; btsq 272 tools/perf/util/intel-bts.c static int intel_bts_synth_branch_sample(struct intel_bts_queue *btsq, btsq 276 tools/perf/util/intel-bts.c struct intel_bts *bts = btsq->bts; btsq 286 tools/perf/util/intel-bts.c sample.pid = btsq->pid; btsq 287 tools/perf/util/intel-bts.c sample.tid = btsq->tid; btsq 289 tools/perf/util/intel-bts.c sample.id = btsq->bts->branches_id; btsq 290 tools/perf/util/intel-bts.c sample.stream_id = btsq->bts->branches_id; btsq 292 tools/perf/util/intel-bts.c sample.cpu = btsq->cpu; btsq 293 tools/perf/util/intel-bts.c sample.flags = btsq->sample_flags; btsq 294 tools/perf/util/intel-bts.c sample.insn_len = btsq->intel_pt_insn.length; btsq 295 tools/perf/util/intel-bts.c memcpy(sample.insn, btsq->intel_pt_insn.buf, INTEL_PT_INSN_BUF_SZ); btsq 318 tools/perf/util/intel-bts.c static int intel_bts_get_next_insn(struct intel_bts_queue *btsq, u64 ip) btsq 320 tools/perf/util/intel-bts.c struct machine *machine = btsq->bts->machine; btsq 327 tools/perf/util/intel-bts.c thread = machine__find_thread(machine, -1, btsq->tid); btsq 335 tools/perf/util/intel-bts.c if (intel_pt_get_insn(buf, len, x86_64, &btsq->intel_pt_insn)) btsq 362 tools/perf/util/intel-bts.c static int intel_bts_get_branch_type(struct intel_bts_queue *btsq, btsq 369 tools/perf/util/intel-bts.c btsq->sample_flags = PERF_IP_FLAG_BRANCH | btsq 372 tools/perf/util/intel-bts.c btsq->sample_flags = 0; btsq 373 tools/perf/util/intel-bts.c btsq->intel_pt_insn.length = 0; btsq 375 tools/perf/util/intel-bts.c btsq->sample_flags = PERF_IP_FLAG_BRANCH | btsq 377 tools/perf/util/intel-bts.c btsq->intel_pt_insn.length = 0; btsq 379 tools/perf/util/intel-bts.c err = intel_bts_get_next_insn(btsq, branch->from); btsq 381 tools/perf/util/intel-bts.c btsq->sample_flags = 0; btsq 382 tools/perf/util/intel-bts.c btsq->intel_pt_insn.length = 0; btsq 383 tools/perf/util/intel-bts.c if (!btsq->bts->synth_opts.errors) btsq 385 tools/perf/util/intel-bts.c err = intel_bts_synth_error(btsq->bts, btsq->cpu, btsq 386 tools/perf/util/intel-bts.c btsq->pid, btsq->tid, btsq 390 tools/perf/util/intel-bts.c btsq->sample_flags = intel_pt_insn_type(btsq->intel_pt_insn.op); btsq 392 tools/perf/util/intel-bts.c if (!machine__kernel_ip(btsq->bts->machine, branch->from) && btsq 393 tools/perf/util/intel-bts.c machine__kernel_ip(btsq->bts->machine, branch->to) && btsq 394 tools/perf/util/intel-bts.c btsq->sample_flags != (PERF_IP_FLAG_BRANCH | btsq 397 tools/perf/util/intel-bts.c btsq->sample_flags = PERF_IP_FLAG_BRANCH | btsq 406 tools/perf/util/intel-bts.c static int intel_bts_process_buffer(struct intel_bts_queue *btsq, btsq 412 tools/perf/util/intel-bts.c u32 filter = btsq->bts->branches_filter; btsq 423 tools/perf/util/intel-bts.c if (!btsq->bts->sample_branches) btsq 429 tools/perf/util/intel-bts.c intel_bts_get_branch_type(btsq, branch); btsq 430 tools/perf/util/intel-bts.c if (btsq->bts->synth_opts.thread_stack) btsq 431 tools/perf/util/intel-bts.c thread_stack__event(thread, btsq->cpu, btsq->sample_flags, btsq 434 tools/perf/util/intel-bts.c btsq->intel_pt_insn.length, btsq 436 tools/perf/util/intel-bts.c if (filter && !(filter & btsq->sample_flags)) btsq 438 tools/perf/util/intel-bts.c err = intel_bts_synth_branch_sample(btsq, branch); btsq 445 tools/perf/util/intel-bts.c static int intel_bts_process_queue(struct intel_bts_queue *btsq, u64 *timestamp) btsq 447 tools/perf/util/intel-bts.c struct auxtrace_buffer *buffer = btsq->buffer, *old_buffer = buffer; btsq 452 tools/perf/util/intel-bts.c if (btsq->done) btsq 455 tools/perf/util/intel-bts.c if (btsq->pid == -1) { btsq 456 tools/perf/util/intel-bts.c thread = machine__find_thread(btsq->bts->machine, -1, btsq 457 tools/perf/util/intel-bts.c btsq->tid); btsq 459 tools/perf/util/intel-bts.c btsq->pid = thread->pid_; btsq 461 tools/perf/util/intel-bts.c thread = machine__findnew_thread(btsq->bts->machine, btsq->pid, btsq 462 tools/perf/util/intel-bts.c btsq->tid); btsq 465 tools/perf/util/intel-bts.c queue = &btsq->bts->queues.queue_array[btsq->queue_nr]; btsq 471 tools/perf/util/intel-bts.c if (!btsq->bts->sampling_mode) btsq 472 tools/perf/util/intel-bts.c btsq->done = 1; btsq 484 tools/perf/util/intel-bts.c int fd = perf_data__fd(btsq->bts->session->data); btsq 493 tools/perf/util/intel-bts.c if (btsq->bts->snapshot_mode && !buffer->consecutive && btsq 499 tools/perf/util/intel-bts.c if (!btsq->bts->synth_opts.callchain && btsq 500 tools/perf/util/intel-bts.c !btsq->bts->synth_opts.thread_stack && thread && btsq 501 tools/perf/util/intel-bts.c (!old_buffer || btsq->bts->sampling_mode || btsq 502 tools/perf/util/intel-bts.c (btsq->bts->snapshot_mode && !buffer->consecutive))) btsq 503 tools/perf/util/intel-bts.c thread_stack__set_trace_nr(thread, btsq->cpu, buffer->buffer_nr + 1); btsq 505 tools/perf/util/intel-bts.c err = intel_bts_process_buffer(btsq, buffer, thread); btsq 509 tools/perf/util/intel-bts.c btsq->buffer = auxtrace_buffer__next(queue, buffer); btsq 510 tools/perf/util/intel-bts.c if (btsq->buffer) { btsq 512 tools/perf/util/intel-bts.c *timestamp = btsq->buffer->reference; btsq 514 tools/perf/util/intel-bts.c if (!btsq->bts->sampling_mode) btsq 515 tools/perf/util/intel-bts.c btsq->done = 1; btsq 522 tools/perf/util/intel-bts.c static int intel_bts_flush_queue(struct intel_bts_queue *btsq) btsq 528 tools/perf/util/intel-bts.c ret = intel_bts_process_queue(btsq, &ts); btsq 544 tools/perf/util/intel-bts.c struct intel_bts_queue *btsq = queue->priv; btsq 546 tools/perf/util/intel-bts.c if (btsq && btsq->tid == tid) btsq 547 tools/perf/util/intel-bts.c return intel_bts_flush_queue(btsq); btsq 557 tools/perf/util/intel-bts.c struct intel_bts_queue *btsq; btsq 569 tools/perf/util/intel-bts.c btsq = queue->priv; btsq 573 tools/perf/util/intel-bts.c ret = intel_bts_process_queue(btsq, &ts); btsq 584 tools/perf/util/intel-bts.c btsq->on_heap = false; btsq 699 tools/perf/util/intel-bts.c struct intel_bts_queue *btsq = priv; btsq 701 tools/perf/util/intel-bts.c if (!btsq) btsq 703 tools/perf/util/intel-bts.c free(btsq);