diff options
Diffstat (limited to 'tools/perf/builtin-trace.c')
| -rw-r--r-- | tools/perf/builtin-trace.c | 13 |
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"; | |||
| 19 | static unsigned long total = 0; | 19 | static unsigned long total = 0; |
| 20 | static unsigned long total_comm = 0; | 20 | static unsigned long total_comm = 0; |
| 21 | 21 | ||
| 22 | static struct rb_root threads; | ||
| 23 | static struct thread *last_match; | ||
| 24 | |||
| 25 | static struct perf_header *header; | 22 | static struct perf_header *header; |
| 26 | static u64 sample_type; | 23 | static u64 sample_type; |
| 27 | 24 | ||
| @@ -32,9 +29,7 @@ static int cwdlen; | |||
| 32 | static int | 29 | static int |
| 33 | process_comm_event(event_t *event, unsigned long offset, unsigned long head) | 30 | process_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) | |||
| 54 | static int | 49 | static int |
| 55 | process_sample_event(event_t *event, unsigned long offset, unsigned long head) | 50 | process_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 | ||
| 136 | static int __cmd_trace(void) | 129 | static 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); |
