aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-trace.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/builtin-trace.c')
-rw-r--r--tools/perf/builtin-trace.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index fb3f3c220211..ccf867dbab5c 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -19,9 +19,6 @@ static char const *input_name = "perf.data";
19static unsigned long total = 0; 19static unsigned long total = 0;
20static unsigned long total_comm = 0; 20static unsigned long total_comm = 0;
21 21
22static struct rb_root threads;
23static struct thread *last_match;
24
25static struct perf_header *header; 22static struct perf_header *header;
26static u64 sample_type; 23static u64 sample_type;
27 24
@@ -32,9 +29,7 @@ static int cwdlen;
32static int 29static int
33process_comm_event(event_t *event, unsigned long offset, unsigned long head) 30process_comm_event(event_t *event, unsigned long offset, unsigned long head)
34{ 31{
35 struct thread *thread; 32 struct thread *thread = threads__findnew(event->comm.pid);
36
37 thread = threads__findnew(event->comm.pid, &threads, &last_match);
38 33
39 dump_printf("%p [%p]: PERF_RECORD_COMM: %s:%d\n", 34 dump_printf("%p [%p]: PERF_RECORD_COMM: %s:%d\n",
40 (void *)(offset + head), 35 (void *)(offset + head),
@@ -54,14 +49,12 @@ process_comm_event(event_t *event, unsigned long offset, unsigned long head)
54static int 49static int
55process_sample_event(event_t *event, unsigned long offset, unsigned long head) 50process_sample_event(event_t *event, unsigned long offset, unsigned long head)
56{ 51{
57 struct thread *thread;
58 u64 ip = event->ip.ip; 52 u64 ip = event->ip.ip;
59 u64 timestamp = -1; 53 u64 timestamp = -1;
60 u32 cpu = -1; 54 u32 cpu = -1;
61 u64 period = 1; 55 u64 period = 1;
62 void *more_data = event->ip.__more_data; 56 void *more_data = event->ip.__more_data;
63 57 struct thread *thread = threads__findnew(event->ip.pid);
64 thread = threads__findnew(event->ip.pid, &threads, &last_match);
65 58
66 if (sample_type & PERF_SAMPLE_TIME) { 59 if (sample_type & PERF_SAMPLE_TIME) {
67 timestamp = *(u64 *)more_data; 60 timestamp = *(u64 *)more_data;
@@ -135,7 +128,7 @@ static struct perf_file_handler file_handler = {
135 128
136static int __cmd_trace(void) 129static int __cmd_trace(void)
137{ 130{
138 register_idle_thread(&threads, &last_match); 131 register_idle_thread();
139 register_perf_file_handler(&file_handler); 132 register_perf_file_handler(&file_handler);
140 133
141 return mmap_dispatch_perf_file(&header, input_name, 0, 0, &cwdlen, &cwd); 134 return mmap_dispatch_perf_file(&header, input_name, 0, 0, &cwdlen, &cwd);