aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/event.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2010-07-20 13:42:52 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2010-07-23 07:55:59 -0400
commit8a6c5b261c1188379469807d84bfb1365d0f6823 (patch)
treeb18ac8d951c33a480bd7c0a743d341d0e9bf3e90 /tools/perf/util/event.c
parent7a007ca90b7c465137de06795ef4d5faa10f459e (diff)
perf sort: Make column width code per hists instance
They were globals, and since we support multiple hists and sessions at the same time, it doesn't make sense to calculate those values considereing all symbols in all sessions. Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> LKML-Reference: <new-submission> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/event.c')
-rw-r--r--tools/perf/util/event.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index d7f21d71eb69..121339f4360d 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -340,30 +340,29 @@ int event__synthesize_kernel_mmap(event__handler_t process,
340 return process(&ev, session); 340 return process(&ev, session);
341} 341}
342 342
343static void thread__comm_adjust(struct thread *self) 343static void thread__comm_adjust(struct thread *self, struct hists *hists)
344{ 344{
345 char *comm = self->comm; 345 char *comm = self->comm;
346 346
347 if (!symbol_conf.col_width_list_str && !symbol_conf.field_sep && 347 if (!symbol_conf.col_width_list_str && !symbol_conf.field_sep &&
348 (!symbol_conf.comm_list || 348 (!symbol_conf.comm_list ||
349 strlist__has_entry(symbol_conf.comm_list, comm))) { 349 strlist__has_entry(symbol_conf.comm_list, comm))) {
350 unsigned int slen = strlen(comm); 350 u16 slen = strlen(comm);
351 351
352 if (slen > comms__col_width) { 352 if (hists__new_col_len(hists, HISTC_COMM, slen))
353 comms__col_width = slen; 353 hists__set_col_len(hists, HISTC_THREAD, slen + 6);
354 threads__col_width = slen + 6;
355 }
356 } 354 }
357} 355}
358 356
359static int thread__set_comm_adjust(struct thread *self, const char *comm) 357static int thread__set_comm_adjust(struct thread *self, const char *comm,
358 struct hists *hists)
360{ 359{
361 int ret = thread__set_comm(self, comm); 360 int ret = thread__set_comm(self, comm);
362 361
363 if (ret) 362 if (ret)
364 return ret; 363 return ret;
365 364
366 thread__comm_adjust(self); 365 thread__comm_adjust(self, hists);
367 366
368 return 0; 367 return 0;
369} 368}
@@ -374,7 +373,8 @@ int event__process_comm(event_t *self, struct perf_session *session)
374 373
375 dump_printf(": %s:%d\n", self->comm.comm, self->comm.tid); 374 dump_printf(": %s:%d\n", self->comm.comm, self->comm.tid);
376 375
377 if (thread == NULL || thread__set_comm_adjust(thread, self->comm.comm)) { 376 if (thread == NULL || thread__set_comm_adjust(thread, self->comm.comm,
377 &session->hists)) {
378 dump_printf("problem processing PERF_RECORD_COMM, skipping event.\n"); 378 dump_printf("problem processing PERF_RECORD_COMM, skipping event.\n");
379 return -1; 379 return -1;
380 } 380 }
@@ -641,16 +641,13 @@ void thread__find_addr_location(struct thread *self,
641 al->sym = NULL; 641 al->sym = NULL;
642} 642}
643 643
644static void dso__calc_col_width(struct dso *self) 644static void dso__calc_col_width(struct dso *self, struct hists *hists)
645{ 645{
646 if (!symbol_conf.col_width_list_str && !symbol_conf.field_sep && 646 if (!symbol_conf.col_width_list_str && !symbol_conf.field_sep &&
647 (!symbol_conf.dso_list || 647 (!symbol_conf.dso_list ||
648 strlist__has_entry(symbol_conf.dso_list, self->name))) { 648 strlist__has_entry(symbol_conf.dso_list, self->name))) {
649 u16 slen = self->short_name_len; 649 u16 slen = dso__name_len(self);
650 if (verbose) 650 hists__new_col_len(hists, HISTC_DSO, slen);
651 slen = self->long_name_len;
652 if (dsos__col_width < slen)
653 dsos__col_width = slen;
654 } 651 }
655 652
656 self->slen_calculated = 1; 653 self->slen_calculated = 1;
@@ -729,16 +726,17 @@ int event__preprocess_sample(const event_t *self, struct perf_session *session,
729 * sampled. 726 * sampled.
730 */ 727 */
731 if (!sort_dso.elide && !al->map->dso->slen_calculated) 728 if (!sort_dso.elide && !al->map->dso->slen_calculated)
732 dso__calc_col_width(al->map->dso); 729 dso__calc_col_width(al->map->dso, &session->hists);
733 730
734 al->sym = map__find_symbol(al->map, al->addr, filter); 731 al->sym = map__find_symbol(al->map, al->addr, filter);
735 } else { 732 } else {
736 const unsigned int unresolved_col_width = BITS_PER_LONG / 4; 733 const unsigned int unresolved_col_width = BITS_PER_LONG / 4;
737 734
738 if (dsos__col_width < unresolved_col_width && 735 if (hists__col_len(&session->hists, HISTC_DSO) < unresolved_col_width &&
739 !symbol_conf.col_width_list_str && !symbol_conf.field_sep && 736 !symbol_conf.col_width_list_str && !symbol_conf.field_sep &&
740 !symbol_conf.dso_list) 737 !symbol_conf.dso_list)
741 dsos__col_width = unresolved_col_width; 738 hists__set_col_len(&session->hists, HISTC_DSO,
739 unresolved_col_width);
742 } 740 }
743 741
744 if (symbol_conf.sym_list && al->sym && 742 if (symbol_conf.sym_list && al->sym &&