tools/perf/util/stat.h
Source file repositories/reference/linux-study-clean/tools/perf/util/stat.h
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/util/stat.h- Extension
.h- Size
- 5752 bytes
- Lines
- 210
- 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
linux/types.hstdio.hsys/types.hsys/resource.hcpumap.hcounts.h
Detected Declarations
struct perf_cpu_mapstruct perf_stat_configstruct timespecstruct statsstruct perf_stat_aggrstruct perf_stat_evselstruct perf_stat_configstruct evselstruct evliststruct perf_stat_output_ctxstruct perf_toolstruct perf_sessionstruct targetstruct metric_exprenum aggr_modeenum metric_threshold_classifyfunction init_stats
Annotated Snippet
struct stats {
double n, mean, M2;
u64 max, min;
};
/* hold aggregated event info */
struct perf_stat_aggr {
/* aggregated values */
struct perf_counts_values counts;
/* number of entries (CPUs) aggregated */
int nr;
/* whether any entry has failed to read/process event */
bool failed;
/* to mark this data is processed already */
bool used;
};
/* per-evsel event stats */
struct perf_stat_evsel {
/* used for repeated runs */
struct stats res_stats;
/* number of allocated 'aggr' */
int nr_aggr;
/* aggregated event values */
struct perf_stat_aggr *aggr;
/* used for group read */
u64 *group_data;
};
enum aggr_mode {
AGGR_NONE,
AGGR_GLOBAL,
AGGR_SOCKET,
AGGR_DIE,
AGGR_CLUSTER,
AGGR_CACHE,
AGGR_CORE,
AGGR_THREAD,
AGGR_UNSET,
AGGR_NODE,
AGGR_MAX
};
typedef struct aggr_cpu_id (*aggr_get_id_t)(struct perf_stat_config *config, struct perf_cpu cpu);
struct perf_stat_config {
enum aggr_mode aggr_mode;
u32 aggr_level;
bool scale;
bool no_inherit;
bool identifier;
bool csv_output;
bool json_output;
bool interval_clear;
bool metric_only;
bool null_run;
bool ru_display;
bool big_num;
bool hybrid_merge;
bool walltime_run_table;
bool all_kernel;
bool all_user;
bool percore_show_thread;
bool summary;
bool no_csv_summary;
bool metric_no_group;
bool metric_no_merge;
bool metric_no_threshold;
bool hardware_aware_grouping;
bool stop_read_counter;
bool iostat_run;
char *user_requested_cpu_list;
bool system_wide;
FILE *output;
unsigned int interval;
unsigned int timeout;
unsigned int unit_width;
unsigned int metric_only_len;
int times;
int run_count;
int print_free_counters_hint;
const char *csv_sep;
struct stats *walltime_nsecs_stats;
struct rusage ru_data;
struct cpu_aggr_map *aggr_map;
aggr_get_id_t aggr_get_id;
struct cpu_aggr_map *cpus_aggr_map;
u64 *walltime_run;
int ctl_fd;
int ctl_fd_ack;
Annotation
- Immediate include surface: `linux/types.h`, `stdio.h`, `sys/types.h`, `sys/resource.h`, `cpumap.h`, `counts.h`.
- Detected declarations: `struct perf_cpu_map`, `struct perf_stat_config`, `struct timespec`, `struct stats`, `struct perf_stat_aggr`, `struct perf_stat_evsel`, `struct perf_stat_config`, `struct evsel`, `struct evlist`, `struct perf_stat_output_ctx`.
- 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.