tools/perf/arch/x86/util/evlist.c
Source file repositories/reference/linux-study-clean/tools/perf/arch/x86/util/evlist.c
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/arch/x86/util/evlist.c- Extension
.c- Size
- 3663 bytes
- Lines
- 108
- 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
string.h../../../util/evlist.h../../../util/evsel.htopdown.hevsel.h
Detected Declarations
function arch_evlist__cmpfunction arch_evlist__add_required_eventsfunction list_for_each_entry
Annotated Snippet
if (lhs->core.leader != rhs->core.leader) {
bool lhs_topdown = arch_is_topdown_metrics(lhs);
bool rhs_topdown = arch_is_topdown_metrics(rhs);
if (lhs_topdown && !rhs_topdown)
return -1;
if (!lhs_topdown && rhs_topdown)
return 1;
}
}
/* Retire latency event should not be group leader*/
if (lhs->retire_lat && !rhs->retire_lat)
return 1;
if (!lhs->retire_lat && rhs->retire_lat)
return -1;
/* Default ordering by insertion index. */
return lhs->core.idx - rhs->core.idx;
}
int arch_evlist__add_required_events(struct list_head *list)
{
struct evsel *pos, *metric_event = NULL;
int idx = 0;
if (!topdown_sys_has_perf_metrics())
return 0;
list_for_each_entry(pos, list, core.node) {
if (arch_is_topdown_slots(pos)) {
/* Slots event already present, nothing to do. */
return 0;
}
if (metric_event == NULL && arch_is_topdown_metrics(pos))
metric_event = pos;
idx++;
}
if (metric_event == NULL) {
/* No topdown metric events, nothing to do. */
return 0;
}
return topdown_insert_slots_event(list, idx + 1, metric_event);
}
Annotation
- Immediate include surface: `string.h`, `../../../util/evlist.h`, `../../../util/evsel.h`, `topdown.h`, `evsel.h`.
- Detected declarations: `function arch_evlist__cmp`, `function arch_evlist__add_required_events`, `function list_for_each_entry`.
- 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.