aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-report.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2009-10-13 10:16:29 -0400
committerIngo Molnar <mingo@elte.hu>2009-10-13 11:12:18 -0400
commitd5b889f2ecec7849e851ddd31c34bdfb3482b5de (patch)
tree001c95641ddf734a1e5e1fdee7e821f042c08f0b /tools/perf/builtin-report.c
parentf4f0b418188cc7995375acbb54e87c80f21861bd (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-report.c')
-rw-r--r--tools/perf/builtin-report.c26
1 files changed, 7 insertions, 19 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index f57a23b19f3c..015c79745966 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -55,9 +55,6 @@ static char callchain_default_opt[] = "fractal,0.5";
55static char *cwd; 55static char *cwd;
56static int cwdlen; 56static int cwdlen;
57 57
58static struct rb_root threads;
59static struct thread *last_match;
60
61static struct perf_header *header; 58static struct perf_header *header;
62 59
63static u64 sample_type; 60static u64 sample_type;
@@ -593,15 +590,13 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head)
593{ 590{
594 char level; 591 char level;
595 struct symbol *sym = NULL; 592 struct symbol *sym = NULL;
596 struct thread *thread;
597 u64 ip = event->ip.ip; 593 u64 ip = event->ip.ip;
598 u64 period = 1; 594 u64 period = 1;
599 struct map *map = NULL; 595 struct map *map = NULL;
600 void *more_data = event->ip.__more_data; 596 void *more_data = event->ip.__more_data;
601 struct ip_callchain *chain = NULL; 597 struct ip_callchain *chain = NULL;
602 int cpumode; 598 int cpumode;
603 599 struct thread *thread = threads__findnew(event->ip.pid);
604 thread = threads__findnew(event->ip.pid, &threads, &last_match);
605 600
606 if (sample_type & PERF_SAMPLE_PERIOD) { 601 if (sample_type & PERF_SAMPLE_PERIOD) {
607 period = *(u64 *)more_data; 602 period = *(u64 *)more_data;
@@ -685,10 +680,8 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head)
685static int 680static int
686process_mmap_event(event_t *event, unsigned long offset, unsigned long head) 681process_mmap_event(event_t *event, unsigned long offset, unsigned long head)
687{ 682{
688 struct thread *thread;
689 struct map *map = map__new(&event->mmap, cwd, cwdlen); 683 struct map *map = map__new(&event->mmap, cwd, cwdlen);
690 684 struct thread *thread = threads__findnew(event->mmap.pid);
691 thread = threads__findnew(event->mmap.pid, &threads, &last_match);
692 685
693 dump_printf("%p [%p]: PERF_RECORD_MMAP %d/%d: [%p(%p) @ %p]: %s\n", 686 dump_printf("%p [%p]: PERF_RECORD_MMAP %d/%d: [%p(%p) @ %p]: %s\n",
694 (void *)(offset + head), 687 (void *)(offset + head),
@@ -714,9 +707,7 @@ process_mmap_event(event_t *event, unsigned long offset, unsigned long head)
714static int 707static int
715process_comm_event(event_t *event, unsigned long offset, unsigned long head) 708process_comm_event(event_t *event, unsigned long offset, unsigned long head)
716{ 709{
717 struct thread *thread; 710 struct thread *thread = threads__findnew(event->comm.pid);
718
719 thread = threads__findnew(event->comm.pid, &threads, &last_match);
720 711
721 dump_printf("%p [%p]: PERF_RECORD_COMM: %s:%d\n", 712 dump_printf("%p [%p]: PERF_RECORD_COMM: %s:%d\n",
722 (void *)(offset + head), 713 (void *)(offset + head),
@@ -736,11 +727,8 @@ process_comm_event(event_t *event, unsigned long offset, unsigned long head)
736static int 727static int
737process_task_event(event_t *event, unsigned long offset, unsigned long head) 728process_task_event(event_t *event, unsigned long offset, unsigned long head)
738{ 729{
739 struct thread *thread; 730 struct thread *thread = threads__findnew(event->fork.pid);
740 struct thread *parent; 731 struct thread *parent = threads__findnew(event->fork.ppid);
741
742 thread = threads__findnew(event->fork.pid, &threads, &last_match);
743 parent = threads__findnew(event->fork.ppid, &threads, &last_match);
744 732
745 dump_printf("%p [%p]: PERF_RECORD_%s: (%d:%d):(%d:%d)\n", 733 dump_printf("%p [%p]: PERF_RECORD_%s: (%d:%d):(%d:%d)\n",
746 (void *)(offset + head), 734 (void *)(offset + head),
@@ -857,7 +845,7 @@ static int __cmd_report(void)
857 struct thread *idle; 845 struct thread *idle;
858 int ret; 846 int ret;
859 847
860 idle = register_idle_thread(&threads, &last_match); 848 idle = register_idle_thread();
861 thread__comm_adjust(idle); 849 thread__comm_adjust(idle);
862 850
863 if (show_threads) 851 if (show_threads)
@@ -881,7 +869,7 @@ static int __cmd_report(void)
881 return 0; 869 return 0;
882 870
883 if (verbose > 3) 871 if (verbose > 3)
884 threads__fprintf(stdout, &threads); 872 threads__fprintf(stdout);
885 873
886 if (verbose > 2) 874 if (verbose > 2)
887 dsos__fprintf(stdout); 875 dsos__fprintf(stdout);