perf tools: Call perf_hpp__init() before setting up GUI browsers
authorNamhyung Kim <namhyung@kernel.org>
Wed, 16 Apr 2014 02:04:51 +0000 (11:04 +0900)
committerJiri Olsa <jolsa@kernel.org>
Wed, 21 May 2014 09:45:35 +0000 (11:45 +0200)
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>
tools/perf/builtin-report.c
tools/perf/builtin-top.c
tools/perf/ui/browsers/hists.c
tools/perf/ui/gtk/hists.c
tools/perf/ui/setup.c

index f4d640cfdf1667b8ab34d4a20b90bfd8ff131d82..c4dab7acbdbbe6a35599c565e40e98d15c3db7ff 100644 (file)
@@ -823,16 +823,16 @@ repeat:
                        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,
index 34764b6eabf95948305a095af619cecb9f3551fe..280945bab66d3c7ef3c493a1efb9af5c649721ee 100644 (file)
@@ -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)
index 37c5188fd68adc43dd8384c2835048ba740a011a..92d128f3acdc5026a6014a9121fedf18eca340c1 100644 (file)
@@ -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 =
index 2237245bfac0e929511525c4922e3d79675834cf..fd52669018eecccd7cfc08646a3aeb8b554049d3 100644 (file)
@@ -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 =
index 5df5140a9f29e466dd055b8873711e722875f646..ba51fa8a1176d739593a7472ad2e028cd2f6eb91 100644 (file)
@@ -86,8 +86,6 @@ void setup_browser(bool fallback_to_pager)
                use_browser = 0;
                if (fallback_to_pager)
                        setup_pager();
-
-               perf_hpp__init();
                break;
        }
 }