summaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-report.c
diff options
context:
space:
mode:
authorFrederic Weisbecker <fweisbec@gmail.com>2009-08-31 06:45:18 +0200
committerIngo Molnar <mingo@elte.hu>2009-08-31 10:04:48 +0200
commit5b447a6a13ea823b698bf4c01193654fd7ebf4ec (patch)
tree7d3e1c20cf2fe4dbeb1a64910ace3e222bc6ad6a /tools/perf/builtin-report.c
parentec7ba4ea1d605029fb09601ab4ad3053bc1f519c (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.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index cdd46ab11bd..cdf9a8d27bb 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)
self->slen_calculated = 1;
}
-static int thread__set_comm_adjust(struct thread *self, const char *comm)
+static void thread__comm_adjust(struct thread *self)
{
- int ret = thread__set_comm(self, comm);
-
- if (ret)
- return ret;
+ char *comm = self->comm;
if (!col_width_list_str && !field_sep &&
(!comm_list || strlist__has_entry(comm_list, comm))) {
@@ -682,6 +679,16 @@ static int thread__set_comm_adjust(struct thread *self, const char *comm)
threads__col_width = slen + 6;
}
}
+}
+
+static int thread__set_comm_adjust(struct thread *self, const char *comm)
+{
+ int ret = thread__set_comm(self, comm);
+
+ if (ret)
+ return ret;
+
+ thread__comm_adjust(self);
return 0;
}
@@ -1073,17 +1080,6 @@ print_entries:
return ret;
}
-static void register_idle_thread(void)
-{
- struct thread *thread = threads__findnew(0, &threads, &last_match);
-
- if (thread == NULL ||
- thread__set_comm_adjust(thread, "[idle]")) {
- fprintf(stderr, "problem inserting idle task.\n");
- exit(-1);
- }
-}
-
static unsigned long total = 0,
total_mmap = 0,
total_comm = 0,
@@ -1381,11 +1377,13 @@ static int __cmd_report(void)
unsigned long offset = 0;
unsigned long head, shift;
struct stat input_stat;
+ struct thread *idle;
event_t *event;
uint32_t size;
char *buf;
- register_idle_thread();
+ idle = register_idle_thread(&threads, &last_match);
+ thread__comm_adjust(idle);
if (show_threads)
perf_read_values_init(&show_threads_values);