diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-06-07 11:58:23 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-06-07 11:58:23 -0400 |
commit | a14832ff977e78d1982cdf78cdabb1f2320d9ac8 (patch) | |
tree | 84cb8282d4237f17d8c9ff50919947d1323f811c | |
parent | 30c806a094493beb7691bc7957dfa02dee96230a (diff) |
perf report: Print more expressive message in case of file open error
Before:
$ perf report
failed to open file: No such file or directory
After:
$ perf report
failed to open file: perf.data (try 'perf record' first)
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | tools/perf/builtin-report.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 242e09ff3658..f053a7463dcf 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -1120,7 +1120,10 @@ static int __cmd_report(void) | |||
1120 | 1120 | ||
1121 | input = open(input_name, O_RDONLY); | 1121 | input = open(input_name, O_RDONLY); |
1122 | if (input < 0) { | 1122 | if (input < 0) { |
1123 | perror("failed to open file"); | 1123 | fprintf(stderr, " failed to open file: %s", input_name); |
1124 | if (!strcmp(input_name, "perf.data")) | ||
1125 | fprintf(stderr, " (try 'perf record' first)"); | ||
1126 | fprintf(stderr, "\n"); | ||
1124 | exit(-1); | 1127 | exit(-1); |
1125 | } | 1128 | } |
1126 | 1129 | ||