From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org,
Adrian Hunter <adrian.hunter@intel.com>,
David Ahern <dsahern@gmail.com>,
Frederic Weisbecker <fweisbec@gmail.com>,
Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@gmail.com>,
Paul Mackerras <paulus@samba.org>,
Peter Zijlstra <peterz@infradead.org>,
Stephane Eranian <eranian@google.com>,
Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 14/25] perf pmu: Let pmu's with no events show up on perf list
Date: Wed, 29 Oct 2014 12:06:26 -0200 [thread overview]
Message-ID: <1414591597-2763-15-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1414591597-2763-1-git-send-email-acme@kernel.org>
From: Adrian Hunter <adrian.hunter@intel.com>
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>
---
tools/perf/util/pmu.c | 13 +++++++++++--
tools/perf/util/pmu.h | 1 +
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index e243ad962a4d..91dca604c422 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -747,15 +747,18 @@ void print_pmu_events(const char *event_glob, bool name_only)
pmu = NULL;
len = 0;
- while ((pmu = perf_pmu__scan(pmu)) != NULL)
+ while ((pmu = perf_pmu__scan(pmu)) != NULL) {
list_for_each_entry(alias, &pmu->aliases, list)
len++;
+ if (pmu->selectable)
+ len++;
+ }
aliases = malloc(sizeof(char *) * len);
if (!aliases)
return;
pmu = NULL;
j = 0;
- while ((pmu = perf_pmu__scan(pmu)) != NULL)
+ while ((pmu = perf_pmu__scan(pmu)) != NULL) {
list_for_each_entry(alias, &pmu->aliases, list) {
char *name = format_alias(buf, sizeof(buf), pmu, alias);
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]);
j++;
}
+ if (pmu->selectable) {
+ scnprintf(buf, sizeof(buf), "%s//", pmu->name);
+ aliases[j] = strdup(buf);
+ j++;
+ }
+ }
len = j;
qsort(aliases, len, sizeof(char *), cmp_string);
for (j = 0; j < len; j++) {
diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h
index fe9dfbee8eed..8092de78e818 100644
--- a/tools/perf/util/pmu.h
+++ b/tools/perf/util/pmu.h
@@ -18,6 +18,7 @@ struct perf_event_attr;
struct perf_pmu {
char *name;
__u32 type;
+ bool selectable;
struct perf_event_attr *default_config;
struct cpu_map *cpus;
struct list_head format; /* HEAD struct perf_pmu_format -> list */
--
1.9.3
next prev parent reply other threads:[~2014-10-29 14:13 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-29 14:06 [GIT PULL 00/25] perf/core improvements Arnaldo Carvalho de Melo
2014-10-29 14:06 ` [PATCH 01/25] perf tools powerpc: Cache the DWARF debug info Arnaldo Carvalho de Melo
2014-10-29 14:06 ` [PATCH 02/25] perf tools: Set thread->mg.machine in all places Arnaldo Carvalho de Melo
2014-10-29 14:06 ` [PATCH 03/25] perf tools: A thread's machine can be found via thread->mg->machine Arnaldo Carvalho de Melo
2014-10-29 14:06 ` [PATCH 04/25] perf thread: Adopt resolve_callchain method from machine Arnaldo Carvalho de Melo
2014-10-29 14:06 ` [PATCH 05/25] perf callchains: Use thread->mg->machine Arnaldo Carvalho de Melo
2014-10-29 14:06 ` [PATCH 06/25] perf tests: Remove misplaced __maybe_unused Arnaldo Carvalho de Melo
2014-10-29 14:06 ` [PATCH 07/25] perf tests: Use thread->mg->machine Arnaldo Carvalho de Melo
2014-10-29 14:06 ` [PATCH 08/25] perf tools: Add PARSE_OPT_DISABLED flag Arnaldo Carvalho de Melo
2014-10-29 14:06 ` [PATCH 09/25] perf tools: Export usage string and option table of perf record Arnaldo Carvalho de Melo
2014-10-29 14:06 ` [PATCH 10/25] perf kvm: Print kvm specific --help output Arnaldo Carvalho de Melo
2014-10-29 14:06 ` [PATCH 11/25] perf tools: Add support for exclusive option Arnaldo Carvalho de Melo
2014-10-29 14:06 ` [PATCH 12/25] perf probe: Use PARSE_OPT_EXCLUSIVE flag Arnaldo Carvalho de Melo
2014-10-29 14:06 ` [PATCH 13/25] perf tools: Ensure return negative value when write header error Arnaldo Carvalho de Melo
2014-10-29 14:06 ` Arnaldo Carvalho de Melo [this message]
2014-10-29 14:06 ` [PATCH 15/25] perf tools: Build programs to copy 32-bit compatibility Arnaldo Carvalho de Melo
2014-10-29 14:06 ` [PATCH 16/25] perf tools: Add support for 32-bit compatibility VDSOs Arnaldo Carvalho de Melo
2014-10-29 14:06 ` [PATCH 17/25] perf tools: Do not attempt to run perf-read-vdso32 if it wasn't built Arnaldo Carvalho de Melo
2014-10-29 14:06 ` [PATCH 18/25] perf pmu: Add proper error handling to print_pmu_events() Arnaldo Carvalho de Melo
2014-10-29 14:06 ` [PATCH 19/25] perf tools: Add facility to export data in database-friendly way Arnaldo Carvalho de Melo
2014-10-29 14:06 ` [PATCH 20/25] perf scripting python: Extend interface to export data in a " Arnaldo Carvalho de Melo
2014-10-29 14:06 ` [PATCH 21/25] perf script: Add Python script to export to postgresql Arnaldo Carvalho de Melo
2014-10-29 14:06 ` [PATCH 22/25] perf probe: Add --quiet option to suppress output result message Arnaldo Carvalho de Melo
2014-10-29 14:06 ` [PATCH 23/25] perf tools: Add id index Arnaldo Carvalho de Melo
2014-10-29 14:06 ` [PATCH 24/25] perf tools: Use evlist__for_each in a few remaining places Arnaldo Carvalho de Melo
2014-10-29 14:06 ` [PATCH 25/25] perf session: Add perf_session__deliver_synth_event() Arnaldo Carvalho de Melo
2014-10-30 6:35 ` [GIT PULL 00/25] perf/core improvements Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1414591597-2763-15-git-send-email-acme@kernel.org \
--to=acme@kernel.org \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=dsahern@gmail.com \
--cc=eranian@google.com \
--cc=fweisbec@gmail.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@gmail.com \
--cc=paulus@samba.org \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome