diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2009-12-15 17:04:42 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-12-16 02:53:50 -0500 |
commit | d599db3fc5dd4f1e8432fdbc6d899584b25f4dff (patch) | |
tree | fa455d1b9dede3983680d8ccb9dc25c14f4b45f6 /tools/perf/util/event.c | |
parent | c410a33887c17cac95ed8b0d860cdfb5c087a7d8 (diff) |
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 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 | } |