perf hists: Reducing arguments of hist_entry_iter__add()
authorNamhyung Kim <namhyung@kernel.org>
Tue, 19 May 2015 08:04:10 +0000 (17:04 +0900)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 27 May 2015 15:21:43 +0000 (12:21 -0300)
The evsel and sample arguments are to set iter for later use.  As it
also receives an iter as another argument, just set them before calling
the function.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1432022650-18205-1-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-report.c
tools/perf/builtin-top.c
tools/perf/tests/hists_cumulate.c
tools/perf/tests/hists_filter.c
tools/perf/tests/hists_output.c
tools/perf/util/hist.c
tools/perf/util/hist.h

index 92fca2157e5ea5d9d3918b3aaf1bcf060d8b4411..56025d90622f22822fc3bb327a3c190c3749fedc 100644 (file)
@@ -139,8 +139,10 @@ static int process_sample_event(struct perf_tool *tool,
        struct report *rep = container_of(tool, struct report, tool);
        struct addr_location al;
        struct hist_entry_iter iter = {
-               .hide_unresolved = rep->hide_unresolved,
-               .add_entry_cb = hist_iter__report_callback,
+               .evsel                  = evsel,
+               .sample                 = sample,
+               .hide_unresolved        = rep->hide_unresolved,
+               .add_entry_cb           = hist_iter__report_callback,
        };
        int ret = 0;
 
@@ -168,8 +170,7 @@ static int process_sample_event(struct perf_tool *tool,
        if (al.map != NULL)
                al.map->dso->hit = 1;
 
-       ret = hist_entry_iter__add(&iter, &al, evsel, sample, rep->max_stack,
-                                  rep);
+       ret = hist_entry_iter__add(&iter, &al, rep->max_stack, rep);
        if (ret < 0)
                pr_debug("problem adding hist entry, skipping event\n");
 out_put:
index a19351728f0fdd202b289699c3a5c5bd40a511e1..6b987424d0152624332352698ceee868d9e15ac5 100644 (file)
@@ -775,7 +775,9 @@ static void perf_event__process_sample(struct perf_tool *tool,
        if (al.sym == NULL || !al.sym->ignore) {
                struct hists *hists = evsel__hists(evsel);
                struct hist_entry_iter iter = {
-                       .add_entry_cb = hist_iter__top_callback,
+                       .evsel          = evsel,
+                       .sample         = sample,
+                       .add_entry_cb   = hist_iter__top_callback,
                };
 
                if (symbol_conf.cumulate_callchain)
@@ -785,8 +787,7 @@ static void perf_event__process_sample(struct perf_tool *tool,
 
                pthread_mutex_lock(&hists->lock);
 
-               err = hist_entry_iter__add(&iter, &al, evsel, sample,
-                                          top->max_stack, top);
+               err = hist_entry_iter__add(&iter, &al, top->max_stack, top);
                if (err < 0)
                        pr_err("Problem incrementing symbol period, skipping event\n");
 
index 620f626e5b3517326d0550e6198f4384945a392d..7d82c8be5e360da5f89b1ff7b569a798c5a34fe0 100644 (file)
@@ -87,6 +87,8 @@ static int add_hist_entries(struct hists *hists, struct machine *machine)
                        },
                };
                struct hist_entry_iter iter = {
+                       .evsel = evsel,
+                       .sample = &sample,
                        .hide_unresolved = false,
                };
 
@@ -104,8 +106,8 @@ static int add_hist_entries(struct hists *hists, struct machine *machine)
                                                  &sample) < 0)
                        goto out;
 
-               if (hist_entry_iter__add(&iter, &al, evsel, &sample,
-                                        PERF_MAX_STACK_DEPTH, NULL) < 0) {
+               if (hist_entry_iter__add(&iter, &al, PERF_MAX_STACK_DEPTH,
+                                        NULL) < 0) {
                        addr_location__put(&al);
                        goto out;
                }
index 82e1ee52e024559c16b443ebfc28f9cb5dbdb4cc..ce48775e6ada13886000013183908f3f6b63f26d 100644 (file)
@@ -63,6 +63,8 @@ static int add_hist_entries(struct perf_evlist *evlist,
                                },
                        };
                        struct hist_entry_iter iter = {
+                               .evsel = evsel,
+                               .sample = &sample,
                                .ops = &hist_iter_normal,
                                .hide_unresolved = false,
                        };
@@ -81,7 +83,7 @@ static int add_hist_entries(struct perf_evlist *evlist,
                                                          &sample) < 0)
                                goto out;
 
-                       if (hist_entry_iter__add(&iter, &al, evsel, &sample,
+                       if (hist_entry_iter__add(&iter, &al,
                                                 PERF_MAX_STACK_DEPTH, NULL) < 0) {
                                addr_location__put(&al);
                                goto out;
index fd7ec4f9aeb4abfedd2b508a135b7baa8c4a717c..adbebc852cc8b58886a2618f973815f9284b7b3b 100644 (file)
@@ -57,6 +57,8 @@ static int add_hist_entries(struct hists *hists, struct machine *machine)
                        },
                };
                struct hist_entry_iter iter = {
+                       .evsel = evsel,
+                       .sample = &sample,
                        .ops = &hist_iter_normal,
                        .hide_unresolved = false,
                };
@@ -70,8 +72,8 @@ static int add_hist_entries(struct hists *hists, struct machine *machine)
                                                  &sample) < 0)
                        goto out;
 
-               if (hist_entry_iter__add(&iter, &al, evsel, &sample,
-                                        PERF_MAX_STACK_DEPTH, NULL) < 0) {
+               if (hist_entry_iter__add(&iter, &al, PERF_MAX_STACK_DEPTH,
+                                        NULL) < 0) {
                        addr_location__put(&al);
                        goto out;
                }
index 3387706798630278d7bf0627a5221ad3c3eed011..2504b5b1a308c8e456fdb4305fb66c14586d0411 100644 (file)
@@ -851,19 +851,15 @@ const struct hist_iter_ops hist_iter_cumulative = {
 };
 
 int hist_entry_iter__add(struct hist_entry_iter *iter, struct addr_location *al,
-                        struct perf_evsel *evsel, struct perf_sample *sample,
                         int max_stack_depth, void *arg)
 {
        int err, err2;
 
-       err = sample__resolve_callchain(sample, &iter->parent, evsel, al,
-                                       max_stack_depth);
+       err = sample__resolve_callchain(iter->sample, &iter->parent,
+                                       iter->evsel, al, max_stack_depth);
        if (err)
                return err;
 
-       iter->evsel = evsel;
-       iter->sample = sample;
-
        err = iter->ops->prepare_entry(iter, al);
        if (err)
                goto out;
index 9f31b89a527a2e8f9d02da1993cdff13709b84c1..5ed8d9c229814d9c6942ce3528898bbd9de1cb79 100644 (file)
@@ -111,7 +111,6 @@ struct hist_entry *__hists__add_entry(struct hists *hists,
                                      u64 weight, u64 transaction,
                                      bool sample_self);
 int hist_entry_iter__add(struct hist_entry_iter *iter, struct addr_location *al,
-                        struct perf_evsel *evsel, struct perf_sample *sample,
                         int max_stack_depth, void *arg);
 
 int64_t hist_entry__cmp(struct hist_entry *left, struct hist_entry *right);