From: David Ahern Date: Thu, 8 Aug 2013 02:50:58 +0000 (-0400) Subject: perf session: Change perf_session__has_traces to actually check for tracepoints X-Git-Tag: Ubuntu-5.4-5.4.0-11.14~15995^3~17^2~11 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=93ea01c29d4ed5a9fcf6d9a95bc584e54a420834;p=mirror_ubuntu-focal-kernel.git perf session: Change perf_session__has_traces to actually check for tracepoints 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 Cc: Frederic Weisbecker Cc: Ingo Molnar Cc: Jiri Olsa Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lkml.kernel.org/r/1375930261-77273-17-git-send-email-dsahern@gmail.com Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 5a8996493d94..4d9028eef34a 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,