From: Andi Kleen <[email protected]>

Automatically disable collecting branch flags and cycles with
--call-graph lbr. This allows avoiding a bunch of extra MSR
reads in the PMI on Skylake.

When the kernel doesn't support the new flags they are automatically
cleared in the fallback code.

Signed-off-by: Andi Kleen <[email protected]>
---
 tools/perf/util/evsel.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index c886b9f..4d8a86c 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -557,6 +557,8 @@ perf_evsel__config_callgraph(struct perf_evsel *evsel,
                                           "Falling back to framepointers.\n");
                        } else {
                                perf_evsel__set_sample_bit(evsel, BRANCH_STACK);
+                               perf_evsel__set_sample_bit(evsel, 
BRANCH_NO_CYCLES);
+                               perf_evsel__set_sample_bit(evsel, 
BRANCH_NO_FLAGS);
                                attr->branch_sample_type = 
PERF_SAMPLE_BRANCH_USER |
                                                        
PERF_SAMPLE_BRANCH_CALL_STACK;
                        }
@@ -1167,6 +1169,8 @@ fallback_missing_features:
                evsel->attr.mmap2 = 0;
        if (perf_missing_features.exclude_guest)
                evsel->attr.exclude_guest = evsel->attr.exclude_host = 0;
+       evsel->attr.sample_type &= ~(PERF_SAMPLE_BRANCH_NO_FLAGS|
+                                    PERF_SAMPLE_BRANCH_NO_CYCLES);
 retry_sample_id:
        if (perf_missing_features.sample_id_all)
                evsel->attr.sample_id_all = 0;
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to