diff options
Diffstat (limited to 'tools/perf/builtin-report.c')
-rw-r--r-- | tools/perf/builtin-report.c | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index b8f47ded6287..68265120ee07 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -188,14 +188,14 @@ static int process_sample_event(event_t *event, struct perf_session *session) | |||
188 | return 0; | 188 | return 0; |
189 | 189 | ||
190 | if (perf_session__add_hist_entry(session, &al, &data)) { | 190 | if (perf_session__add_hist_entry(session, &al, &data)) { |
191 | pr_debug("problem incrementing symbol count, skipping event\n"); | 191 | pr_debug("problem incrementing symbol period, skipping event\n"); |
192 | return -1; | 192 | return -1; |
193 | } | 193 | } |
194 | 194 | ||
195 | attr = perf_header__find_attr(data.id, &session->header); | 195 | attr = perf_header__find_attr(data.id, &session->header); |
196 | 196 | ||
197 | if (add_event_total(session, &data, attr)) { | 197 | if (add_event_total(session, &data, attr)) { |
198 | pr_debug("problem adding event count\n"); | 198 | pr_debug("problem adding event period\n"); |
199 | return -1; | 199 | return -1; |
200 | } | 200 | } |
201 | 201 | ||
@@ -269,11 +269,25 @@ static struct perf_event_ops event_ops = { | |||
269 | 269 | ||
270 | extern volatile int session_done; | 270 | extern volatile int session_done; |
271 | 271 | ||
272 | static void sig_handler(int sig __attribute__((__unused__))) | 272 | static void sig_handler(int sig __used) |
273 | { | 273 | { |
274 | session_done = 1; | 274 | session_done = 1; |
275 | } | 275 | } |
276 | 276 | ||
277 | static size_t hists__fprintf_nr_sample_events(struct hists *self, | ||
278 | const char *evname, FILE *fp) | ||
279 | { | ||
280 | size_t ret; | ||
281 | char unit; | ||
282 | unsigned long nr_events = self->stats.nr_events[PERF_RECORD_SAMPLE]; | ||
283 | |||
284 | nr_events = convert_unit(nr_events, &unit); | ||
285 | ret = fprintf(fp, "# Events: %lu%c", nr_events, unit); | ||
286 | if (evname != NULL) | ||
287 | ret += fprintf(fp, " %s", evname); | ||
288 | return ret + fprintf(fp, "\n#\n"); | ||
289 | } | ||
290 | |||
277 | static int __cmd_report(void) | 291 | static int __cmd_report(void) |
278 | { | 292 | { |
279 | int ret = -EINVAL; | 293 | int ret = -EINVAL; |
@@ -319,14 +333,12 @@ static int __cmd_report(void) | |||
319 | if (use_browser) | 333 | if (use_browser) |
320 | hists__browse(hists, help, input_name); | 334 | hists__browse(hists, help, input_name); |
321 | else { | 335 | else { |
322 | if (rb_first(&session->hists.entries) == | 336 | const char *evname = NULL; |
337 | if (rb_first(&session->hists.entries) != | ||
323 | rb_last(&session->hists.entries)) | 338 | rb_last(&session->hists.entries)) |
324 | fprintf(stdout, "# Samples: %Ld\n#\n", | 339 | evname = __event_name(hists->type, hists->config); |
325 | hists->stats.total_period); | 340 | |
326 | else | 341 | hists__fprintf_nr_sample_events(hists, evname, stdout); |
327 | fprintf(stdout, "# Samples: %Ld %s\n#\n", | ||
328 | hists->stats.total_period, | ||
329 | __event_name(hists->type, hists->config)); | ||
330 | 342 | ||
331 | hists__fprintf(hists, NULL, false, stdout); | 343 | hists__fprintf(hists, NULL, false, stdout); |
332 | fprintf(stdout, "\n\n"); | 344 | fprintf(stdout, "\n\n"); |