linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@infradead.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org, David Ahern <dsahern@gmail.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Stephane Eranian <eranian@google.com>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 10/21] perf session: Change perf_session__has_traces to actually check for tracepoints
Date: Wed, 14 Aug 2013 15:25:04 -0300	[thread overview]
Message-ID: <1376504715-28107-11-git-send-email-acme@infradead.org> (raw)
In-Reply-To: <1376504715-28107-1-git-send-email-acme@infradead.org>

From: David Ahern <dsahern@gmail.com>

Any event can have RAW data attribute set. The intent of the function is
to determine if the session has tracepoints, so check for the type of
each event explicitly.

Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1375930261-77273-17-git-send-email-dsahern@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/session.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 5a89964..4d9028e 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -1401,12 +1401,15 @@ int perf_session__process_events(struct perf_session *self,
 
 bool perf_session__has_traces(struct perf_session *session, const char *msg)
 {
-	if (!(perf_evlist__sample_type(session->evlist) & PERF_SAMPLE_RAW)) {
-		pr_err("No trace sample to read. Did you call 'perf %s'?\n", msg);
-		return false;
+	struct perf_evsel *evsel;
+
+	list_for_each_entry(evsel, &session->evlist->entries, node) {
+		if (evsel->attr.type == PERF_TYPE_TRACEPOINT)
+			return true;
 	}
 
-	return true;
+	pr_err("No trace sample to read. Did you call 'perf %s'?\n", msg);
+	return false;
 }
 
 int maps__set_kallsyms_ref_reloc_sym(struct map **maps,
-- 
1.8.1.4


  parent reply	other threads:[~2013-08-14 18:30 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-14 18:24 [GIT PULL 00/21] perf/core improvements and fixes Arnaldo Carvalho de Melo
2013-08-14 18:24 ` [PATCH 01/21] perf kvm: Option to print events that exceed a duration Arnaldo Carvalho de Melo
2013-08-14 18:24 ` [PATCH 02/21] perf kvm: Update documentation with live command Arnaldo Carvalho de Melo
2013-08-14 18:24 ` [PATCH 03/21] perf sched: Simplify arguments to read_events Arnaldo Carvalho de Melo
2013-08-14 18:24 ` [PATCH 04/21] perf sched: Remove thread lookup in sample handler Arnaldo Carvalho de Melo
2013-08-14 18:24 ` [PATCH 05/21] perf sched: Remove sched_process_exit tracepoint Arnaldo Carvalho de Melo
2013-08-14 18:25 ` [PATCH 06/21] perf sched: Remove sched_process_fork tracepoint Arnaldo Carvalho de Melo
2013-08-14 18:25 ` [PATCH 07/21] perf tool: Simplify options to perf_evsel__print_ip Arnaldo Carvalho de Melo
2013-08-14 18:25 ` [PATCH 08/21] perf evsel: Add option to print stack trace on single line Arnaldo Carvalho de Melo
2013-08-14 18:25 ` [PATCH 09/21] perf evsel: Add option to limit stack depth in callchain dumps Arnaldo Carvalho de Melo
2013-08-14 18:25 ` Arnaldo Carvalho de Melo [this message]
2013-08-14 18:25 ` [PATCH 11/21] perf machine: Add symbol filter to struct machine Arnaldo Carvalho de Melo
2013-08-14 18:25 ` [PATCH 12/21] perf top: Set the machines symbol filter Arnaldo Carvalho de Melo
2013-08-14 18:25 ` [PATCH 13/21] perf report: " Arnaldo Carvalho de Melo
2013-08-14 18:25 ` [PATCH 14/21] perf mem: Remove unused symbol filter member Arnaldo Carvalho de Melo
2013-08-14 18:25 ` [PATCH 15/21] perf annotate: Set the machines symbol filter Arnaldo Carvalho de Melo
2013-08-14 18:25 ` [PATCH 16/21] perf tools: Remove filter parameter of perf_event__preprocess_sample() Arnaldo Carvalho de Melo
2013-08-14 18:25 ` [PATCH 17/21] perf tools: Remove filter parameter of thread__find_addr_location() Arnaldo Carvalho de Melo
2013-08-14 18:25 ` [PATCH 18/21] perf tools: Remove filter parameter of thread__find_addr_map() Arnaldo Carvalho de Melo
2013-08-14 18:25 ` [PATCH 19/21] perf tests: Fix compile failure on do_sort_something Arnaldo Carvalho de Melo
2013-08-14 18:25 ` [PATCH 20/21] perf tools: Improve robustness of topology parsing code Arnaldo Carvalho de Melo
2013-08-14 18:25 ` [PATCH 21/21] perf trace: Allow specifying which syscalls to trace Arnaldo Carvalho de Melo
2013-08-15  7:52 ` [GIT PULL 00/21] perf/core improvements and fixes 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=1376504715-28107-11-git-send-email-acme@infradead.org \
    --to=acme@infradead.org \
    --cc=acme@redhat.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@kernel.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;
as well as URLs for NNTP newsgroup(s).