/* Check whether there is a PMU which supports the perf metrics. */ bool topdown_sys_has_perf_metrics(void)
{ staticbool has_perf_metrics; staticbool cached; struct perf_pmu *pmu;
if (cached) return has_perf_metrics;
/* * The perf metrics feature is a core PMU feature. * The PERF_TYPE_RAW type is the type of a core PMU. * The slots event is only available when the core PMU * supports the perf metrics feature.
*/
pmu = perf_pmus__find_by_type(PERF_TYPE_RAW); if (pmu && perf_pmu__have_event(pmu, "slots"))
has_perf_metrics = true;
/* * Check whether a topdown group supports sample-read. * * Only Topdown metric supports sample-read. The slots * event must be the leader of the topdown group.
*/ bool arch_topdown_sample_read(struct evsel *leader)
{ struct evsel *evsel;
if (!evsel__sys_has_perf_metrics(leader)) returnfalse;
if (!arch_is_topdown_slots(leader)) returnfalse;
/* * If slots event as leader event but no topdown metric events * in group, slots event should still sample as leader.
*/
evlist__for_each_entry(leader->evlist, evsel) { if (evsel->core.leader != leader->core.leader) continue; if (evsel != leader && arch_is_topdown_metrics(evsel)) returntrue;
}
returnfalse;
}
/* * Make a copy of the topdown metric event metric_event with the given index but * change its configuration to be a topdown slots event. Copying from * metric_event ensures modifiers are the same.
*/ int topdown_insert_slots_event(struct list_head *list, int idx, struct evsel *metric_event)
{ struct evsel *evsel = evsel__new_idx(&metric_event->core.attr, idx);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.