tools/perf/trace/beauty/perf_event_open.c
Source file repositories/reference/linux-study-clean/tools/perf/trace/beauty/perf_event_open.c
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/trace/beauty/perf_event_open.c- Extension
.c- Size
- 2718 bytes
- Lines
- 95
- 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
- No C-style include directives detected by the generator.
Detected Declarations
struct attr_fprintf_argsfunction syscall_arg__scnprintf_perf_flagsfunction attr__fprintffunction perf_event_attr___scnprintffunction syscall_arg__scnprintf_augmented_perf_event_attrfunction syscall_arg__scnprintf_perf_event_attr
Annotated Snippet
struct attr_fprintf_args {
size_t size, printed;
char *bf;
bool first;
};
static int attr__fprintf(FILE *fp __maybe_unused, const char *name, const char *val, void *priv)
{
struct attr_fprintf_args *args = priv;
size_t printed = scnprintf(args->bf + args->printed , args->size - args->printed, "%s%s: %s", args->first ? "" : ", ", name, val);
args->first = false;
args->printed += printed;
return printed;
}
static size_t perf_event_attr___scnprintf(struct perf_event_attr *attr, char *bf, size_t size, bool show_zeros __maybe_unused)
{
struct attr_fprintf_args args = {
.printed = scnprintf(bf, size, "{ "),
.size = size,
.first = true,
.bf = bf,
};
perf_event_attr__fprintf(stdout, attr, attr__fprintf, &args);
return args.printed + scnprintf(bf + args.printed, size - args.printed, " }");
}
static size_t syscall_arg__scnprintf_augmented_perf_event_attr(struct syscall_arg *arg, char *bf, size_t size)
{
return perf_event_attr___scnprintf((void *)arg->augmented.args->value, bf, size, arg->trace->show_zeros);
}
static size_t syscall_arg__scnprintf_perf_event_attr(char *bf, size_t size, struct syscall_arg *arg)
{
if (arg->augmented.args)
return syscall_arg__scnprintf_augmented_perf_event_attr(arg, bf, size);
return scnprintf(bf, size, "%#lx", arg->val);
}
#define SCA_PERF_ATTR syscall_arg__scnprintf_perf_event_attr
// 'argname' is just documentational at this point, to remove the previous comment with that info
#define SCA_PERF_ATTR_FROM_USER(argname) \
{ .scnprintf = SCA_PERF_ATTR, \
.from_user = true, }
Annotation
- Detected declarations: `struct attr_fprintf_args`, `function syscall_arg__scnprintf_perf_flags`, `function attr__fprintf`, `function perf_event_attr___scnprintf`, `function syscall_arg__scnprintf_augmented_perf_event_attr`, `function syscall_arg__scnprintf_perf_event_attr`.
- 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.