aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/ui/stdio/hist.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/ui/stdio/hist.c')
-rw-r--r--tools/perf/ui/stdio/hist.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
index 1340c93aa61..850c6d293f4 100644
--- a/tools/perf/ui/stdio/hist.c
+++ b/tools/perf/ui/stdio/hist.c
@@ -292,9 +292,10 @@ static size_t hist_entry_callchain__fprintf(struct hist_entry *he,
292 292
293static size_t hist_entry__callchain_fprintf(struct hist_entry *he, 293static size_t hist_entry__callchain_fprintf(struct hist_entry *he,
294 struct hists *hists, 294 struct hists *hists,
295 u64 total_period, FILE *fp) 295 FILE *fp)
296{ 296{
297 int left_margin = 0; 297 int left_margin = 0;
298 u64 total_period = hists->stats.total_period;
298 299
299 if (sort__first_dimension == SORT_COMM) { 300 if (sort__first_dimension == SORT_COMM) {
300 struct sort_entry *se = list_first_entry(&hist_entry__sort_list, 301 struct sort_entry *se = list_first_entry(&hist_entry__sort_list,
@@ -307,14 +308,13 @@ static size_t hist_entry__callchain_fprintf(struct hist_entry *he,
307} 308}
308 309
309static int hist_entry__fprintf(struct hist_entry *he, size_t size, 310static int hist_entry__fprintf(struct hist_entry *he, size_t size,
310 struct hists *hists, u64 total_period, FILE *fp) 311 struct hists *hists, FILE *fp)
311{ 312{
312 char bf[512]; 313 char bf[512];
313 int ret; 314 int ret;
314 struct perf_hpp hpp = { 315 struct perf_hpp hpp = {
315 .buf = bf, 316 .buf = bf,
316 .size = size, 317 .size = size,
317 .total_period = total_period,
318 }; 318 };
319 bool color = !symbol_conf.field_sep; 319 bool color = !symbol_conf.field_sep;
320 320
@@ -327,8 +327,7 @@ static int hist_entry__fprintf(struct hist_entry *he, size_t size,
327 ret = fprintf(fp, "%s\n", bf); 327 ret = fprintf(fp, "%s\n", bf);
328 328
329 if (symbol_conf.use_callchain) 329 if (symbol_conf.use_callchain)
330 ret += hist_entry__callchain_fprintf(he, hists, 330 ret += hist_entry__callchain_fprintf(he, hists, fp);
331 total_period, fp);
332 331
333 return ret; 332 return ret;
334} 333}
@@ -339,7 +338,6 @@ size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows,
339 struct sort_entry *se; 338 struct sort_entry *se;
340 struct rb_node *nd; 339 struct rb_node *nd;
341 size_t ret = 0; 340 size_t ret = 0;
342 u64 total_period;
343 unsigned int width; 341 unsigned int width;
344 const char *sep = symbol_conf.field_sep; 342 const char *sep = symbol_conf.field_sep;
345 const char *col_width = symbol_conf.col_width_list_str; 343 const char *col_width = symbol_conf.col_width_list_str;
@@ -441,16 +439,13 @@ size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows,
441 goto out; 439 goto out;
442 440
443print_entries: 441print_entries:
444 total_period = hists->stats.total_period;
445
446 for (nd = rb_first(&hists->entries); nd; nd = rb_next(nd)) { 442 for (nd = rb_first(&hists->entries); nd; nd = rb_next(nd)) {
447 struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node); 443 struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node);
448 444
449 if (h->filtered) 445 if (h->filtered)
450 continue; 446 continue;
451 447
452 ret += hist_entry__fprintf(h, max_cols, hists, 448 ret += hist_entry__fprintf(h, max_cols, hists, fp);
453 total_period, fp);
454 449
455 if (max_rows && ++nr_rows >= max_rows) 450 if (max_rows && ++nr_rows >= max_rows)
456 goto out; 451 goto out;