aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-record.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2009-11-19 11:55:55 -0500
committerIngo Molnar <mingo@elte.hu>2009-11-19 12:47:17 -0500
commit4dc0a04bb18fe9b80cefa08694f46a3a19ebfe50 (patch)
tree6d3ff5b79e71985ef4691df2d47202a4f6c3bd53 /tools/perf/builtin-record.c
parent2446042c93bfc6eeebfc89e88fdef2435d2bb5c4 (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-record.c')
-rw-r--r--tools/perf/builtin-record.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 82260c56db3d..c97cb2ca8fa4 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -400,7 +400,7 @@ static int __cmd_record(int argc, const char **argv)
400 struct stat st; 400 struct stat st;
401 pid_t pid = 0; 401 pid_t pid = 0;
402 int flags; 402 int flags;
403 int ret; 403 int err;
404 unsigned long waking = 0; 404 unsigned long waking = 0;
405 405
406 page_size = sysconf(_SC_PAGE_SIZE); 406 page_size = sysconf(_SC_PAGE_SIZE);
@@ -434,16 +434,18 @@ static int __cmd_record(int argc, const char **argv)
434 exit(-1); 434 exit(-1);
435 } 435 }
436 436
437 if (!file_new) 437 header = perf_header__new();
438 header = perf_header__read(output);
439 else
440 header = perf_header__new();
441
442 if (header == NULL) { 438 if (header == NULL) {
443 pr_err("Not enough memory for reading perf file header\n"); 439 pr_err("Not enough memory for reading perf file header\n");
444 return -1; 440 return -1;
445 } 441 }
446 442
443 if (!file_new) {
444 err = perf_header__read(header, output);
445 if (err < 0)
446 return err;
447 }
448
447 if (raw_samples) { 449 if (raw_samples) {
448 perf_header__set_feat(header, HEADER_TRACE_INFO); 450 perf_header__set_feat(header, HEADER_TRACE_INFO);
449 } else { 451 } else {
@@ -527,7 +529,7 @@ static int __cmd_record(int argc, const char **argv)
527 if (hits == samples) { 529 if (hits == samples) {
528 if (done) 530 if (done)
529 break; 531 break;
530 ret = poll(event_array, nr_poll, -1); 532 err = poll(event_array, nr_poll, -1);
531 waking++; 533 waking++;
532 } 534 }
533 535