tools/perf/arch/arm/util/auxtrace.c
Source file repositories/reference/linux-study-clean/tools/perf/arch/arm/util/auxtrace.c
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/arch/arm/util/auxtrace.c- Extension
.c- Size
- 4942 bytes
- Lines
- 221
- 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
dirent.herrno.hstdbool.hlinux/coresight-pmu.hstdlib.hapi/fs/fs.h../../../util/auxtrace.h../../../util/debug.h../../../util/evlist.h../../../util/pmu.h../../../util/pmus.hcs-etm.harm-spe.hhisi-ptt.h
Detected Declarations
function Copyrightfunction evlist__for_each_entryfunction compat_auxtrace_mmap__read_headfunction compat_auxtrace_mmap__write_tail
Annotated Snippet
if (ret < 0) {
pr_err("sprintf failed\n");
*err = -ENOMEM;
return NULL;
}
arm_spe_pmus[*nr_spes] = perf_pmus__find(arm_spe_pmu_name);
if (arm_spe_pmus[*nr_spes]) {
pr_debug2("%s %d: arm_spe_pmu %d type %d name %s\n",
__func__, __LINE__, *nr_spes,
arm_spe_pmus[*nr_spes]->type,
arm_spe_pmus[*nr_spes]->name);
(*nr_spes)++;
}
}
return arm_spe_pmus;
}
static struct perf_pmu **find_all_hisi_ptt_pmus(int *nr_ptts, int *err)
{
struct perf_pmu **hisi_ptt_pmus = NULL;
struct dirent *dent;
char path[PATH_MAX];
DIR *dir = NULL;
int idx = 0;
perf_pmu__event_source_devices_scnprintf(path, sizeof(path));
dir = opendir(path);
if (!dir) {
pr_err("can't read directory '%s'\n", path);
*err = -EINVAL;
return NULL;
}
while ((dent = readdir(dir))) {
if (strstr(dent->d_name, HISI_PTT_PMU_NAME))
(*nr_ptts)++;
}
if (!(*nr_ptts))
goto out;
hisi_ptt_pmus = calloc((*nr_ptts), sizeof(struct perf_pmu *));
if (!hisi_ptt_pmus) {
pr_err("hisi_ptt alloc failed\n");
*err = -ENOMEM;
goto out;
}
rewinddir(dir);
while ((dent = readdir(dir))) {
if (strstr(dent->d_name, HISI_PTT_PMU_NAME) && idx < *nr_ptts) {
hisi_ptt_pmus[idx] = perf_pmus__find(dent->d_name);
if (hisi_ptt_pmus[idx])
idx++;
}
}
out:
closedir(dir);
return hisi_ptt_pmus;
}
static struct perf_pmu *find_pmu_for_event(struct perf_pmu **pmus,
int pmu_nr, struct evsel *evsel)
{
int i;
if (!pmus)
return NULL;
for (i = 0; i < pmu_nr; i++) {
if (evsel->core.attr.type == pmus[i]->type)
return pmus[i];
}
return NULL;
}
struct auxtrace_record
*auxtrace_record__init(struct evlist *evlist, int *err)
{
struct perf_pmu *cs_etm_pmu = NULL;
struct perf_pmu **arm_spe_pmus = NULL;
struct perf_pmu **hisi_ptt_pmus = NULL;
struct evsel *evsel;
struct perf_pmu *found_etm = NULL;
struct perf_pmu *found_spe = NULL;
struct perf_pmu *found_ptt = NULL;
Annotation
- Immediate include surface: `dirent.h`, `errno.h`, `stdbool.h`, `linux/coresight-pmu.h`, `stdlib.h`, `api/fs/fs.h`, `../../../util/auxtrace.h`, `../../../util/debug.h`.
- Detected declarations: `function Copyright`, `function evlist__for_each_entry`, `function compat_auxtrace_mmap__read_head`, `function compat_auxtrace_mmap__write_tail`.
- 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.