aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util
diff options
context:
space:
mode:
authorJames Morris <james.l.morris@oracle.com>2012-05-03 22:46:40 -0400
committerJames Morris <james.l.morris@oracle.com>2012-05-03 22:46:40 -0400
commit898bfc1d46bd76f8ea2a0fbd239dd2073efe2aa3 (patch)
treee6e666085abe674dbf6292555961fe0a0f2e2d2f /tools/perf/util
parent08162e6a23d476544adfe1164afe9ea8b34ab859 (diff)
parent69964ea4c7b68c9399f7977aa5b9aa6539a6a98a (diff)
Merge tag 'v3.4-rc5' into next
Linux 3.4-rc5 Merge to pull in prerequisite change for Smack: 86812bb0de1a3758dc6c7aa01a763158a7c0638a Requested by Casey.
Diffstat (limited to 'tools/perf/util')
-rw-r--r--tools/perf/util/annotate.c16
-rw-r--r--tools/perf/util/hist.c12
-rw-r--r--tools/perf/util/map.c1
-rw-r--r--tools/perf/util/map.h1
-rw-r--r--tools/perf/util/parse-events.l2
-rw-r--r--tools/perf/util/session.c16
-rw-r--r--tools/perf/util/symbol.c13
-rw-r--r--tools/perf/util/ui/browsers/hists.c3
8 files changed, 42 insertions, 22 deletions
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 199f69ec656f..08c6d138a655 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -64,8 +64,8 @@ int symbol__inc_addr_samples(struct symbol *sym, struct map *map,
64 64
65 pr_debug3("%s: addr=%#" PRIx64 "\n", __func__, map->unmap_ip(map, addr)); 65 pr_debug3("%s: addr=%#" PRIx64 "\n", __func__, map->unmap_ip(map, addr));
66 66
67 if (addr > sym->end) 67 if (addr < sym->start || addr > sym->end)
68 return 0; 68 return -ERANGE;
69 69
70 offset = addr - sym->start; 70 offset = addr - sym->start;
71 h = annotation__histogram(notes, evidx); 71 h = annotation__histogram(notes, evidx);
@@ -561,16 +561,12 @@ void symbol__annotate_decay_histogram(struct symbol *sym, int evidx)
561{ 561{
562 struct annotation *notes = symbol__annotation(sym); 562 struct annotation *notes = symbol__annotation(sym);
563 struct sym_hist *h = annotation__histogram(notes, evidx); 563 struct sym_hist *h = annotation__histogram(notes, evidx);
564 struct objdump_line *pos; 564 int len = sym->end - sym->start, offset;
565 int len = sym->end - sym->start;
566 565
567 h->sum = 0; 566 h->sum = 0;
568 567 for (offset = 0; offset < len; ++offset) {
569 list_for_each_entry(pos, &notes->src->source, node) { 568 h->addr[offset] = h->addr[offset] * 7 / 8;
570 if (pos->offset != -1 && pos->offset < len) { 569 h->sum += h->addr[offset];
571 h->addr[pos->offset] = h->addr[pos->offset] * 7 / 8;
572 h->sum += h->addr[pos->offset];
573 }
574 } 570 }
575} 571}
576 572
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 2ec4b60aff6c..9f6d630d5316 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -256,6 +256,18 @@ static struct hist_entry *add_hist_entry(struct hists *hists,
256 if (!cmp) { 256 if (!cmp) {
257 he->period += period; 257 he->period += period;
258 ++he->nr_events; 258 ++he->nr_events;
259
260 /* If the map of an existing hist_entry has
261 * become out-of-date due to an exec() or
262 * similar, update it. Otherwise we will
263 * mis-adjust symbol addresses when computing
264 * the history counter to increment.
265 */
266 if (he->ms.map != entry->ms.map) {
267 he->ms.map = entry->ms.map;
268 if (he->ms.map)
269 he->ms.map->referenced = true;
270 }
259 goto out; 271 goto out;
260 } 272 }
261 273
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index dea6d1c1a954..35ae56864e4f 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -38,6 +38,7 @@ void map__init(struct map *self, enum map_type type,
38 RB_CLEAR_NODE(&self->rb_node); 38 RB_CLEAR_NODE(&self->rb_node);
39 self->groups = NULL; 39 self->groups = NULL;
40 self->referenced = false; 40 self->referenced = false;
41 self->erange_warned = false;
41} 42}
42 43
43struct map *map__new(struct list_head *dsos__list, u64 start, u64 len, 44struct map *map__new(struct list_head *dsos__list, u64 start, u64 len,
diff --git a/tools/perf/util/map.h b/tools/perf/util/map.h
index b100c20b7f94..81371bad4ef0 100644
--- a/tools/perf/util/map.h
+++ b/tools/perf/util/map.h
@@ -33,6 +33,7 @@ struct map {
33 u64 end; 33 u64 end;
34 u8 /* enum map_type */ type; 34 u8 /* enum map_type */ type;
35 bool referenced; 35 bool referenced;
36 bool erange_warned;
36 u32 priv; 37 u32 priv;
37 u64 pgoff; 38 u64 pgoff;
38 39
diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l
index 05d766e3ecb5..1fcf1bbc5458 100644
--- a/tools/perf/util/parse-events.l
+++ b/tools/perf/util/parse-events.l
@@ -54,7 +54,7 @@ num_dec [0-9]+
54num_hex 0x[a-fA-F0-9]+ 54num_hex 0x[a-fA-F0-9]+
55num_raw_hex [a-fA-F0-9]+ 55num_raw_hex [a-fA-F0-9]+
56name [a-zA-Z_*?][a-zA-Z0-9_*?]* 56name [a-zA-Z_*?][a-zA-Z0-9_*?]*
57modifier_event [ukhp]{1,5} 57modifier_event [ukhpGH]{1,8}
58modifier_bp [rwx] 58modifier_bp [rwx]
59 59
60%% 60%%
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 9412e3b05f68..1efd3bee6336 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -826,8 +826,16 @@ static struct machine *
826{ 826{
827 const u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK; 827 const u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
828 828
829 if (cpumode == PERF_RECORD_MISC_GUEST_KERNEL && perf_guest) 829 if (cpumode == PERF_RECORD_MISC_GUEST_KERNEL && perf_guest) {
830 return perf_session__find_machine(session, event->ip.pid); 830 u32 pid;
831
832 if (event->header.type == PERF_RECORD_MMAP)
833 pid = event->mmap.pid;
834 else
835 pid = event->ip.pid;
836
837 return perf_session__find_machine(session, pid);
838 }
831 839
832 return perf_session__find_host_machine(session); 840 return perf_session__find_host_machine(session);
833} 841}
@@ -868,11 +876,11 @@ static int perf_session_deliver_event(struct perf_session *session,
868 dump_sample(session, event, sample); 876 dump_sample(session, event, sample);
869 if (evsel == NULL) { 877 if (evsel == NULL) {
870 ++session->hists.stats.nr_unknown_id; 878 ++session->hists.stats.nr_unknown_id;
871 return -1; 879 return 0;
872 } 880 }
873 if (machine == NULL) { 881 if (machine == NULL) {
874 ++session->hists.stats.nr_unprocessable_samples; 882 ++session->hists.stats.nr_unprocessable_samples;
875 return -1; 883 return 0;
876 } 884 }
877 return tool->sample(tool, event, sample, evsel, machine); 885 return tool->sample(tool, event, sample, evsel, machine);
878 case PERF_RECORD_MMAP: 886 case PERF_RECORD_MMAP:
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index c0a028c3ebaf..ab9867b2b433 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -977,8 +977,9 @@ static Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep,
977 * And always look at the original dso, not at debuginfo packages, that 977 * And always look at the original dso, not at debuginfo packages, that
978 * have the PLT data stripped out (shdr_rel_plt.sh_type == SHT_NOBITS). 978 * have the PLT data stripped out (shdr_rel_plt.sh_type == SHT_NOBITS).
979 */ 979 */
980static int dso__synthesize_plt_symbols(struct dso *dso, struct map *map, 980static int
981 symbol_filter_t filter) 981dso__synthesize_plt_symbols(struct dso *dso, char *name, struct map *map,
982 symbol_filter_t filter)
982{ 983{
983 uint32_t nr_rel_entries, idx; 984 uint32_t nr_rel_entries, idx;
984 GElf_Sym sym; 985 GElf_Sym sym;
@@ -993,10 +994,7 @@ static int dso__synthesize_plt_symbols(struct dso *dso, struct map *map,
993 char sympltname[1024]; 994 char sympltname[1024];
994 Elf *elf; 995 Elf *elf;
995 int nr = 0, symidx, fd, err = 0; 996 int nr = 0, symidx, fd, err = 0;
996 char name[PATH_MAX];
997 997
998 snprintf(name, sizeof(name), "%s%s",
999 symbol_conf.symfs, dso->long_name);
1000 fd = open(name, O_RDONLY); 998 fd = open(name, O_RDONLY);
1001 if (fd < 0) 999 if (fd < 0)
1002 goto out; 1000 goto out;
@@ -1703,8 +1701,9 @@ restart:
1703 continue; 1701 continue;
1704 1702
1705 if (ret > 0) { 1703 if (ret > 0) {
1706 int nr_plt = dso__synthesize_plt_symbols(dso, map, 1704 int nr_plt;
1707 filter); 1705
1706 nr_plt = dso__synthesize_plt_symbols(dso, name, map, filter);
1708 if (nr_plt > 0) 1707 if (nr_plt > 0)
1709 ret += nr_plt; 1708 ret += nr_plt;
1710 break; 1709 break;
diff --git a/tools/perf/util/ui/browsers/hists.c b/tools/perf/util/ui/browsers/hists.c
index d7a1c4afe28b..2f83e5dc9967 100644
--- a/tools/perf/util/ui/browsers/hists.c
+++ b/tools/perf/util/ui/browsers/hists.c
@@ -125,6 +125,9 @@ static int callchain__count_rows(struct rb_root *chain)
125 125
126static bool map_symbol__toggle_fold(struct map_symbol *self) 126static bool map_symbol__toggle_fold(struct map_symbol *self)
127{ 127{
128 if (!self)
129 return false;
130
128 if (!self->has_children) 131 if (!self->has_children)
129 return false; 132 return false;
130 133