]> git.karo-electronics.de Git - linux-beck.git/commitdiff
perf trace: Make --event honour --min-stack too
authorArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 20 Apr 2016 22:55:48 +0000 (19:55 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 25 Apr 2016 15:49:17 +0000 (12:49 -0300)
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Milian Wolff <milian.wolff@kdab.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-shj0fazntmskhjild5i6x73l@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-trace.c

index d1bbcb9abca3ef1e1469635b1d8adfc88a22fa73..fc276d718172008e682118a5e1f71c44ff08edc1 100644 (file)
@@ -2126,6 +2126,17 @@ static int trace__event_handler(struct trace *trace, struct perf_evsel *evsel,
                                union perf_event *event __maybe_unused,
                                struct perf_sample *sample)
 {
+       int callchain_ret = 0;
+
+       if (sample->callchain) {
+               callchain_ret = trace__resolve_callchain(trace, evsel, sample, &callchain_cursor);
+               if (callchain_ret == 0) {
+                       if (callchain_cursor.nr < trace->min_stack)
+                               goto out;
+                       callchain_ret = 1;
+               }
+       }
+
        trace__printf_interrupted_entry(trace, sample);
        trace__fprintf_tstamp(trace, sample->time, trace->output);
 
@@ -2144,11 +2155,11 @@ static int trace__event_handler(struct trace *trace, struct perf_evsel *evsel,
 
        fprintf(trace->output, ")\n");
 
-       if (sample->callchain) {
-               if (trace__resolve_callchain(trace, evsel, sample, &callchain_cursor) == 0)
-                       trace__fprintf_callchain(trace, sample);
-       }
-
+       if (callchain_ret > 0)
+               trace__fprintf_callchain(trace, sample);
+       else if (callchain_ret < 0)
+               pr_err("Problem processing %s callchain, skipping...\n", perf_evsel__name(evsel));
+out:
        return 0;
 }