All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Adrian Hunter <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: namhyung@gmail.com, hpa@zytor.com, adrian.hunter@intel.com,
	mingo@kernel.org, paulus@samba.org, fweisbec@gmail.com,
	acme@redhat.com, linux-kernel@vger.kernel.org, jolsa@redhat.com,
	dsahern@gmail.com, tglx@linutronix.de, eranian@google.com,
	peterz@infradead.org
Subject: [tip:perf/core] perf pmu: Let pmu' s with no events show up on perf list
Date: Wed, 29 Oct 2014 23:45:27 -0700	[thread overview]
Message-ID: <tip-42634bc7a02ead59cf2d50e60d8b8f825de8a3b0@git.kernel.org> (raw)
In-Reply-To: <1414061124-26830-3-git-send-email-adrian.hunter@intel.com>

Commit-ID:  42634bc7a02ead59cf2d50e60d8b8f825de8a3b0
Gitweb:     http://git.kernel.org/tip/42634bc7a02ead59cf2d50e60d8b8f825de8a3b0
Author:     Adrian Hunter <adrian.hunter@intel.com>
AuthorDate: Thu, 23 Oct 2014 13:45:10 +0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 29 Oct 2014 10:32:48 -0200

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>
---
 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 e243ad9..91dca60 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 fe9dfbe..8092de7 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 */

  parent reply	other threads:[~2014-10-30  6:46 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-23 10:45 [PATCH 00/16] perf tools: Intel PT preparation continued Adrian Hunter
2014-10-23 10:45 ` [PATCH 01/16] perf tools: Add id index Adrian Hunter
2014-10-23 21:08   ` Arnaldo Carvalho de Melo
2014-10-24  5:10     ` Namhyung Kim
2014-10-24  7:25     ` Adrian Hunter
2014-10-29  8:55       ` Jiri Olsa
2014-10-23 10:45 ` [PATCH 02/16] perf pmu: Let pmu's with no events show up on perf list Adrian Hunter
2014-10-24  5:15   ` Namhyung Kim
2014-10-24 12:57     ` Arnaldo Carvalho de Melo
2014-10-24 13:03       ` Arnaldo Carvalho de Melo
2014-10-24 13:21         ` Arnaldo Carvalho de Melo
2014-10-24 14:36           ` Adrian Hunter
2014-10-24 14:38             ` Adrian Hunter
2014-10-24 14:45             ` Arnaldo Carvalho de Melo
2014-10-24 15:35               ` Arnaldo Carvalho de Melo
2014-10-30  6:45   ` tip-bot for Adrian Hunter [this message]
2014-10-23 10:45 ` [PATCH 03/16] perf session: Add perf_session__deliver_synth_event() Adrian Hunter
2014-10-24  5:22   ` Namhyung Kim
2014-10-24 10:41     ` Adrian Hunter
2014-10-23 10:45 ` [PATCH 04/16] perf tools: Add a thread stack for synthesizing call chains Adrian Hunter
2014-10-23 20:51   ` Arnaldo Carvalho de Melo
2014-10-24  8:47     ` Adrian Hunter
2014-10-24  5:41   ` Namhyung Kim
2014-10-29  9:03   ` Jiri Olsa
2014-10-29  9:07   ` Jiri Olsa
2014-10-23 10:45 ` [PATCH 05/16] perf tools: Add facility to export data in database-friendly way Adrian Hunter
2014-10-23 21:42   ` Arnaldo Carvalho de Melo
2014-10-24  6:02   ` Namhyung Kim
2014-10-24  8:11     ` Adrian Hunter
2014-10-24 10:47       ` Adrian Hunter
2014-10-24 12:26         ` Namhyung Kim
2014-10-24 13:13           ` Adrian Hunter
2014-10-24 14:40             ` Arnaldo Carvalho de Melo
2014-10-24 14:41               ` Arnaldo Carvalho de Melo
2014-10-30  6:46   ` [tip:perf/core] " tip-bot for Adrian Hunter
2014-10-23 10:45 ` [PATCH 06/16] perf tools: Extend Python script interface to export data in a " Adrian Hunter
2014-10-30  6:47   ` [tip:perf/core] perf scripting python: Extend " tip-bot for Adrian Hunter
2014-10-23 10:45 ` [PATCH 07/16] perf tools: Add Python script to export to postgresql Adrian Hunter
2014-10-30  6:47   ` [tip:perf/core] perf script: " tip-bot for Adrian Hunter
2014-10-23 10:45 ` [PATCH 08/16] perf tools: Add branch type to db export Adrian Hunter
2014-10-23 10:45 ` [PATCH 09/16] perf tools: Add branch_type and in_tx to Python export Adrian Hunter
2014-10-23 10:45 ` [PATCH 10/16] perf tools: Enhance the thread stack to output call/return data Adrian Hunter
2014-10-29 13:23   ` Jiri Olsa
2014-10-29 14:02     ` Arnaldo Carvalho de Melo
2014-10-23 10:45 ` [PATCH 11/16] perf tools: Add call information to the database export API Adrian Hunter
2014-10-23 10:45 ` [PATCH 12/16] perf tools: Add call information to Python export Adrian Hunter
2014-10-23 10:45 ` [PATCH 13/16] perf tools: Defer export of comms that were not 'set' Adrian Hunter
2014-10-23 10:45 ` [PATCH 14/16] perf tools: Build programs to copy 32-bit compatibility VDSOs Adrian Hunter
2014-10-30  6:45   ` [tip:perf/core] perf tools: Build programs to copy 32-bit compatibility tip-bot for Adrian Hunter
2014-10-23 10:45 ` [PATCH 15/16] perf tools: Add support for 32-bit compatibility VDSOs Adrian Hunter
2014-10-30  6:45   ` [tip:perf/core] " tip-bot for Adrian Hunter
2014-10-23 10:45 ` [PATCH 16/16] perf tools: Do not attempt to run perf-read-vdso32 if it wasn't built Adrian Hunter
2014-10-30  6:46   ` [tip:perf/core] " tip-bot for Adrian Hunter
2014-10-23 21:11 ` [PATCH 00/16] perf tools: Intel PT preparation continued Arnaldo Carvalho de Melo
2014-10-23 23:43 ` Arnaldo Carvalho de Melo

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=tip-42634bc7a02ead59cf2d50e60d8b8f825de8a3b0@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=acme@redhat.com \
    --cc=adrian.hunter@intel.com \
    --cc=dsahern@gmail.com \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@gmail.com \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.