tools/perf/util/tool.c
Source file repositories/reference/linux-study-clean/tools/perf/util/tool.c
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/util/tool.c- Extension
.c- Size
- 16688 bytes
- Lines
- 520
- 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
data.hdebug.hevent.hheader.hsession.hstat.htool.htsc.hlinux/compiler.hsys/mman.hstddef.hunistd.h
Detected Declarations
function perf_session__process_compressed_eventfunction process_event_synth_tracing_data_stubfunction process_event_synth_attr_stubfunction process_event_synth_event_update_stubfunction process_event_sample_stubfunction process_event_stubfunction process_finished_round_stubfunction skipnfunction process_event_auxtrace_stubfunction process_event_op2_stubfunction process_event_thread_map_stubfunction process_event_cpu_map_stubfunction process_event_stat_config_stubfunction process_stat_stubfunction process_stat_round_stubfunction process_event_time_conv_stubfunction perf_session__process_compressed_event_stubfunction perf_event__process_bpf_metadata_stubfunction process_schedstat_cpu_stubfunction process_schedstat_domain_stubfunction perf_tool__initfunction perf_tool__compressed_is_stubfunction delegate_tool__init
Annotated Snippet
tool->context_switch = perf_event__process_switch;
tool->ksymbol = perf_event__process_ksymbol;
tool->bpf = perf_event__process_bpf;
tool->text_poke = perf_event__process_text_poke;
tool->aux_output_hw_id = perf_event__process_aux_output_hw_id;
tool->read = process_event_sample_stub;
tool->throttle = process_event_stub;
tool->unthrottle = process_event_stub;
tool->callchain_deferred = process_event_sample_stub;
tool->attr = process_event_synth_attr_stub;
tool->event_update = process_event_synth_event_update_stub;
tool->tracing_data = process_event_synth_tracing_data_stub;
tool->build_id = process_event_op2_stub;
if (ordered_events)
tool->finished_round = perf_event__process_finished_round;
else
tool->finished_round = process_finished_round_stub;
tool->id_index = process_event_op2_stub;
tool->auxtrace_info = process_event_op2_stub;
tool->auxtrace = process_event_auxtrace_stub;
tool->auxtrace_error = process_event_op2_stub;
tool->thread_map = process_event_thread_map_stub;
tool->cpu_map = process_event_cpu_map_stub;
tool->stat_config = process_event_stat_config_stub;
tool->stat = process_stat_stub;
tool->stat_round = process_stat_round_stub;
tool->time_conv = process_event_time_conv_stub;
tool->feature = process_event_op2_stub;
#ifdef HAVE_ZSTD_SUPPORT
tool->compressed = perf_session__process_compressed_event;
#else
tool->compressed = perf_session__process_compressed_event_stub;
#endif
tool->finished_init = process_event_op2_stub;
tool->bpf_metadata = perf_event__process_bpf_metadata_stub;
tool->schedstat_cpu = process_schedstat_cpu_stub;
tool->schedstat_domain = process_schedstat_domain_stub;
}
bool perf_tool__compressed_is_stub(const struct perf_tool *tool)
{
return tool->compressed == perf_session__process_compressed_event_stub;
}
#define CREATE_DELEGATE_SAMPLE(name) \
static int delegate_ ## name(const struct perf_tool *tool, \
union perf_event *event, \
struct perf_sample *sample, \
struct evsel *evsel, \
struct machine *machine) \
{ \
struct delegate_tool *del_tool = container_of(tool, struct delegate_tool, tool); \
struct perf_tool *delegate = del_tool->delegate; \
return delegate->name(delegate, event, sample, evsel, machine); \
}
CREATE_DELEGATE_SAMPLE(read);
CREATE_DELEGATE_SAMPLE(sample);
CREATE_DELEGATE_SAMPLE(callchain_deferred);
#define CREATE_DELEGATE_ATTR(name) \
static int delegate_ ## name(const struct perf_tool *tool, \
union perf_event *event, \
struct evlist **pevlist) \
{ \
struct delegate_tool *del_tool = container_of(tool, struct delegate_tool, tool); \
struct perf_tool *delegate = del_tool->delegate; \
return delegate->name(delegate, event, pevlist); \
}
CREATE_DELEGATE_ATTR(attr);
CREATE_DELEGATE_ATTR(event_update);
#define CREATE_DELEGATE_OE(name) \
static int delegate_ ## name(const struct perf_tool *tool, \
union perf_event *event, \
struct ordered_events *oe) \
{ \
struct delegate_tool *del_tool = container_of(tool, struct delegate_tool, tool); \
struct perf_tool *delegate = del_tool->delegate; \
return delegate->name(delegate, event, oe); \
}
CREATE_DELEGATE_OE(finished_round);
#define CREATE_DELEGATE_OP(name) \
static int delegate_ ## name(const struct perf_tool *tool, \
union perf_event *event, \
struct perf_sample *sample, \
struct machine *machine) \
{ \
Annotation
- Immediate include surface: `data.h`, `debug.h`, `event.h`, `header.h`, `session.h`, `stat.h`, `tool.h`, `tsc.h`.
- Detected declarations: `function perf_session__process_compressed_event`, `function process_event_synth_tracing_data_stub`, `function process_event_synth_attr_stub`, `function process_event_synth_event_update_stub`, `function process_event_sample_stub`, `function process_event_stub`, `function process_finished_round_stub`, `function skipn`, `function process_event_auxtrace_stub`, `function process_event_op2_stub`.
- 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.