tools/perf/arch/x86/util/iostat.c
Source file repositories/reference/linux-study-clean/tools/perf/arch/x86/util/iostat.c
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/arch/x86/util/iostat.c- Extension
.c- Size
- 11302 bytes
- Lines
- 476
- 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
api/fs/fs.hlinux/kernel.hlinux/err.hlinux/zalloc.hlimits.hstdio.hstring.herrno.hsys/types.hsys/stat.hfcntl.hdirent.hunistd.hstdlib.hregex.hutil/cpumap.hutil/debug.hutil/iostat.hutil/counts.hpath.h
Detected Declarations
struct iio_root_portstruct iio_root_ports_listfunction iostat_metrics_countfunction iio_root_port_showfunction iio_root_ports_list_freefunction iio_root_ports_list_insertfunction iio_mappingfunction iio_pmu_countfunction iio_root_ports_scanfunction iio_root_port_parse_strfunction iio_root_ports_list_filterfunction iostat_event_groupfunction evlist__for_each_entryfunction iostat_preparefunction iostat_parsefunction iostat_listfunction evlist__for_each_entryfunction iostat_releasefunction evlist__for_each_entryfunction iostat_prefixfunction iostat_print_header_prefixfunction iostat_print_metricfunction iostat_print_counters
Annotated Snippet
struct iio_root_port {
u32 domain;
u8 bus;
u8 die;
u8 pmu_idx;
int idx;
};
struct iio_root_ports_list {
struct iio_root_port **rps;
int nr_entries;
};
static struct iio_root_ports_list *root_ports;
static void iio_root_port_show(FILE *output,
const struct iio_root_port * const rp)
{
if (output && rp)
fprintf(output, "S%d-uncore_iio_%d<%04x:%02x>\n",
rp->die, rp->pmu_idx, rp->domain, rp->bus);
}
static struct iio_root_port *iio_root_port_new(u32 domain, u8 bus,
u8 die, u8 pmu_idx)
{
struct iio_root_port *p = calloc(1, sizeof(*p));
if (p) {
p->domain = domain;
p->bus = bus;
p->die = die;
p->pmu_idx = pmu_idx;
}
return p;
}
static void iio_root_ports_list_free(struct iio_root_ports_list *list)
{
int idx;
if (list) {
for (idx = 0; idx < list->nr_entries; idx++)
zfree(&list->rps[idx]);
zfree(&list->rps);
free(list);
}
}
static struct iio_root_port *iio_root_port_find_by_notation(
const struct iio_root_ports_list * const list, u32 domain, u8 bus)
{
int idx;
struct iio_root_port *rp;
if (list) {
for (idx = 0; idx < list->nr_entries; idx++) {
rp = list->rps[idx];
if (rp && rp->domain == domain && rp->bus == bus)
return rp;
}
}
return NULL;
}
static int iio_root_ports_list_insert(struct iio_root_ports_list *list,
struct iio_root_port * const rp)
{
struct iio_root_port **tmp_buf;
if (list && rp) {
rp->idx = list->nr_entries++;
tmp_buf = realloc(list->rps,
list->nr_entries * sizeof(*list->rps));
if (!tmp_buf) {
pr_err("Failed to realloc memory\n");
return -ENOMEM;
}
tmp_buf[rp->idx] = rp;
list->rps = tmp_buf;
}
return 0;
}
static int iio_mapping(u8 pmu_idx, struct iio_root_ports_list * const list)
{
char *buf;
char path[MAX_PATH];
u32 domain;
u8 bus;
Annotation
- Immediate include surface: `api/fs/fs.h`, `linux/kernel.h`, `linux/err.h`, `linux/zalloc.h`, `limits.h`, `stdio.h`, `string.h`, `errno.h`.
- Detected declarations: `struct iio_root_port`, `struct iio_root_ports_list`, `function iostat_metrics_count`, `function iio_root_port_show`, `function iio_root_ports_list_free`, `function iio_root_ports_list_insert`, `function iio_mapping`, `function iio_pmu_count`, `function iio_root_ports_scan`, `function iio_root_port_parse_str`.
- 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.