aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-report.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/builtin-report.c')
-rw-r--r--tools/perf/builtin-report.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 2b9eb3a553ed..e2ec49a9b731 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -22,6 +22,7 @@
22#include "perf.h" 22#include "perf.h"
23#include "util/debug.h" 23#include "util/debug.h"
24#include "util/header.h" 24#include "util/header.h"
25#include "util/session.h"
25 26
26#include "util/parse-options.h" 27#include "util/parse-options.h"
27#include "util/parse-events.h" 28#include "util/parse-events.h"
@@ -52,7 +53,7 @@ static int exclude_other = 1;
52 53
53static char callchain_default_opt[] = "fractal,0.5"; 54static char callchain_default_opt[] = "fractal,0.5";
54 55
55static struct perf_header *header; 56static struct perf_session *session;
56 57
57static u64 sample_type; 58static u64 sample_type;
58 59
@@ -701,7 +702,7 @@ static int process_read_event(event_t *event)
701{ 702{
702 struct perf_event_attr *attr; 703 struct perf_event_attr *attr;
703 704
704 attr = perf_header__find_attr(event->read.id, header); 705 attr = perf_header__find_attr(event->read.id, &session->header);
705 706
706 if (show_threads) { 707 if (show_threads) {
707 const char *name = attr ? __event_name(attr->type, attr->config) 708 const char *name = attr ? __event_name(attr->type, attr->config)
@@ -766,6 +767,10 @@ static int __cmd_report(void)
766 struct thread *idle; 767 struct thread *idle;
767 int ret; 768 int ret;
768 769
770 session = perf_session__new(input_name, O_RDONLY, force);
771 if (session == NULL)
772 return -ENOMEM;
773
769 idle = register_idle_thread(); 774 idle = register_idle_thread();
770 thread__comm_adjust(idle); 775 thread__comm_adjust(idle);
771 776
@@ -774,14 +779,14 @@ static int __cmd_report(void)
774 779
775 register_perf_file_handler(&file_handler); 780 register_perf_file_handler(&file_handler);
776 781
777 ret = mmap_dispatch_perf_file(&header, input_name, force, 782 ret = perf_session__process_events(session, full_paths,
778 full_paths, &event__cwdlen, &event__cwd); 783 &event__cwdlen, &event__cwd);
779 if (ret) 784 if (ret)
780 return ret; 785 goto out_delete;
781 786
782 if (dump_trace) { 787 if (dump_trace) {
783 event__print_totals(); 788 event__print_totals();
784 return 0; 789 goto out_delete;
785 } 790 }
786 791
787 if (verbose > 3) 792 if (verbose > 3)
@@ -796,7 +801,8 @@ static int __cmd_report(void)
796 801
797 if (show_threads) 802 if (show_threads)
798 perf_read_values_destroy(&show_threads_values); 803 perf_read_values_destroy(&show_threads_values);
799 804out_delete:
805 perf_session__delete(session);
800 return ret; 806 return ret;
801} 807}
802 808