diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2009-08-31 00:45:18 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-08-31 04:04:48 -0400 |
commit | 5b447a6a13ea823b698bf4c01193654fd7ebf4ec (patch) | |
tree | 7d3e1c20cf2fe4dbeb1a64910ace3e222bc6ad6a /tools/perf/builtin-report.c | |
parent | ec7ba4ea1d605029fb09601ab4ad3053bc1f519c (diff) |
perf tools: Librarize idle thread registration
Librarize register_idle_thread() used by annotate and report.
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <1251693921-6579-1-git-send-email-fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/builtin-report.c')
-rw-r--r-- | tools/perf/builtin-report.c | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index cdd46ab11bd5..cdf9a8d27bb9 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -666,12 +666,9 @@ static void dso__calc_col_width(struct dso *self) | |||
666 | self->slen_calculated = 1; | 666 | self->slen_calculated = 1; |
667 | } | 667 | } |
668 | 668 | ||
669 | static int thread__set_comm_adjust(struct thread *self, const char *comm) | 669 | static void thread__comm_adjust(struct thread *self) |
670 | { | 670 | { |
671 | int ret = thread__set_comm(self, comm); | 671 | char *comm = self->comm; |
672 | |||
673 | if (ret) | ||
674 | return ret; | ||
675 | 672 | ||
676 | if (!col_width_list_str && !field_sep && | 673 | if (!col_width_list_str && !field_sep && |
677 | (!comm_list || strlist__has_entry(comm_list, comm))) { | 674 | (!comm_list || strlist__has_entry(comm_list, comm))) { |
@@ -682,6 +679,16 @@ static int thread__set_comm_adjust(struct thread *self, const char *comm) | |||
682 | threads__col_width = slen + 6; | 679 | threads__col_width = slen + 6; |
683 | } | 680 | } |
684 | } | 681 | } |
682 | } | ||
683 | |||
684 | static int thread__set_comm_adjust(struct thread *self, const char *comm) | ||
685 | { | ||
686 | int ret = thread__set_comm(self, comm); | ||
687 | |||
688 | if (ret) | ||
689 | return ret; | ||
690 | |||
691 | thread__comm_adjust(self); | ||
685 | 692 | ||
686 | return 0; | 693 | return 0; |
687 | } | 694 | } |
@@ -1073,17 +1080,6 @@ print_entries: | |||
1073 | return ret; | 1080 | return ret; |
1074 | } | 1081 | } |
1075 | 1082 | ||
1076 | static void register_idle_thread(void) | ||
1077 | { | ||
1078 | struct thread *thread = threads__findnew(0, &threads, &last_match); | ||
1079 | |||
1080 | if (thread == NULL || | ||
1081 | thread__set_comm_adjust(thread, "[idle]")) { | ||
1082 | fprintf(stderr, "problem inserting idle task.\n"); | ||
1083 | exit(-1); | ||
1084 | } | ||
1085 | } | ||
1086 | |||
1087 | static unsigned long total = 0, | 1083 | static unsigned long total = 0, |
1088 | total_mmap = 0, | 1084 | total_mmap = 0, |
1089 | total_comm = 0, | 1085 | total_comm = 0, |
@@ -1381,11 +1377,13 @@ static int __cmd_report(void) | |||
1381 | unsigned long offset = 0; | 1377 | unsigned long offset = 0; |
1382 | unsigned long head, shift; | 1378 | unsigned long head, shift; |
1383 | struct stat input_stat; | 1379 | struct stat input_stat; |
1380 | struct thread *idle; | ||
1384 | event_t *event; | 1381 | event_t *event; |
1385 | uint32_t size; | 1382 | uint32_t size; |
1386 | char *buf; | 1383 | char *buf; |
1387 | 1384 | ||
1388 | register_idle_thread(); | 1385 | idle = register_idle_thread(&threads, &last_match); |
1386 | thread__comm_adjust(idle); | ||
1389 | 1387 | ||
1390 | if (show_threads) | 1388 | if (show_threads) |
1391 | perf_read_values_init(&show_threads_values); | 1389 | perf_read_values_init(&show_threads_values); |