metricgroup__add_metric(9)
π metricgroup__add_metric(9) β like, the Kernel API Manual one, bestie
okay so picture this: you're deep in perf land, you've got a PMU, you've got a metric name, and you need somebody to find that metric (or a whole metric group, no big deal) and add it. That somebody is metricgroup__add_metric. It's giving main character energy in the metrics department, fr fr. β¨
π NAME π
metricgroup__add_metric β finds and adds a metric, or a metric group. That's it, that's the whole vibe. π«Ά
πΈ SYNOPSIS πΈ
int metricgroup__add_metric (const char *pmu , const char *metric_name ,
const char *modifier , bool metric_no_group , bool metric_no_threshold ,
const char *user_requested_cpu_list , bool system_wide , struct
list_head *metric_list , const struct pmu_metrics_table *table );
like, yes, that's a lot of parameters. She's thorough. We respect it. π
β¨ ARGUMENTS β¨ (the whole cast, icon by icon)
pmuβ the PMU name you're searching for metrics on. Or literally just pass"all"and she'll go look at every PMU for you. queen behaviour. πmetric_nameβ the name of the metric or the metric group, your pick. For example,"IPC"could be the name of a single metric, and"TopDownL1"could be the name of a metric group. iykyk. πmodifierβif non-null event modifiers like "u". that's the whole description bestie, she's a simple girl. πmetric_no_groupβ should the events written to events be grouped"{}"or global? Grouping is the default β¨ but because of multiplexing the user is allowed to override it. so like, it's a default, not a cage. π¦metric_no_thresholdβ-- undescribed --π the original manpage literally has nothing here. not me leaving it exactly as I found it. no cap, there is no description. πuser_requested_cpu_listβ the CPUs that were specified on the command line to record on. π―system_wideβ are the events being recorded for all processes? that's the question this one's asking. πmetric_listβ the list that the metric (or metric group) actually gets added to. the destination, the final form, the moment of arrival. π₯tableβ the table that gets searched for metrics. most commonly it's the table for the architecture perf is running upon. π₯οΈβ¨
lowkey reminder: every single one of those has to be passed exactly as written, don't go getting creative with the names. that's not the vibe check we're doing today. π
π SEE ALSO π
honestly go read these next, they're all part of the same little friend group:
- Kernel file
./tools/perf/util/metricgroup.c(yes, that's where the sauce lives) setup_metric_events(9)resolve_metric(9)__add_metric(9)metric_list_cmp(9)default_metricgroup_cmp(9)metricgroup__add_metric_list(9)find_tool_events(9)build_combined_expr_ctx(9)parse_ids(9)
that's the whole page bestie, you ate it up π β¨
source location: ./tools/perf/util πΈ date: October 2026 π β mwah, go forth and add those metrics ππ¦β
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms