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>
This commit is contained in:
committed by
Ingo Molnar
parent
c410a33887
commit
d599db3fc5
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user