[tip:perfcounters/tracing] perf tools: Warn while running perf trace without sample

From: tip-bot for Frederic Weisbecker
Date: Mon Aug 17 2009 - 18:07:25 EST


Commit-ID: 4bf2364a951d3c043e132e4451d90c7bc74dee83
Gitweb: http://git.kernel.org/tip/4bf2364a951d3c043e132e4451d90c7bc74dee83
Author: Frederic Weisbecker <fweisbec@xxxxxxxxx>
AuthorDate: Mon, 17 Aug 2009 23:07:49 +0200
Committer: Ingo Molnar <mingo@xxxxxxx>
CommitDate: Tue, 18 Aug 2009 00:00:18 +0200

perf tools: Warn while running perf trace without sample

When a user runs perf trace using an input with logged
counters without PERF_SAMPLE_RAW attribute, warn by giving a
nice tip.

Signed-off-by: Frederic Weisbecker <fweisbec@xxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
Cc: Mike Galbraith <efault@xxxxxx>
Cc: Steven Rostedt <rostedt@xxxxxxxxxxx>
LKML-Reference: <1250543271-8383-2-git-send-email-fweisbec@xxxxxxxxx>
Signed-off-by: Ingo Molnar <mingo@xxxxxxx>


---
tools/perf/builtin-trace.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index b160a9f..88eef71 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -184,6 +184,10 @@ static int __cmd_trace(void)
header = perf_header__read(input);
sample_type = perf_header__sample_type(header);

+ if (!(sample_type & PERF_SAMPLE_RAW))
+ die("No trace sample to read. Did you call perf record "
+ "without -R?");
+
if (load_kernel() < 0) {
perror("failed to load kernel symbols");
return EXIT_FAILURE;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/