[PATCH v0 25/71] perf evsel: Add 'no_aux_samples' option

From: Alexander Shishkin
Date: Wed Dec 11 2013 - 07:53:40 EST


From: Adrian Hunter <adrian.hunter@xxxxxxxxx>

Add an option to prevent additional
samples being added to a selected
event by perf_evsel__config().

This is needed when using the sched_switch
tracepoint to follow object code execution.
Since sched_switch will be used only for
switch information, additional sampling is
wasteful.

Signed-off-by: Adrian Hunter <adrian.hunter@xxxxxxxxx>
---
tools/perf/util/evsel.c | 6 +++---
tools/perf/util/evsel.h | 1 +
2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 7b510fd..dbf737c 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -596,7 +596,7 @@ void perf_evsel__config(struct perf_evsel *evsel,
attr->mmap_data = track;
}

- if (opts->call_graph) {
+ if (opts->call_graph && !evsel->no_aux_samples) {
perf_evsel__set_sample_bit(evsel, CALLCHAIN);

if (opts->call_graph == CALLCHAIN_DWARF) {
@@ -619,7 +619,7 @@ void perf_evsel__config(struct perf_evsel *evsel,
target__has_cpu(&opts->target) || per_cpu))
perf_evsel__set_sample_bit(evsel, TIME);

- if (opts->raw_samples) {
+ if (opts->raw_samples && !evsel->no_aux_samples) {
perf_evsel__set_sample_bit(evsel, TIME);
perf_evsel__set_sample_bit(evsel, RAW);
perf_evsel__set_sample_bit(evsel, CPU);
@@ -632,7 +632,7 @@ void perf_evsel__config(struct perf_evsel *evsel,
attr->watermark = 0;
attr->wakeup_events = 1;
}
- if (opts->branch_stack) {
+ if (opts->branch_stack && !evsel->no_aux_samples) {
perf_evsel__set_sample_bit(evsel, BRANCH_STACK);
attr->branch_sample_type = opts->branch_stack;
}
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index 8120eeb..af38e2c 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -83,6 +83,7 @@ struct perf_evsel {
int is_pos;
bool supported;
bool needs_swap;
+ bool no_aux_samples;
/* parse modifier helper */
int exclude_GH;
int nr_members;
--
1.8.5.1

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