diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2009-10-13 10:16:29 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-10-13 11:12:18 -0400 |
commit | d5b889f2ecec7849e851ddd31c34bdfb3482b5de (patch) | |
tree | 001c95641ddf734a1e5e1fdee7e821f042c08f0b /tools/perf/builtin-trace.c | |
parent | f4f0b418188cc7995375acbb54e87c80f21861bd (diff) |
perf tools: Move threads & last_match to threads.c
This was just being copy'n'pasted all over.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Mike Galbraith <efault@gmx.de>
LKML-Reference: <20091013141629.GD21809@ghostprotocols.net>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
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); |