From da7a6022d2a35fb3744467a51ba5998d68fdd412 Mon Sep 17 00:00:00 2001 From: Frederic Weisbecker Date: Tue, 18 Aug 2009 16:03:46 +0200 Subject: [PATCH] --- yaml --- r: 158271 b: refs/heads/master c: 4273b005875c34beda4a11c9d4a9132d80378036 h: refs/heads/master i: 158269: 69d2328162a4df41ef7592b17046729ec34e821f 158267: cdfd931ad8d48c5c35b64f43cb9ba575a0b0f626 158263: 0d8b427516e0d4fb2c0a5bf6dd3e2b80f9e087cb 158255: c99ed928300bf3486b5cb4b45e909112861f93fe 158239: 4e518950b8955c55a9dde06968f84b5f927ee7b1 158207: 09c818ffd82f75cdad1376b6f2cbc9b05d5de57e v: v3 --- [refs] | 2 +- trunk/tools/perf/builtin-report.c | 25 +++++++++++++++++++++++-- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 7df400fc3fd8..fd94717658c3 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 1f18345bdfd489fde1085bc85839d5d3645cf511 +refs/heads/master: 4273b005875c34beda4a11c9d4a9132d80378036 diff --git a/trunk/tools/perf/builtin-report.c b/trunk/tools/perf/builtin-report.c index 1e3ad22d53dc..3fc0d471b90b 100644 --- a/trunk/tools/perf/builtin-report.c +++ b/trunk/tools/perf/builtin-report.c @@ -665,6 +665,27 @@ 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) +{ + int ret = thread__set_comm(self, comm); + + if (ret) + return ret; + + if (!col_width_list_str && !field_sep && + (!comm_list || strlist__has_entry(comm_list, comm))) { + unsigned int slen = strlen(comm); + + if (slen > comms__col_width) { + comms__col_width = slen; + threads__col_width = slen + 6; + } + } + + return 0; +} + + static struct symbol * resolve_symbol(struct thread *thread, struct map **mapp, struct dso **dsop, u64 *ipp) @@ -1056,7 +1077,7 @@ static void register_idle_thread(void) struct thread *thread = threads__findnew(0, &threads, &last_match); if (thread == NULL || - thread__set_comm(thread, "[idle]")) { + thread__set_comm_adjust(thread, "[idle]")) { fprintf(stderr, "problem inserting idle task.\n"); exit(-1); } @@ -1226,7 +1247,7 @@ process_comm_event(event_t *event, unsigned long offset, unsigned long head) event->comm.comm, event->comm.pid); if (thread == NULL || - thread__set_comm(thread, event->comm.comm)) { + thread__set_comm_adjust(thread, event->comm.comm)) { dump_printf("problem processing PERF_EVENT_COMM, skipping event.\n"); return -1; }