tools/perf/util/arm-spe.c
Source file repositories/reference/linux-study-clean/tools/perf/util/arm-spe.c
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/util/arm-spe.c- Extension
.c- Size
- 53772 bytes
- Lines
- 2021
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
byteswap.hendian.herrno.hinttypes.hlinux/bitops.hlinux/kernel.hlinux/log2.hlinux/types.hlinux/zalloc.hstdlib.hunistd.hauxtrace.hcolor.hdebug.hevlist.hevsel.hmachine.hsession.hsymbol.hthread.hthread-stack.htsc.htool.hutil/synthetic-events.harm-spe.harm-spe-decoder/arm-spe-decoder.harm-spe-decoder/arm-spe-pkt-decoder.h../../arch/arm64/include/asm/cputype.h
Detected Declarations
struct arm_spestruct arm_spe_queuestruct data_source_handlefunction arm_spe_dumpfunction arm_spe_dump_eventfunction arm_spe_get_tracefunction arm_spe_cpumodefunction arm_spe_set_pid_tid_cpufunction arm_spe_set_tidfunction arm_spe__synth_simd_flagsfunction arm_spe_prep_samplefunction arm_spe__prep_branch_stackfunction linkfunction arm_spe__inject_eventfunction arm_spe_deliver_synth_eventfunction arm_spe__synth_mem_samplefunction arm_spe__synth_branch_samplefunction arm_spe__synth_instruction_samplefunction arm_spe__sample_flagsfunction arm_spe__synth_data_source_commonfunction commonfunction arm_spe__synth_data_source_hisi_hipfunction arm_spe__synth_ld_memory_levelfunction arm_spe__synth_st_memory_levelfunction arm_spe__synth_memory_levelfunction arm_spe__synth_dsfunction arm_spe__synth_data_sourcefunction arm_spe_samplefunction arm_spe_run_decoderfunction arm_spe__setup_queuefunction arm_spe__setup_queuesfunction arm_spe__update_queuesfunction arm_spe__is_timeless_decodingfunction arm_spe_process_queuesfunction arm_spe_process_timeless_queuesfunction arm_spe_context_switchfunction arm_spe_process_eventfunction arm_spe_process_auxtrace_eventfunction arm_spe_flushfunction arm_spe__free_metadatafunction arm_spe_free_queuefunction arm_spe_free_eventsfunction arm_spe_freefunction arm_spe_evsel_is_auxtracefunction arm_spe_print_infofunction arm_spe_set_event_namefunction evlist__for_each_entryfunction arm_spe_synth_events
Annotated Snippet
pid = event->context_switch.next_prev_pid;
tid = event->context_switch.next_prev_tid;
cpu = sample->cpu;
if (tid == -1)
pr_warning("context_switch event has no tid\n");
return machine__set_current_tid(spe->machine, cpu, pid, tid);
}
static int arm_spe_process_event(struct perf_session *session,
union perf_event *event,
struct perf_sample *sample,
const struct perf_tool *tool)
{
int err = 0;
u64 timestamp;
struct arm_spe *spe = container_of(session->auxtrace,
struct arm_spe, auxtrace);
if (dump_trace)
return 0;
if (!tool->ordered_events) {
pr_err("SPE trace requires ordered events\n");
return -EINVAL;
}
if (sample->time && (sample->time != (u64) -1))
timestamp = perf_time_to_tsc(sample->time, &spe->tc);
else
timestamp = 0;
if (timestamp || spe->timeless_decoding) {
err = arm_spe__update_queues(spe);
if (err)
return err;
}
if (spe->timeless_decoding) {
if (event->header.type == PERF_RECORD_EXIT) {
err = arm_spe_process_timeless_queues(spe,
event->fork.tid,
sample->time);
}
} else if (timestamp) {
err = arm_spe_process_queues(spe, timestamp);
if (err)
return err;
if (!spe->use_ctx_pkt_for_pid &&
(event->header.type == PERF_RECORD_SWITCH_CPU_WIDE ||
event->header.type == PERF_RECORD_SWITCH))
err = arm_spe_context_switch(spe, event, sample);
}
return err;
}
static int arm_spe_process_auxtrace_event(struct perf_session *session,
union perf_event *event,
const struct perf_tool *tool __maybe_unused)
{
struct arm_spe *spe = container_of(session->auxtrace, struct arm_spe,
auxtrace);
if (!spe->data_queued) {
struct auxtrace_buffer *buffer;
off_t data_offset;
int fd = perf_data__fd(session->data);
int err;
if (perf_data__is_pipe(session->data)) {
data_offset = 0;
} else {
data_offset = lseek(fd, 0, SEEK_CUR);
if (data_offset == -1)
return -errno;
}
err = auxtrace_queues__add_event(&spe->queues, session, event,
data_offset, &buffer);
if (err)
return err;
/* Dump here now we have copied a piped trace out of the pipe */
if (dump_trace) {
if (auxtrace_buffer__get_data(buffer, fd)) {
arm_spe_dump_event(spe, buffer->data,
buffer->size);
Annotation
- Immediate include surface: `byteswap.h`, `endian.h`, `errno.h`, `inttypes.h`, `linux/bitops.h`, `linux/kernel.h`, `linux/log2.h`, `linux/types.h`.
- Detected declarations: `struct arm_spe`, `struct arm_spe_queue`, `struct data_source_handle`, `function arm_spe_dump`, `function arm_spe_dump_event`, `function arm_spe_get_trace`, `function arm_spe_cpumode`, `function arm_spe_set_pid_tid_cpu`, `function arm_spe_set_tid`, `function arm_spe__synth_simd_flags`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.