perf intel-pt: Add default config for pass-through branch enable

Branch tracing is enabled by default, so a fake config bit called 'pt'
(pass-through) was added to allow the 'branch enable' bit to have affect.
Add default config 'pt,branch' which will allow users to disable branch
tracing using 'branch=0' instead of having to specify 'pt,branch=0'.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Link: http://lkml.kernel.org/r/1495786658-18063-12-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Adrian Hunter 2017-05-26 11:17:12 +03:00 committed by Arnaldo Carvalho de Melo
parent 839598176b
commit 9fd629f9a6
1 changed files with 5 additions and 0 deletions

View File

@ -192,6 +192,7 @@ static u64 intel_pt_default_config(struct perf_pmu *intel_pt_pmu)
int psb_cyc, psb_periods, psb_period;
int pos = 0;
u64 config;
char c;
pos += scnprintf(buf + pos, sizeof(buf) - pos, "tsc");
@ -225,6 +226,10 @@ static u64 intel_pt_default_config(struct perf_pmu *intel_pt_pmu)
}
}
if (perf_pmu__scan_file(intel_pt_pmu, "format/pt", "%c", &c) == 1 &&
perf_pmu__scan_file(intel_pt_pmu, "format/branch", "%c", &c) == 1)
pos += scnprintf(buf + pos, sizeof(buf) - pos, ",pt,branch");
pr_debug2("%s default config: %s\n", intel_pt_pmu->name, buf);
intel_pt_parse_terms(&intel_pt_pmu->format, buf, &config);