diff options
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 bf491fda1f47..bb0fd6da2d56 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, | |||
189 | closedir(proc); | 189 | closedir(proc); |
190 | } | 190 | } |
191 | 191 | ||
192 | static void thread__comm_adjust(struct thread *self) | ||
193 | { | ||
194 | char *comm = self->comm; | ||
195 | |||
196 | if (!symbol_conf.col_width_list_str && !symbol_conf.field_sep && | ||
197 | (!symbol_conf.comm_list || | ||
198 | strlist__has_entry(symbol_conf.comm_list, comm))) { | ||
199 | unsigned int slen = strlen(comm); | ||
200 | |||
201 | if (slen > comms__col_width) { | ||
202 | comms__col_width = slen; | ||
203 | threads__col_width = slen + 6; | ||
204 | } | ||
205 | } | ||
206 | } | ||
207 | |||
208 | static int thread__set_comm_adjust(struct thread *self, const char *comm) | ||
209 | { | ||
210 | int ret = thread__set_comm(self, comm); | ||
211 | |||
212 | if (ret) | ||
213 | return ret; | ||
214 | |||
215 | thread__comm_adjust(self); | ||
216 | |||
217 | return 0; | ||
218 | } | ||
219 | |||
192 | int event__process_comm(event_t *self, struct perf_session *session) | 220 | int event__process_comm(event_t *self, struct perf_session *session) |
193 | { | 221 | { |
194 | struct thread *thread = perf_session__findnew(session, self->comm.pid); | 222 | struct thread *thread = perf_session__findnew(session, self->comm.pid); |
195 | 223 | ||
196 | dump_printf(": %s:%d\n", self->comm.comm, self->comm.pid); | 224 | dump_printf(": %s:%d\n", self->comm.comm, self->comm.pid); |
197 | 225 | ||
198 | if (thread == NULL || thread__set_comm(thread, self->comm.comm)) { | 226 | if (thread == NULL || thread__set_comm_adjust(thread, self->comm.comm)) { |
199 | dump_printf("problem processing PERF_RECORD_COMM, skipping event.\n"); | 227 | dump_printf("problem processing PERF_RECORD_COMM, skipping event.\n"); |
200 | return -1; | 228 | return -1; |
201 | } | 229 | } |