diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2009-11-19 11:55:55 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-11-19 12:47:17 -0500 |
commit | 4dc0a04bb18fe9b80cefa08694f46a3a19ebfe50 (patch) | |
tree | 6d3ff5b79e71985ef4691df2d47202a4f6c3bd53 /tools/perf/builtin-timechart.c | |
parent | 2446042c93bfc6eeebfc89e88fdef2435d2bb5c4 (diff) |
perf tools: perf_header__read() shouldn't die()
And also don't call the constructor in it, this way it adheres
to the model the other methods follow.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1258649757-17554-1-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/builtin-timechart.c')
-rw-r--r-- | tools/perf/builtin-timechart.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c index 665877e4a944..dd4d82ac7aa4 100644 --- a/tools/perf/builtin-timechart.c +++ b/tools/perf/builtin-timechart.c | |||
@@ -1093,7 +1093,7 @@ static void process_samples(void) | |||
1093 | 1093 | ||
1094 | static int __cmd_timechart(void) | 1094 | static int __cmd_timechart(void) |
1095 | { | 1095 | { |
1096 | int ret, rc = EXIT_FAILURE; | 1096 | int err, rc = EXIT_FAILURE; |
1097 | unsigned long offset = 0; | 1097 | unsigned long offset = 0; |
1098 | unsigned long head, shift; | 1098 | unsigned long head, shift; |
1099 | struct stat statbuf; | 1099 | struct stat statbuf; |
@@ -1111,8 +1111,8 @@ static int __cmd_timechart(void) | |||
1111 | exit(-1); | 1111 | exit(-1); |
1112 | } | 1112 | } |
1113 | 1113 | ||
1114 | ret = fstat(input, &statbuf); | 1114 | err = fstat(input, &statbuf); |
1115 | if (ret < 0) { | 1115 | if (err < 0) { |
1116 | perror("failed to stat file"); | 1116 | perror("failed to stat file"); |
1117 | exit(-1); | 1117 | exit(-1); |
1118 | } | 1118 | } |
@@ -1122,7 +1122,16 @@ static int __cmd_timechart(void) | |||
1122 | exit(0); | 1122 | exit(0); |
1123 | } | 1123 | } |
1124 | 1124 | ||
1125 | header = perf_header__read(input); | 1125 | header = perf_header__new(); |
1126 | if (header == NULL) | ||
1127 | return -ENOMEM; | ||
1128 | |||
1129 | err = perf_header__read(header, input); | ||
1130 | if (err < 0) { | ||
1131 | perf_header__delete(header); | ||
1132 | return err; | ||
1133 | } | ||
1134 | |||
1126 | head = header->data_offset; | 1135 | head = header->data_offset; |
1127 | 1136 | ||
1128 | sample_type = perf_header__sample_type(header); | 1137 | sample_type = perf_header__sample_type(header); |