tools/perf/util/trace-event-parse.c
Source file repositories/reference/linux-study-clean/tools/perf/util/trace-event-parse.c
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/util/trace-event-parse.c- Extension
.c- Size
- 7058 bytes
- Lines
- 324
- 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
stdio.hstdlib.hstring.herrno.hdebug.htrace-event.hlinux/ctype.hlinux/kernel.hevent-parse.h
Detected Declarations
struct flagfunction Copyrightfunction common_lock_depthfunction common_flagsfunction common_pcfunction raw_field_valuefunction read_sizefunction event_format__fprintffunction find_arg_fieldfunction test_flagsfunction search_opfunction parse_ftrace_printkfunction parse_saved_cmdlinefunction parse_ftrace_filefunction parse_event_filefunction eval_flag
Annotated Snippet
struct flag {
const char *name;
unsigned long long value;
};
static const struct flag flags[] = {
{ "HI_SOFTIRQ", 0 },
{ "TIMER_SOFTIRQ", 1 },
{ "NET_TX_SOFTIRQ", 2 },
{ "NET_RX_SOFTIRQ", 3 },
{ "BLOCK_SOFTIRQ", 4 },
{ "IRQ_POLL_SOFTIRQ", 5 },
{ "TASKLET_SOFTIRQ", 6 },
{ "SCHED_SOFTIRQ", 7 },
{ "HRTIMER_SOFTIRQ", 8 },
{ "RCU_SOFTIRQ", 9 },
{ "HRTIMER_NORESTART", 0 },
{ "HRTIMER_RESTART", 1 },
};
unsigned long long eval_flag(const char *flag)
{
int i;
/*
* Some flags in the format files do not get converted.
* If the flag is not numeric, see if it is something that
* we already know about.
*/
if (isdigit(flag[0]))
return strtoull(flag, NULL, 0);
for (i = 0; i < (int)(ARRAY_SIZE(flags)); i++)
if (strcmp(flags[i].name, flag) == 0)
return flags[i].value;
return 0;
}
Annotation
- Immediate include surface: `stdio.h`, `stdlib.h`, `string.h`, `errno.h`, `debug.h`, `trace-event.h`, `linux/ctype.h`, `linux/kernel.h`.
- Detected declarations: `struct flag`, `function Copyright`, `function common_lock_depth`, `function common_flags`, `function common_pc`, `function raw_field_value`, `function read_size`, `function event_format__fprintf`, `function find_arg_field`, `function test_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.