]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
perf hists: Add argument to hists__resort_cb_t callback
authorJiri Olsa <jolsa@kernel.org>
Mon, 4 Feb 2019 14:18:06 +0000 (15:18 +0100)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 6 Feb 2019 13:00:39 +0000 (10:00 -0300)
Add argument to hists__resort_cb_t so that we can pass data from upper
layers to the callback function. It will be used in the following
patches.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20190204141808.23031-2-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-c2c.c
tools/perf/util/hist.c
tools/perf/util/hist.h

index b2bf117881f18962c2e9cdc323a5c032179a584e..efaaab23c6fd7a84bc5eec36c4a627422806cedc 100644 (file)
@@ -1970,7 +1970,7 @@ static void calc_width(struct c2c_hist_entry *c2c_he)
        set_nodestr(c2c_he);
 }
 
-static int filter_cb(struct hist_entry *he)
+static int filter_cb(struct hist_entry *he, void *arg __maybe_unused)
 {
        struct c2c_hist_entry *c2c_he;
 
@@ -1987,7 +1987,7 @@ static int filter_cb(struct hist_entry *he)
        return 0;
 }
 
-static int resort_cl_cb(struct hist_entry *he)
+static int resort_cl_cb(struct hist_entry *he, void *arg __maybe_unused)
 {
        struct c2c_hist_entry *c2c_he;
        struct c2c_hists *c2c_hists;
@@ -2074,7 +2074,7 @@ static int setup_nodes(struct perf_session *session)
 
 #define HAS_HITMS(__h) ((__h)->stats.lcl_hitm || (__h)->stats.rmt_hitm)
 
-static int resort_hitm_cb(struct hist_entry *he)
+static int resort_hitm_cb(struct hist_entry *he, void *arg __maybe_unused)
 {
        struct c2c_hist_entry *c2c_he;
        c2c_he = container_of(he, struct c2c_hist_entry, he);
@@ -2096,7 +2096,7 @@ static int hists__iterate_cb(struct hists *hists, hists__resort_cb_t cb)
                struct hist_entry *he;
 
                he = rb_entry(next, struct hist_entry, rb_node);
-               ret = cb(he);
+               ret = cb(he, NULL);
                if (ret)
                        break;
                next = rb_next(&he->rb_node);
index 7f9df74ab8932d605d65c1bbad148cb08a24d0fd..64ad603a0592fb5da226ad8ed1ddcd6cfc5eb7cb 100644 (file)
@@ -1721,7 +1721,8 @@ static void __hists__insert_output_entry(struct rb_root_cached *entries,
 }
 
 static void output_resort(struct hists *hists, struct ui_progress *prog,
-                         bool use_callchain, hists__resort_cb_t cb)
+                         bool use_callchain, hists__resort_cb_t cb,
+                         void *cb_arg)
 {
        struct rb_root_cached *root;
        struct rb_node *next;
@@ -1760,7 +1761,7 @@ static void output_resort(struct hists *hists, struct ui_progress *prog,
                n = rb_entry(next, struct hist_entry, rb_node_in);
                next = rb_next(&n->rb_node_in);
 
-               if (cb && cb(n))
+               if (cb && cb(n, cb_arg))
                        continue;
 
                __hists__insert_output_entry(&hists->entries, n, min_callchain_hits, use_callchain);
@@ -1785,18 +1786,18 @@ void perf_evsel__output_resort(struct perf_evsel *evsel, struct ui_progress *pro
 
        use_callchain |= symbol_conf.show_branchflag_count;
 
-       output_resort(evsel__hists(evsel), prog, use_callchain, NULL);
+       output_resort(evsel__hists(evsel), prog, use_callchain, NULL, NULL);
 }
 
 void hists__output_resort(struct hists *hists, struct ui_progress *prog)
 {
-       output_resort(hists, prog, symbol_conf.use_callchain, NULL);
+       output_resort(hists, prog, symbol_conf.use_callchain, NULL, NULL);
 }
 
 void hists__output_resort_cb(struct hists *hists, struct ui_progress *prog,
                             hists__resort_cb_t cb)
 {
-       output_resort(hists, prog, symbol_conf.use_callchain, cb);
+       output_resort(hists, prog, symbol_conf.use_callchain, cb, NULL);
 }
 
 static bool can_goto_child(struct hist_entry *he, enum hierarchy_move_dir hmd)
index 6b872079ead505803b9ea3408ef733d650baf9ee..69a367d4aeaff1ac17b33e558356cd721cea922b 100644 (file)
@@ -163,7 +163,7 @@ int hist_entry__snprintf_alignment(struct hist_entry *he, struct perf_hpp *hpp,
                                   struct perf_hpp_fmt *fmt, int printed);
 void hist_entry__delete(struct hist_entry *he);
 
-typedef int (*hists__resort_cb_t)(struct hist_entry *he);
+typedef int (*hists__resort_cb_t)(struct hist_entry *he, void *arg);
 
 void perf_evsel__output_resort(struct perf_evsel *evsel, struct ui_progress *prog);
 void hists__output_resort(struct hists *hists, struct ui_progress *prog);