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.

Dependency Surface

Detected Declarations

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

Implementation Notes