aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2011-03-04 12:51:33 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2011-03-05 20:31:04 -0500
commitd7603d5122d9700fb8f36fa08b04f4e900fef059 (patch)
tree092dca7764059cbd85903c3a470e717732d3b9e8 /tools
parenta03f35ceeb3d279da35c5a914ac01a4b1effb0a1 (diff)
perf hists: Remove needless global col lenght calcs
To support multiple events we need to do these calcs per 'struct hists' instance, and it turns out we already do that at: __hists__add_entry hists__inc_nr_entries hists__calc_col_len for all the unfiltered hist_entry instances we stash in the rb tree, so trow away the dead code. Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Cc: Tom Zanussi <tzanussi@gmail.com> LKML-Reference: <new-submission> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/util/event.c57
-rw-r--r--tools/perf/util/hist.c9
-rw-r--r--tools/perf/util/symbol.c1
-rw-r--r--tools/perf/util/symbol.h1
4 files changed, 10 insertions, 58 deletions
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index fbf5754c8866..2b15c362ef56 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -424,33 +424,6 @@ int perf_event__synthesize_kernel_mmap(perf_event__handler_t process,
424 return err; 424 return err;
425} 425}
426 426
427static void thread__comm_adjust(struct thread *self, struct hists *hists)
428{
429 char *comm = self->comm;
430
431 if (!symbol_conf.col_width_list_str && !symbol_conf.field_sep &&
432 (!symbol_conf.comm_list ||
433 strlist__has_entry(symbol_conf.comm_list, comm))) {
434 u16 slen = strlen(comm);
435
436 if (hists__new_col_len(hists, HISTC_COMM, slen))
437 hists__set_col_len(hists, HISTC_THREAD, slen + 6);
438 }
439}
440
441static int thread__set_comm_adjust(struct thread *self, const char *comm,
442 struct hists *hists)
443{
444 int ret = thread__set_comm(self, comm);
445
446 if (ret)
447 return ret;
448
449 thread__comm_adjust(self, hists);
450
451 return 0;
452}
453
454int perf_event__process_comm(union perf_event *event, 427int perf_event__process_comm(union perf_event *event,
455 struct perf_sample *sample __used, 428 struct perf_sample *sample __used,
456 struct perf_session *session) 429 struct perf_session *session)
@@ -459,8 +432,7 @@ int perf_event__process_comm(union perf_event *event,
459 432
460 dump_printf(": %s:%d\n", event->comm.comm, event->comm.tid); 433 dump_printf(": %s:%d\n", event->comm.comm, event->comm.tid);
461 434
462 if (thread == NULL || thread__set_comm_adjust(thread, event->comm.comm, 435 if (thread == NULL || thread__set_comm(thread, event->comm.comm)) {
463 &session->hists)) {
464 dump_printf("problem processing PERF_RECORD_COMM, skipping event.\n"); 436 dump_printf("problem processing PERF_RECORD_COMM, skipping event.\n");
465 return -1; 437 return -1;
466 } 438 }
@@ -760,18 +732,6 @@ void thread__find_addr_location(struct thread *self,
760 al->sym = NULL; 732 al->sym = NULL;
761} 733}
762 734
763static void dso__calc_col_width(struct dso *self, struct hists *hists)
764{
765 if (!symbol_conf.col_width_list_str && !symbol_conf.field_sep &&
766 (!symbol_conf.dso_list ||
767 strlist__has_entry(symbol_conf.dso_list, self->name))) {
768 u16 slen = dso__name_len(self);
769 hists__new_col_len(hists, HISTC_DSO, slen);
770 }
771
772 self->slen_calculated = 1;
773}
774
775int perf_event__preprocess_sample(const union perf_event *event, 735int perf_event__preprocess_sample(const union perf_event *event,
776 struct perf_session *session, 736 struct perf_session *session,
777 struct addr_location *al, 737 struct addr_location *al,
@@ -817,23 +777,8 @@ int perf_event__preprocess_sample(const union perf_event *event,
817 strlist__has_entry(symbol_conf.dso_list, 777 strlist__has_entry(symbol_conf.dso_list,
818 al->map->dso->long_name))))) 778 al->map->dso->long_name)))))
819 goto out_filtered; 779 goto out_filtered;
820 /*
821 * We have to do this here as we may have a dso with no symbol
822 * hit that has a name longer than the ones with symbols
823 * sampled.
824 */
825 if (!sort_dso.elide && !al->map->dso->slen_calculated)
826 dso__calc_col_width(al->map->dso, &session->hists);
827 780
828 al->sym = map__find_symbol(al->map, al->addr, filter); 781 al->sym = map__find_symbol(al->map, al->addr, filter);
829 } else {
830 const unsigned int unresolved_col_width = BITS_PER_LONG / 4;
831
832 if (hists__col_len(&session->hists, HISTC_DSO) < unresolved_col_width &&
833 !symbol_conf.col_width_list_str && !symbol_conf.field_sep &&
834 !symbol_conf.dso_list)
835 hists__set_col_len(&session->hists, HISTC_DSO,
836 unresolved_col_width);
837 } 782 }
838 783
839 if (symbol_conf.sym_list && al->sym && 784 if (symbol_conf.sym_list && al->sym &&
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index da2899e8c6f8..f7ad6bdbc667 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -50,6 +50,15 @@ static void hists__calc_col_len(struct hists *self, struct hist_entry *h)
50 50
51 if (h->ms.sym) 51 if (h->ms.sym)
52 hists__new_col_len(self, HISTC_SYMBOL, h->ms.sym->namelen); 52 hists__new_col_len(self, HISTC_SYMBOL, h->ms.sym->namelen);
53 else {
54 const unsigned int unresolved_col_width = BITS_PER_LONG / 4;
55
56 if (hists__col_len(self, HISTC_DSO) < unresolved_col_width &&
57 !symbol_conf.col_width_list_str && !symbol_conf.field_sep &&
58 !symbol_conf.dso_list)
59 hists__set_col_len(self, HISTC_DSO,
60 unresolved_col_width);
61 }
53 62
54 len = thread__comm_len(h->thread); 63 len = thread__comm_len(h->thread);
55 if (hists__new_col_len(self, HISTC_COMM, len)) 64 if (hists__new_col_len(self, HISTC_COMM, len))
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index ba6d48949092..00014e32c288 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -207,7 +207,6 @@ struct dso *dso__new(const char *name)
207 dso__set_short_name(self, self->name); 207 dso__set_short_name(self, self->name);
208 for (i = 0; i < MAP__NR_TYPES; ++i) 208 for (i = 0; i < MAP__NR_TYPES; ++i)
209 self->symbols[i] = self->symbol_names[i] = RB_ROOT; 209 self->symbols[i] = self->symbol_names[i] = RB_ROOT;
210 self->slen_calculated = 0;
211 self->origin = DSO__ORIG_NOT_FOUND; 210 self->origin = DSO__ORIG_NOT_FOUND;
212 self->loaded = 0; 211 self->loaded = 0;
213 self->sorted_by_name = 0; 212 self->sorted_by_name = 0;
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index 670cd1c88f54..4d7ed09fe332 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -132,7 +132,6 @@ struct dso {
132 struct rb_root symbol_names[MAP__NR_TYPES]; 132 struct rb_root symbol_names[MAP__NR_TYPES];
133 enum dso_kernel_type kernel; 133 enum dso_kernel_type kernel;
134 u8 adjust_symbols:1; 134 u8 adjust_symbols:1;
135 u8 slen_calculated:1;
136 u8 has_build_id:1; 135 u8 has_build_id:1;
137 u8 hit:1; 136 u8 hit:1;
138 u8 annotate_warned:1; 137 u8 annotate_warned:1;