perf hists: Allow for max_stack greater than PERF_MAX_STACK_DEPTH
authorAdrian Hunter <adrian.hunter@intel.com>
Fri, 25 Sep 2015 13:15:47 +0000 (16:15 +0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 28 Sep 2015 20:06:16 +0000 (17:06 -0300)
Use the max_stack value instead of PERF_MAX_STACK_DEPTH so that
arbitrary-sized callchains can be supported.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/1443186956-18718-17-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/hist.c
tools/perf/util/hist.h

index b3567a25f0c46f76898b9a0226d16e81b98a9081..0cad9e07c5b4fe9800922fe19e4dd4148ba0cf01 100644 (file)
@@ -695,7 +695,7 @@ iter_finish_normal_entry(struct hist_entry_iter *iter,
 }
 
 static int
-iter_prepare_cumulative_entry(struct hist_entry_iter *iter __maybe_unused,
+iter_prepare_cumulative_entry(struct hist_entry_iter *iter,
                              struct addr_location *al __maybe_unused)
 {
        struct hist_entry **he_cache;
@@ -707,7 +707,7 @@ iter_prepare_cumulative_entry(struct hist_entry_iter *iter __maybe_unused,
         * cumulated only one time to prevent entries more than 100%
         * overhead.
         */
-       he_cache = malloc(sizeof(*he_cache) * (PERF_MAX_STACK_DEPTH + 1));
+       he_cache = malloc(sizeof(*he_cache) * (iter->max_stack + 1));
        if (he_cache == NULL)
                return -ENOMEM;
 
@@ -868,6 +868,8 @@ int hist_entry_iter__add(struct hist_entry_iter *iter, struct addr_location *al,
        if (err)
                return err;
 
+       iter->max_stack = max_stack_depth;
+
        err = iter->ops->prepare_entry(iter, al);
        if (err)
                goto out;
index 4d6aa1dbdaee370c558482adaaf6737c74ddd2ee..8c20a8f6b214b1a05332b42ec213a304c233acb5 100644 (file)
@@ -90,6 +90,7 @@ struct hist_entry_iter {
        int curr;
 
        bool hide_unresolved;
+       int max_stack;
 
        struct perf_evsel *evsel;
        struct perf_sample *sample;
This page took 0.027915 seconds and 5 git commands to generate.