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.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
index 194e2f42ff5d..6c152686e837 100644
--- a/tools/perf/ui/stdio/hist.c
+++ b/tools/perf/ui/stdio/hist.c
@@ -315,8 +315,7 @@ static inline void advance_hpp(struct perf_hpp *hpp, int inc)
315} 315}
316 316
317static int hist_entry__period_snprintf(struct perf_hpp *hpp, 317static int hist_entry__period_snprintf(struct perf_hpp *hpp,
318 struct hist_entry *he, 318 struct hist_entry *he)
319 bool color)
320{ 319{
321 const char *sep = symbol_conf.field_sep; 320 const char *sep = symbol_conf.field_sep;
322 struct perf_hpp_fmt *fmt; 321 struct perf_hpp_fmt *fmt;
@@ -338,7 +337,7 @@ static int hist_entry__period_snprintf(struct perf_hpp *hpp,
338 } else 337 } else
339 first = false; 338 first = false;
340 339
341 if (color && fmt->color) 340 if (perf_hpp__use_color() && fmt->color)
342 ret = fmt->color(fmt, hpp, he); 341 ret = fmt->color(fmt, hpp, he);
343 else 342 else
344 ret = fmt->entry(fmt, hpp, he); 343 ret = fmt->entry(fmt, hpp, he);
@@ -358,12 +357,11 @@ static int hist_entry__fprintf(struct hist_entry *he, size_t size,
358 .buf = bf, 357 .buf = bf,
359 .size = size, 358 .size = size,
360 }; 359 };
361 bool color = !symbol_conf.field_sep;
362 360
363 if (size == 0 || size > bfsz) 361 if (size == 0 || size > bfsz)
364 size = hpp.size = bfsz; 362 size = hpp.size = bfsz;
365 363
366 ret = hist_entry__period_snprintf(&hpp, he, color); 364 ret = hist_entry__period_snprintf(&hpp, he);
367 hist_entry__sort_snprintf(he, bf + ret, size - ret, hists); 365 hist_entry__sort_snprintf(he, bf + ret, size - ret, hists);
368 366
369 ret = fprintf(fp, "%s\n", bf); 367 ret = fprintf(fp, "%s\n", bf);
@@ -482,6 +480,7 @@ size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows,
482 480
483print_entries: 481print_entries:
484 linesz = hists__sort_list_width(hists) + 3 + 1; 482 linesz = hists__sort_list_width(hists) + 3 + 1;
483 linesz += perf_hpp__color_overhead();
485 line = malloc(linesz); 484 line = malloc(linesz);
486 if (line == NULL) { 485 if (line == NULL) {
487 ret = -1; 486 ret = -1;