diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2014-06-08 02:24:07 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2014-06-08 02:24:07 -0400 |
commit | a292241cccb7e20e8b997a9a44177e7c98141859 (patch) | |
tree | a0b0bb95e7dce3233a2d8b203f9e326cdec7a00e /tools/perf/builtin-report.c | |
parent | d49cb7aeebb974713f9f7ab2991352d3050b095b (diff) | |
parent | 68807a0c2015cb40df4869e16651f0ce5cc14d52 (diff) |
Merge branch 'next' into for-linus
Prepare input updates for 3.16.
Diffstat (limited to 'tools/perf/builtin-report.c')
-rw-r--r-- | tools/perf/builtin-report.c | 68 |
1 files changed, 35 insertions, 33 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 3c53ec268fbc..c8f21137dfd8 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -75,13 +75,10 @@ static int report__config(const char *var, const char *value, void *cb) | |||
75 | return perf_default_config(var, value, cb); | 75 | return perf_default_config(var, value, cb); |
76 | } | 76 | } |
77 | 77 | ||
78 | static int report__add_mem_hist_entry(struct perf_tool *tool, struct addr_location *al, | 78 | static int report__add_mem_hist_entry(struct report *rep, struct addr_location *al, |
79 | struct perf_sample *sample, struct perf_evsel *evsel, | 79 | struct perf_sample *sample, struct perf_evsel *evsel) |
80 | union perf_event *event) | ||
81 | { | 80 | { |
82 | struct report *rep = container_of(tool, struct report, tool); | ||
83 | struct symbol *parent = NULL; | 81 | struct symbol *parent = NULL; |
84 | u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK; | ||
85 | struct hist_entry *he; | 82 | struct hist_entry *he; |
86 | struct mem_info *mi, *mx; | 83 | struct mem_info *mi, *mx; |
87 | uint64_t cost; | 84 | uint64_t cost; |
@@ -90,7 +87,7 @@ static int report__add_mem_hist_entry(struct perf_tool *tool, struct addr_locati | |||
90 | if (err) | 87 | if (err) |
91 | return err; | 88 | return err; |
92 | 89 | ||
93 | mi = machine__resolve_mem(al->machine, al->thread, sample, cpumode); | 90 | mi = sample__resolve_mem(sample, al); |
94 | if (!mi) | 91 | if (!mi) |
95 | return -ENOMEM; | 92 | return -ENOMEM; |
96 | 93 | ||
@@ -113,14 +110,16 @@ static int report__add_mem_hist_entry(struct perf_tool *tool, struct addr_locati | |||
113 | if (!he) | 110 | if (!he) |
114 | return -ENOMEM; | 111 | return -ENOMEM; |
115 | 112 | ||
116 | err = hist_entry__inc_addr_samples(he, evsel->idx, al->addr); | 113 | if (ui__has_annotation()) { |
117 | if (err) | 114 | err = hist_entry__inc_addr_samples(he, evsel->idx, al->addr); |
118 | goto out; | 115 | if (err) |
116 | goto out; | ||
119 | 117 | ||
120 | mx = he->mem_info; | 118 | mx = he->mem_info; |
121 | err = addr_map_symbol__inc_samples(&mx->daddr, evsel->idx); | 119 | err = addr_map_symbol__inc_samples(&mx->daddr, evsel->idx); |
122 | if (err) | 120 | if (err) |
123 | goto out; | 121 | goto out; |
122 | } | ||
124 | 123 | ||
125 | evsel->hists.stats.total_period += cost; | 124 | evsel->hists.stats.total_period += cost; |
126 | hists__inc_nr_events(&evsel->hists, PERF_RECORD_SAMPLE); | 125 | hists__inc_nr_events(&evsel->hists, PERF_RECORD_SAMPLE); |
@@ -129,10 +128,9 @@ out: | |||
129 | return err; | 128 | return err; |
130 | } | 129 | } |
131 | 130 | ||
132 | static int report__add_branch_hist_entry(struct perf_tool *tool, struct addr_location *al, | 131 | static int report__add_branch_hist_entry(struct report *rep, struct addr_location *al, |
133 | struct perf_sample *sample, struct perf_evsel *evsel) | 132 | struct perf_sample *sample, struct perf_evsel *evsel) |
134 | { | 133 | { |
135 | struct report *rep = container_of(tool, struct report, tool); | ||
136 | struct symbol *parent = NULL; | 134 | struct symbol *parent = NULL; |
137 | unsigned i; | 135 | unsigned i; |
138 | struct hist_entry *he; | 136 | struct hist_entry *he; |
@@ -142,8 +140,7 @@ static int report__add_branch_hist_entry(struct perf_tool *tool, struct addr_loc | |||
142 | if (err) | 140 | if (err) |
143 | return err; | 141 | return err; |
144 | 142 | ||
145 | bi = machine__resolve_bstack(al->machine, al->thread, | 143 | bi = sample__resolve_bstack(sample, al); |
146 | sample->branch_stack); | ||
147 | if (!bi) | 144 | if (!bi) |
148 | return -ENOMEM; | 145 | return -ENOMEM; |
149 | 146 | ||
@@ -164,14 +161,18 @@ static int report__add_branch_hist_entry(struct perf_tool *tool, struct addr_loc | |||
164 | he = __hists__add_entry(&evsel->hists, al, parent, &bi[i], NULL, | 161 | he = __hists__add_entry(&evsel->hists, al, parent, &bi[i], NULL, |
165 | 1, 1, 0); | 162 | 1, 1, 0); |
166 | if (he) { | 163 | if (he) { |
167 | bx = he->branch_info; | 164 | if (ui__has_annotation()) { |
168 | err = addr_map_symbol__inc_samples(&bx->from, evsel->idx); | 165 | bx = he->branch_info; |
169 | if (err) | 166 | err = addr_map_symbol__inc_samples(&bx->from, |
170 | goto out; | 167 | evsel->idx); |
171 | 168 | if (err) | |
172 | err = addr_map_symbol__inc_samples(&bx->to, evsel->idx); | 169 | goto out; |
173 | if (err) | 170 | |
174 | goto out; | 171 | err = addr_map_symbol__inc_samples(&bx->to, |
172 | evsel->idx); | ||
173 | if (err) | ||
174 | goto out; | ||
175 | } | ||
175 | 176 | ||
176 | evsel->hists.stats.total_period += 1; | 177 | evsel->hists.stats.total_period += 1; |
177 | hists__inc_nr_events(&evsel->hists, PERF_RECORD_SAMPLE); | 178 | hists__inc_nr_events(&evsel->hists, PERF_RECORD_SAMPLE); |
@@ -184,10 +185,9 @@ out: | |||
184 | return err; | 185 | return err; |
185 | } | 186 | } |
186 | 187 | ||
187 | static int report__add_hist_entry(struct perf_tool *tool, struct perf_evsel *evsel, | 188 | static int report__add_hist_entry(struct report *rep, struct perf_evsel *evsel, |
188 | struct addr_location *al, struct perf_sample *sample) | 189 | struct addr_location *al, struct perf_sample *sample) |
189 | { | 190 | { |
190 | struct report *rep = container_of(tool, struct report, tool); | ||
191 | struct symbol *parent = NULL; | 191 | struct symbol *parent = NULL; |
192 | struct hist_entry *he; | 192 | struct hist_entry *he; |
193 | int err = sample__resolve_callchain(sample, &parent, evsel, al, rep->max_stack); | 193 | int err = sample__resolve_callchain(sample, &parent, evsel, al, rep->max_stack); |
@@ -205,7 +205,9 @@ static int report__add_hist_entry(struct perf_tool *tool, struct perf_evsel *evs | |||
205 | if (err) | 205 | if (err) |
206 | goto out; | 206 | goto out; |
207 | 207 | ||
208 | err = hist_entry__inc_addr_samples(he, evsel->idx, al->addr); | 208 | if (ui__has_annotation()) |
209 | err = hist_entry__inc_addr_samples(he, evsel->idx, al->addr); | ||
210 | |||
209 | evsel->hists.stats.total_period += sample->period; | 211 | evsel->hists.stats.total_period += sample->period; |
210 | hists__inc_nr_events(&evsel->hists, PERF_RECORD_SAMPLE); | 212 | hists__inc_nr_events(&evsel->hists, PERF_RECORD_SAMPLE); |
211 | out: | 213 | out: |
@@ -229,25 +231,25 @@ static int process_sample_event(struct perf_tool *tool, | |||
229 | return -1; | 231 | return -1; |
230 | } | 232 | } |
231 | 233 | ||
232 | if (al.filtered || (rep->hide_unresolved && al.sym == NULL)) | 234 | if (rep->hide_unresolved && al.sym == NULL) |
233 | return 0; | 235 | return 0; |
234 | 236 | ||
235 | if (rep->cpu_list && !test_bit(sample->cpu, rep->cpu_bitmap)) | 237 | if (rep->cpu_list && !test_bit(sample->cpu, rep->cpu_bitmap)) |
236 | return 0; | 238 | return 0; |
237 | 239 | ||
238 | if (sort__mode == SORT_MODE__BRANCH) { | 240 | if (sort__mode == SORT_MODE__BRANCH) { |
239 | ret = report__add_branch_hist_entry(tool, &al, sample, evsel); | 241 | ret = report__add_branch_hist_entry(rep, &al, sample, evsel); |
240 | if (ret < 0) | 242 | if (ret < 0) |
241 | pr_debug("problem adding lbr entry, skipping event\n"); | 243 | pr_debug("problem adding lbr entry, skipping event\n"); |
242 | } else if (rep->mem_mode == 1) { | 244 | } else if (rep->mem_mode == 1) { |
243 | ret = report__add_mem_hist_entry(tool, &al, sample, evsel, event); | 245 | ret = report__add_mem_hist_entry(rep, &al, sample, evsel); |
244 | if (ret < 0) | 246 | if (ret < 0) |
245 | pr_debug("problem adding mem entry, skipping event\n"); | 247 | pr_debug("problem adding mem entry, skipping event\n"); |
246 | } else { | 248 | } else { |
247 | if (al.map != NULL) | 249 | if (al.map != NULL) |
248 | al.map->dso->hit = 1; | 250 | al.map->dso->hit = 1; |
249 | 251 | ||
250 | ret = report__add_hist_entry(tool, evsel, &al, sample); | 252 | ret = report__add_hist_entry(rep, evsel, &al, sample); |
251 | if (ret < 0) | 253 | if (ret < 0) |
252 | pr_debug("problem incrementing symbol period, skipping event\n"); | 254 | pr_debug("problem incrementing symbol period, skipping event\n"); |
253 | } | 255 | } |
@@ -926,7 +928,7 @@ repeat: | |||
926 | * so don't allocate extra space that won't be used in the stdio | 928 | * so don't allocate extra space that won't be used in the stdio |
927 | * implementation. | 929 | * implementation. |
928 | */ | 930 | */ |
929 | if (use_browser == 1 && sort__has_sym) { | 931 | if (ui__has_annotation()) { |
930 | symbol_conf.priv_size = sizeof(struct annotation); | 932 | symbol_conf.priv_size = sizeof(struct annotation); |
931 | machines__set_symbol_filter(&session->machines, | 933 | machines__set_symbol_filter(&session->machines, |
932 | symbol__annotate_init); | 934 | symbol__annotate_init); |