diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2009-12-15 20:04:42 -0200 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-12-16 08:53:50 +0100 |
commit | d599db3fc5dd4f1e8432fdbc6d899584b25f4dff (patch) | |
tree | fa455d1b9dede3983680d8ccb9dc25c14f4b45f6 /tools/perf/util/event.c | |
parent | c410a33887c17cac95ed8b0d860cdfb5c087a7d8 (diff) | |
download | op-kernel-dev-d599db3fc5dd4f1e8432fdbc6d899584b25f4dff.zip op-kernel-dev-d599db3fc5dd4f1e8432fdbc6d899584b25f4dff.tar.gz |
perf report: Generalize perf_session__fprintf_hists()
Pull it out of builtin-report - further changes will be made and it
will then be reusable in 'perf diff' as well.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1260914682-29652-4-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/util/event.c')
-rw-r--r-- | tools/perf/util/event.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index bf491fd..bb0fd6d 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c @@ -189,13 +189,41 @@ void event__synthesize_threads(int (*process)(event_t *event, closedir(proc); } +static void thread__comm_adjust(struct thread *self) +{ + char *comm = self->comm; + + if (!symbol_conf.col_width_list_str && !symbol_conf.field_sep && + (!symbol_conf.comm_list || + strlist__has_entry(symbol_conf.comm_list, comm))) { + unsigned int slen = strlen(comm); + + if (slen > comms__col_width) { + comms__col_width = slen; + 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; +} + int event__process_comm(event_t *self, struct perf_session *session) { struct thread *thread = perf_session__findnew(session, self->comm.pid); dump_printf(": %s:%d\n", self->comm.comm, self->comm.pid); - if (thread == NULL || thread__set_comm(thread, self->comm.comm)) { + if (thread == NULL || thread__set_comm_adjust(thread, self->comm.comm)) { dump_printf("problem processing PERF_RECORD_COMM, skipping event.\n"); return -1; } |