perf script: Add a setting for maximum stack depth
authorAdrian Hunter <adrian.hunter@intel.com>
Fri, 25 Sep 2015 13:15:49 +0000 (16:15 +0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 28 Sep 2015 20:08:48 +0000 (17:08 -0300)
Add a setting for maximum stack depth in preparation for allowing for
synthesized callchains.

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

index 0928439687911f9ae76bf9985d570f7e4b561b0a..a65b498df097b0fc23713791ebb6012af07766ce 100644 (file)
@@ -33,6 +33,8 @@ static bool                   nanosecs;
 static const char              *cpu_list;
 static DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS);
 
+static unsigned int scripting_max_stack = PERF_MAX_STACK_DEPTH;
+
 enum perf_output_field {
        PERF_OUTPUT_COMM            = 1U << 0,
        PERF_OUTPUT_TID             = 1U << 1,
@@ -475,7 +477,7 @@ static void print_sample_bts(union perf_event *event,
                        }
                }
                perf_evsel__print_ip(evsel, sample, al, print_opts,
-                                    PERF_MAX_STACK_DEPTH);
+                                    scripting_max_stack);
        }
 
        /* print branch_to information */
@@ -552,7 +554,7 @@ static void process_event(union perf_event *event, struct perf_sample *sample,
 
                perf_evsel__print_ip(evsel, sample, al,
                                     output[attr->type].print_ip_opts,
-                                    PERF_MAX_STACK_DEPTH);
+                                    scripting_max_stack);
        }
 
        if (PRINT_FIELD(IREGS))
index 15c84cad213ab733d9d76af9e428442065f63a8b..84a02eae4394edfad4f830ae58bde94e4afa2755 100644 (file)
@@ -1800,7 +1800,7 @@ void perf_evsel__print_ip(struct perf_evsel *evsel, struct perf_sample *sample,
 
                if (thread__resolve_callchain(al->thread, evsel,
                                              sample, NULL, NULL,
-                                             PERF_MAX_STACK_DEPTH) != 0) {
+                                             stack_depth) != 0) {
                        if (verbose)
                                error("Failed to resolve callchain. Skipping\n");
                        return;