perf hists: Replace perf_evsel arg perf_hpp_fmt's header callback
authorJiri Olsa <jolsa@kernel.org>
Tue, 14 Jun 2016 18:19:19 +0000 (20:19 +0200)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 15 Jun 2016 13:49:18 +0000 (10:49 -0300)
Replacing perf_evsel arg perf_hpp_fmt's header callback with hists
object.

None of the actual callbacks actually use evsel object, also this will
be helpful in future for non evsel related hist browsers.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1465928361-2442-10-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-diff.c
tools/perf/ui/browsers/hists.c
tools/perf/ui/gtk/hists.c
tools/perf/ui/hist.c
tools/perf/ui/stdio/hist.c
tools/perf/util/hist.h
tools/perf/util/sort.c

index 69bad45deadd38ed9386e97f4031788f6fb693b4..b75ea770d44316f48e13e2556bbba17ba873fe0d 100644 (file)
@@ -1045,7 +1045,7 @@ static int hpp__entry_global(struct perf_hpp_fmt *_fmt, struct perf_hpp *hpp,
 }
 
 static int hpp__header(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
-                      struct perf_evsel *evsel __maybe_unused)
+                      struct hists *hists __maybe_unused)
 {
        struct diff_hpp_fmt *dfmt =
                container_of(fmt, struct diff_hpp_fmt, fmt);
index e21ea52da164a72dcc88e6389fc82d7cc8dbc538..c20425d7d9ae3194d8dba63e232bfee5801af9c3 100644 (file)
@@ -1531,7 +1531,7 @@ static int hists_browser__scnprintf_headers(struct hist_browser *browser, char *
                if (perf_hpp__should_skip(fmt, hists)  || column++ < browser->b.horiz_scroll)
                        continue;
 
-               ret = fmt->header(fmt, &dummy_hpp, hists_to_evsel(hists));
+               ret = fmt->header(fmt, &dummy_hpp, hists);
                if (advance_hpp_check(&dummy_hpp, ret))
                        break;
 
@@ -1568,7 +1568,7 @@ static int hists_browser__scnprintf_hierarchy_headers(struct hist_browser *brows
                if (column++ < browser->b.horiz_scroll)
                        continue;
 
-               ret = fmt->header(fmt, &dummy_hpp, hists_to_evsel(hists));
+               ret = fmt->header(fmt, &dummy_hpp, hists);
                if (advance_hpp_check(&dummy_hpp, ret))
                        break;
 
@@ -1605,7 +1605,7 @@ static int hists_browser__scnprintf_hierarchy_headers(struct hist_browser *brows
                        }
                        first_col = false;
 
-                       ret = fmt->header(fmt, &dummy_hpp, hists_to_evsel(hists));
+                       ret = fmt->header(fmt, &dummy_hpp, hists);
                        dummy_hpp.buf[ret] = '\0';
 
                        start = trim(dummy_hpp.buf);
index 932adfaa05af2cf2ea8860f712244d4d647adea3..e5c1325b03407af8008f51c1d891dd60c452f06d 100644 (file)
@@ -549,7 +549,7 @@ static void perf_gtk__show_hierarchy(GtkWidget *window, struct hists *hists,
                                strcat(buf, "+");
                        first_col = false;
 
-                       fmt->header(fmt, &hpp, hists_to_evsel(hists));
+                       fmt->header(fmt, &hpp, hists);
                        strcat(buf, ltrim(rtrim(hpp.buf)));
                }
        }
index af07ffb129ca5ba24b2459fee6ee659d8c71e97f..0b232d61310c24865aff225c8e901c7358855ecd 100644 (file)
@@ -229,9 +229,9 @@ static int hpp__width_fn(struct perf_hpp_fmt *fmt,
 }
 
 static int hpp__header_fn(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
-                         struct perf_evsel *evsel)
+                         struct hists *hists)
 {
-       int len = hpp__width_fn(fmt, hpp, evsel);
+       int len = hpp__width_fn(fmt, hpp, hists_to_evsel(hists));
        return scnprintf(hpp->buf, hpp->size, "%*s", len, fmt->name);
 }
 
index 9a972cb00458f4fe1c15232222925025bee7355e..d0534fac46ae5641dca9bd5eae3e64cba95d6635 100644 (file)
@@ -549,7 +549,7 @@ static int print_hierarchy_header(struct hists *hists, struct perf_hpp *hpp,
                                    struct perf_hpp_list_node, list);
 
        perf_hpp_list__for_each_format(&fmt_node->hpp, fmt) {
-               fmt->header(fmt, hpp, hists_to_evsel(hists));
+               fmt->header(fmt, hpp, hists);
                fprintf(fp, "%s%s", hpp->buf, sep ?: "  ");
        }
 
@@ -569,7 +569,7 @@ static int print_hierarchy_header(struct hists *hists, struct perf_hpp *hpp,
                                header_width += fprintf(fp, "+");
                        first_col = false;
 
-                       fmt->header(fmt, hpp, hists_to_evsel(hists));
+                       fmt->header(fmt, hpp, hists);
 
                        header_width += fprintf(fp, "%s", trim(hpp->buf));
                }
@@ -658,7 +658,7 @@ hists__fprintf_standard_headers(struct hists *hists,
                else
                        first = false;
 
-               fmt->header(fmt, hpp, hists_to_evsel(hists));
+               fmt->header(fmt, hpp, hists);
                fprintf(fp, "%s", hpp->buf);
        }
 
index a73fde0a5dd864c5d43dd396cb837824bb95e6c8..aae932f9eb87e7b7e6800bc62337b974752ddb3e 100644 (file)
@@ -215,7 +215,7 @@ struct perf_hpp {
 struct perf_hpp_fmt {
        const char *name;
        int (*header)(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
-                     struct perf_evsel *evsel);
+                     struct hists *hists);
        int (*width)(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
                     struct perf_evsel *evsel);
        int (*color)(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
index ba5b42f28f0bda26026bbcd0052cfff1afb46a3e..3e52c77981e3885d478b3cd63eafc0a73fda67f0 100644 (file)
@@ -1488,7 +1488,7 @@ void perf_hpp__reset_sort_width(struct perf_hpp_fmt *fmt, struct hists *hists)
 }
 
 static int __sort__hpp_header(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
-                             struct perf_evsel *evsel)
+                             struct hists *hists)
 {
        struct hpp_sort_entry *hse;
        size_t len = fmt->user_len;
@@ -1496,7 +1496,7 @@ static int __sort__hpp_header(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
        hse = container_of(fmt, struct hpp_sort_entry, hpp);
 
        if (!len)
-               len = hists__col_len(evsel__hists(evsel), hse->se->se_width_idx);
+               len = hists__col_len(hists, hse->se->se_width_idx);
 
        return scnprintf(hpp->buf, hpp->size, "%-*.*s", len, len, fmt->name);
 }
@@ -1793,7 +1793,7 @@ static void update_dynamic_len(struct hpp_dynamic_entry *hde,
 }
 
 static int __sort__hde_header(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
-                             struct perf_evsel *evsel __maybe_unused)
+                             struct hists *hists __maybe_unused)
 {
        struct hpp_dynamic_entry *hde;
        size_t len = fmt->user_len;