tools/perf/util/config.c
Source file repositories/reference/linux-study-clean/tools/perf/util/config.c
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/util/config.c- Extension
.c- Size
- 20311 bytes
- Lines
- 992
- 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
errno.hsys/param.hcache.hcallchain.hheader.hsubcmd/exec-cmd.hutil/event.hutil/hist.hutil/stat.hutil/evsel.hsrcline.hbuild-id.hdebug.hconfig.hsys/types.hsys/stat.hstdlib.hunistd.hlinux/string.hlinux/zalloc.hlinux/ctype.h
Detected Declarations
struct perf_config_scan_datafunction get_next_charfunction iskeycharfunction get_valuefunction get_extended_base_varfunction get_base_varfunction perf_parse_filefunction parse_unit_factorfunction perf_parse_llongfunction perf_parse_longfunction bad_configfunction perf_config_u64function perf_config_intfunction perf_config_u8function perf_config_bool_or_intfunction perf_config_boolfunction perf_buildid_configfunction perf_default_core_configfunction perf_ui_configfunction perf_stat__set_big_numfunction perf_stat__set_no_csv_summaryfunction perf_stat_configfunction perf_default_configfunction perf_config_from_filefunction perf_env_boolfunction perf_config_systemfunction perf_config_globalfunction set_valuefunction collect_configfunction perf_config_set__collectfunction perf_config_set__initfunction perf_config__initfunction perf_config_setfunction perf_config_set__for_each_entryfunction perf_configfunction perf_config__exitfunction perf_config_item__deletefunction perf_config_section__purgefunction list_for_each_entry_safefunction perf_config_section__deletefunction perf_config_set__purgefunction list_for_each_entry_safefunction perf_config_set__deletefunction valuefunction set_buildid_dirfunction perf_config_scan_cbfunction perf_config_scanfunction perf_config_get_cb
Annotated Snippet
struct perf_config_scan_data {
const char *name;
const char *fmt;
const char *value;
va_list args;
int ret;
};
static int perf_config_scan_cb(const char *var, const char *value, void *data)
{
struct perf_config_scan_data *d = data;
if (!strcmp(var, d->name))
d->ret = vsscanf(value, d->fmt, d->args);
return 0;
}
int perf_config_scan(const char *name, const char *fmt, ...)
{
struct perf_config_scan_data d = {
.name = name,
.fmt = fmt,
};
va_start(d.args, fmt);
perf_config(perf_config_scan_cb, &d);
va_end(d.args);
return d.ret;
}
static int perf_config_get_cb(const char *var, const char *value, void *data)
{
struct perf_config_scan_data *d = data;
if (!strcmp(var, d->name))
d->value = value;
return 0;
}
const char *perf_config_get(const char *name)
{
struct perf_config_scan_data d = {
.name = name,
.value = NULL,
};
perf_config(perf_config_get_cb, &d);
return d.value;
}
Annotation
- Immediate include surface: `errno.h`, `sys/param.h`, `cache.h`, `callchain.h`, `header.h`, `subcmd/exec-cmd.h`, `util/event.h`, `util/hist.h`.
- Detected declarations: `struct perf_config_scan_data`, `function get_next_char`, `function iskeychar`, `function get_value`, `function get_extended_base_var`, `function get_base_var`, `function perf_parse_file`, `function parse_unit_factor`, `function perf_parse_llong`, `function perf_parse_long`.
- 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.