Skip to content

Commit

Permalink
perf tools: Call perf_hpp__init() before setting up GUI browsers
Browse files Browse the repository at this point in the history
So that it can be set properly prior to set up output fields.  That
makes easy to handle/warn errors during the setup since it doesn't
need to be bothered with the GUI.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/1400480762-22852-11-git-send-email-namhyung@kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
  • Loading branch information
Namhyung Kim authored and Jiri Olsa committed May 21, 2014
1 parent 512ae1b commit 22af969
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 9 deletions.
6 changes: 3 additions & 3 deletions tools/perf/builtin-report.c
Original file line number Diff line number Diff line change
Expand Up @@ -823,16 +823,16 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
goto error;
}

perf_hpp__init();

/* Force tty output for header output. */
if (report.header || report.header_only)
use_browser = 0;

if (strcmp(input_name, "-") != 0)
setup_browser(true);
else {
else
use_browser = 0;
perf_hpp__init();
}

if (report.header || report.header_only) {
perf_session__fprintf_info(session, stdout,
Expand Down
2 changes: 2 additions & 0 deletions tools/perf/builtin-top.c
Original file line number Diff line number Diff line change
Expand Up @@ -1147,6 +1147,8 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
/* display thread wants entries to be collapsed in a different tree */
sort__need_collapse = 1;

perf_hpp__init();

if (top.use_stdio)
use_browser = 0;
else if (top.use_tui)
Expand Down
2 changes: 0 additions & 2 deletions tools/perf/ui/browsers/hists.c
Original file line number Diff line number Diff line change
Expand Up @@ -661,8 +661,6 @@ __HPP_COLOR_PERCENT_FN(overhead_guest_us, period_guest_us)

void hist_browser__init_hpp(void)
{
perf_hpp__init();

perf_hpp__format[PERF_HPP__OVERHEAD].color =
hist_browser__hpp_color_overhead;
perf_hpp__format[PERF_HPP__OVERHEAD_SYS].color =
Expand Down
2 changes: 0 additions & 2 deletions tools/perf/ui/gtk/hists.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ __HPP_COLOR_PERCENT_FN(overhead_guest_us, period_guest_us)

void perf_gtk__init_hpp(void)
{
perf_hpp__init();

perf_hpp__format[PERF_HPP__OVERHEAD].color =
perf_gtk__hpp_color_overhead;
perf_hpp__format[PERF_HPP__OVERHEAD_SYS].color =
Expand Down
2 changes: 0 additions & 2 deletions tools/perf/ui/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ void setup_browser(bool fallback_to_pager)
use_browser = 0;
if (fallback_to_pager)
setup_pager();

perf_hpp__init();
break;
}
}
Expand Down

0 comments on commit 22af969

Please sign in to comment.