perf pmu: Let pmu's with no events show up on perf list
perf list only lists PMUs with events. Add a flag to cause a PMU to be also listed separately. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/1414061124-26830-3-git-send-email-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
ed3077585f
commit
42634bc7a0
@ -747,15 +747,18 @@ void print_pmu_events(const char *event_glob, bool name_only)
|
|||||||
|
|
||||||
pmu = NULL;
|
pmu = NULL;
|
||||||
len = 0;
|
len = 0;
|
||||||
while ((pmu = perf_pmu__scan(pmu)) != NULL)
|
while ((pmu = perf_pmu__scan(pmu)) != NULL) {
|
||||||
list_for_each_entry(alias, &pmu->aliases, list)
|
list_for_each_entry(alias, &pmu->aliases, list)
|
||||||
len++;
|
len++;
|
||||||
|
if (pmu->selectable)
|
||||||
|
len++;
|
||||||
|
}
|
||||||
aliases = malloc(sizeof(char *) * len);
|
aliases = malloc(sizeof(char *) * len);
|
||||||
if (!aliases)
|
if (!aliases)
|
||||||
return;
|
return;
|
||||||
pmu = NULL;
|
pmu = NULL;
|
||||||
j = 0;
|
j = 0;
|
||||||
while ((pmu = perf_pmu__scan(pmu)) != NULL)
|
while ((pmu = perf_pmu__scan(pmu)) != NULL) {
|
||||||
list_for_each_entry(alias, &pmu->aliases, list) {
|
list_for_each_entry(alias, &pmu->aliases, list) {
|
||||||
char *name = format_alias(buf, sizeof(buf), pmu, alias);
|
char *name = format_alias(buf, sizeof(buf), pmu, alias);
|
||||||
bool is_cpu = !strcmp(pmu->name, "cpu");
|
bool is_cpu = !strcmp(pmu->name, "cpu");
|
||||||
@ -772,6 +775,12 @@ void print_pmu_events(const char *event_glob, bool name_only)
|
|||||||
aliases[j] = strdup(aliases[j]);
|
aliases[j] = strdup(aliases[j]);
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
|
if (pmu->selectable) {
|
||||||
|
scnprintf(buf, sizeof(buf), "%s//", pmu->name);
|
||||||
|
aliases[j] = strdup(buf);
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
}
|
||||||
len = j;
|
len = j;
|
||||||
qsort(aliases, len, sizeof(char *), cmp_string);
|
qsort(aliases, len, sizeof(char *), cmp_string);
|
||||||
for (j = 0; j < len; j++) {
|
for (j = 0; j < len; j++) {
|
||||||
|
@ -18,6 +18,7 @@ struct perf_event_attr;
|
|||||||
struct perf_pmu {
|
struct perf_pmu {
|
||||||
char *name;
|
char *name;
|
||||||
__u32 type;
|
__u32 type;
|
||||||
|
bool selectable;
|
||||||
struct perf_event_attr *default_config;
|
struct perf_event_attr *default_config;
|
||||||
struct cpu_map *cpus;
|
struct cpu_map *cpus;
|
||||||
struct list_head format; /* HEAD struct perf_pmu_format -> list */
|
struct list_head format; /* HEAD struct perf_pmu_format -> list */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user