Home | History | Annotate | Download | only in util

Lines Matching refs:pmu

9 #include "pmu.h"
72 * Reading/parsing the default pmu format definition, which should be
162 * Reading the pmu event aliases definition, which should be located at:
207 * Reading/parsing the default pmu type value, which should be
240 /* Add all pmus in sysfs to pmu list: */
298 struct perf_pmu *pmu;
304 * The pmu data we store & need consists of the pmu
317 pmu = zalloc(sizeof(*pmu));
318 if (!pmu)
321 pmu->cpus = pmu_cpumask(name);
323 INIT_LIST_HEAD(&pmu->format);
324 INIT_LIST_HEAD(&pmu->aliases);
325 list_splice(&format, &pmu->format);
326 list_splice(&aliases, &pmu->aliases);
327 pmu->name = strdup(name);
328 pmu->type = type;
329 list_add_tail(&pmu->list, &pmus);
330 return pmu;
335 struct perf_pmu *pmu;
337 list_for_each_entry(pmu, &pmus, list)
338 if (!strcmp(pmu->name, name))
339 return pmu;
344 struct perf_pmu *perf_pmu__scan(struct perf_pmu *pmu)
347 * pmu iterator: If pmu is NULL, we start at the begin,
348 * otherwise return the next pmu. Returns NULL on end.
350 if (!pmu) {
352 pmu = list_prepare_entry(pmu, &pmus, list);
354 list_for_each_entry_continue(pmu, &pmus, list)
355 return pmu;
361 struct perf_pmu *pmu;
364 * Once PMU is loaded it stays in the list,
366 * the pmu format definitions.
368 pmu = pmu_find(name);
369 if (pmu)
370 return pmu;
477 * 2) pmu format definitions - specified by pmu parameter
479 int perf_pmu__config(struct perf_pmu *pmu, struct perf_event_attr *attr,
482 attr->type = pmu->type;
483 return perf_pmu__config_terms(&pmu->format, attr, head_terms);
486 static struct perf_pmu_alias *pmu_find_alias(struct perf_pmu *pmu,
498 if (pmu_find_format(&pmu->format, term->config))
509 list_for_each_entry(alias, &pmu->aliases, list) {
520 int perf_pmu__check_alias(struct perf_pmu *pmu, struct list_head *head_terms)
527 alias = pmu_find_alias(pmu, term);
568 static char *format_alias(char *buf, int len, struct perf_pmu *pmu,
571 snprintf(buf, len, "%s/%s/", pmu->name, alias->name);
575 static char *format_alias_or(char *buf, int len, struct perf_pmu *pmu,
578 snprintf(buf, len, "%s OR %s/%s/", alias->name, pmu->name, alias->name);
591 struct perf_pmu *pmu;
598 pmu = NULL;
600 while ((pmu = perf_pmu__scan(pmu)) != NULL)
601 list_for_each_entry(alias, &pmu->aliases, list)
606 pmu = NULL;
608 while ((pmu = perf_pmu__scan(pmu)) != NULL)
609 list_for_each_entry(alias, &pmu->aliases, list) {
610 char *name = format_alias(buf, sizeof(buf), pmu, alias);
611 bool is_cpu = !strcmp(pmu->name, "cpu");
621 pmu, alias);
632 printf(" %-50s [Kernel PMU event]\n", aliases[j]);