tools/perf/builtin-c2c.c
Source file repositories/reference/linux-study-clean/tools/perf/builtin-c2c.c
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/builtin-c2c.c- Extension
.c- Size
- 87289 bytes
- Lines
- 3506
- 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.hinttypes.hlinux/compiler.hlinux/err.hlinux/kernel.hlinux/stringify.hlinux/zalloc.hasm/bug.hsys/param.hdebug.hbuiltin.hperf/cpumap.hsubcmd/pager.hsubcmd/parse-options.hmap_symbol.hmem-events.hsession.hhist.hsort.htool.hcacheline.hdata.hevent.hevlist.hevsel.hui/browsers/hists.hthread.hmem2node.hmem-info.hsymbol.hui/ui.hui/progress.h
Detected Declarations
struct c2c_histsstruct compute_statsstruct c2c_hist_entrystruct perf_c2cstruct c2c_headerstruct c2c_dimensionstruct c2c_fmtstruct c2c_cacheline_browserfunction c2c_he_freefunction he__get_c2c_histsfunction c2c_he__set_evselfunction c2c_he__set_cpufunction c2c_he__set_nodefunction compute_statsfunction perf_c2c__has_annotationfunction perf_c2c__evsel_hists_inc_statsfunction process_sample_eventfunction symbol_widthfunction c2c_widthfunction c2c_headerfunction dcacheline_cmpfunction dcacheline_entryfunction dcacheline_node_entryfunction dcacheline_node_countfunction offset_entryfunction offset_cmpfunction iaddr_entryfunction iaddr_cmpfunction tot_hitm_entryfunction tot_hitm_cmpfunction get_load_llc_missesfunction get_load_cache_hitsfunction get_storesfunction total_recordsfunction tot_recs_entryfunction tot_recs_cmpfunction total_loadsfunction tot_loads_entryfunction tot_loads_cmpfunction percent_colorfunction percent_costly_snoopfunction percent_costly_snoop_entryfunction percent_costly_snoop_colorfunction percent_costly_snoop_cmpfunction percentfunction percent_rmt_hitm_entryfunction percent_rmt_hitm_colorfunction percent_rmt_hitm_cmp
Annotated Snippet
struct c2c_hists {
struct hists hists;
struct perf_hpp_list list;
struct c2c_stats stats;
};
struct compute_stats {
struct stats lcl_hitm;
struct stats rmt_hitm;
struct stats lcl_peer;
struct stats rmt_peer;
struct stats load;
};
struct c2c_hist_entry {
struct c2c_hists *hists;
struct evsel *evsel;
struct c2c_stats stats;
unsigned long *cpuset;
unsigned long *nodeset;
struct c2c_stats *node_stats;
unsigned int cacheline_idx;
struct compute_stats cstats;
unsigned long paddr;
unsigned long paddr_cnt;
bool paddr_zero;
char *nodestr;
/*
* must be at the end,
* because of its callchain dynamic entry
*/
struct hist_entry he;
};
static char const *coalesce_default = "iaddr";
struct perf_c2c {
struct perf_tool tool;
struct c2c_hists hists;
struct mem2node mem2node;
unsigned long **nodes;
int nodes_cnt;
int cpus_cnt;
int *cpu2node;
int node_info;
bool show_src;
bool show_all;
bool use_stdio;
bool stats_only;
bool symbol_full;
bool stitch_lbr;
/* Shared cache line stats */
struct c2c_stats shared_clines_stats;
int shared_clines;
int display;
const char *coalesce;
char *cl_sort;
char *cl_resort;
char *cl_output;
};
enum {
DISPLAY_LCL_HITM,
DISPLAY_RMT_HITM,
DISPLAY_TOT_HITM,
DISPLAY_SNP_PEER,
DISPLAY_MAX,
};
static const char *display_str[DISPLAY_MAX] = {
[DISPLAY_LCL_HITM] = "Local HITMs",
[DISPLAY_RMT_HITM] = "Remote HITMs",
[DISPLAY_TOT_HITM] = "Total HITMs",
[DISPLAY_SNP_PEER] = "Peer Snoop",
};
static const struct option c2c_options[] = {
OPT_INCR('v', "verbose", &verbose, "be more verbose (show counter open errors, etc)"),
OPT_END()
};
static struct perf_c2c c2c;
Annotation
- Immediate include surface: `errno.h`, `inttypes.h`, `linux/compiler.h`, `linux/err.h`, `linux/kernel.h`, `linux/stringify.h`, `linux/zalloc.h`, `asm/bug.h`.
- Detected declarations: `struct c2c_hists`, `struct compute_stats`, `struct c2c_hist_entry`, `struct perf_c2c`, `struct c2c_header`, `struct c2c_dimension`, `struct c2c_fmt`, `struct c2c_cacheline_browser`, `function c2c_he_free`, `function he__get_c2c_hists`.
- 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.