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.
- 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
perf.hutil/tool.hutil/time-utils.hlinux/bitmap.hlinux/list.hlinux/rbtree.hlinux/types.h
Detected Declarations
struct perf_samplestruct perf_sessionstruct kwork_atomstruct kwork_atom_pagestruct perf_kworkstruct kwork_classstruct kwork_workstruct kwork_classstruct trace_kwork_handlerstruct __top_cpus_runtimestruct kwork_top_statstruct perf_kworkenum kwork_class_typeenum kwork_report_typeenum kwork_trace_typefunction perf_kwork__trace_prepare_bpffunction perf_kwork__report_read_bpffunction perf_kwork__report_cleanup_bpffunction perf_kwork__top_read_bpffunction perf_kwork__top_cleanup_bpf
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
- Immediate include surface: `perf.h`, `util/tool.h`, `util/time-utils.h`, `linux/bitmap.h`, `linux/list.h`, `linux/rbtree.h`, `linux/types.h`.
- Detected declarations: `struct perf_sample`, `struct perf_session`, `struct kwork_atom`, `struct kwork_atom_page`, `struct perf_kwork`, `struct kwork_class`, `struct kwork_work`, `struct kwork_class`, `struct trace_kwork_handler`, `struct __top_cpus_runtime`.
- 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.