tools/perf/util/kwork.h

Source file repositories/reference/linux-study-clean/tools/perf/util/kwork.h

File Facts

System
Linux kernel
Corpus path
tools/perf/util/kwork.h
Extension
.h
Size
8934 bytes
Lines
318
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

struct kwork_atom {
	struct list_head list;
	u64 time;
	struct kwork_atom *prev;

	void *page_addr;
	unsigned long bit_inpage;
};

#define NR_ATOM_PER_PAGE 128
struct kwork_atom_page {
	struct list_head list;
	struct kwork_atom atoms[NR_ATOM_PER_PAGE];
	DECLARE_BITMAP(bitmap, NR_ATOM_PER_PAGE);
};

struct perf_kwork;
struct kwork_class;
struct kwork_work {
	/*
	 * class field
	 */
	struct rb_node node;
	struct kwork_class *class;

	/*
	 * work field
	 */
	u64 id;
	int cpu;
	char *name;

	/*
	 * atom field
	 */
	u64 nr_atoms;
	struct list_head atom_list[KWORK_TRACE_MAX];

	/*
	 * runtime report
	 */
	u64 max_runtime;
	u64 max_runtime_start;
	u64 max_runtime_end;
	u64 total_runtime;

	/*
	 * latency report
	 */
	u64 max_latency;
	u64 max_latency_start;
	u64 max_latency_end;
	u64 total_latency;

	/*
	 * top report
	 */
	u32 cpu_usage;
	u32 tgid;
	bool is_kthread;
};

struct kwork_class {
	struct list_head list;
	const char *name;
	enum kwork_class_type type;

	unsigned int nr_tracepoints;
	const struct evsel_str_handler *tp_handlers;

	struct rb_root_cached work_root;

	int (*class_init)(struct kwork_class *class,
			  struct perf_session *session);

	void (*work_init)(struct perf_kwork *kwork,
			  struct kwork_class *class,
			  struct kwork_work *work,
			  enum kwork_trace_type src_type,
			  struct evsel *evsel,
			  struct perf_sample *sample,
			  struct machine *machine);

	void (*work_name)(struct kwork_work *work,
			  char *buf, int len);
};

struct trace_kwork_handler {
	int (*raise_event)(struct perf_kwork *kwork,
			   struct kwork_class *class, struct evsel *evsel,

Annotation

Implementation Notes