Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1679167
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 30/30] perf auxtrace: Add CPU filter support |
| Date | 2017-07-01 00:30 +0200 |
| Message-ID | <tYcAh-2OP-17@gated-at.bofh.it> (permalink) |
| References | <tYcAh-2OP-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Adrian Hunter <adrian.hunter@intel.com>
Decoding auxtrace data can take a long time. To avoid decoding
unnecessarily, filter auxtrace data that is collected per-cpu before it is
decoded.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Link: http://lkml.kernel.org/r/1495786658-18063-38-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-report.c | 1 +
tools/perf/builtin-script.c | 1 +
tools/perf/util/auxtrace.c | 10 ++++++++++
tools/perf/util/auxtrace.h | 2 ++
4 files changed, 14 insertions(+)
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 1174a426d090..79a33eb1a10d 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -557,6 +557,7 @@ static int __cmd_report(struct report *rep)
ui__error("failed to set cpu bitmap\n");
return ret;
}
+ session->itrace_synth_opts->cpu_bitmap = rep->cpu_bitmap;
}
if (rep->show_threads) {
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index b458a0cc3544..83cdc0a61fd6 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -2992,6 +2992,7 @@ int cmd_script(int argc, const char **argv)
err = perf_session__cpu_bitmap(session, cpu_list, cpu_bitmap);
if (err < 0)
goto out_delete;
+ itrace_synth_opts.cpu_bitmap = cpu_bitmap;
}
if (!no_callchain)
diff --git a/tools/perf/util/auxtrace.c b/tools/perf/util/auxtrace.c
index 651c01dfa5d3..5547457566a7 100644
--- a/tools/perf/util/auxtrace.c
+++ b/tools/perf/util/auxtrace.c
@@ -322,6 +322,13 @@ static int auxtrace_queues__add_event_buffer(struct auxtrace_queues *queues,
return auxtrace_queues__add_buffer(queues, idx, buffer);
}
+static bool filter_cpu(struct perf_session *session, int cpu)
+{
+ unsigned long *cpu_bitmap = session->itrace_synth_opts->cpu_bitmap;
+
+ return cpu_bitmap && cpu != -1 && !test_bit(cpu, cpu_bitmap);
+}
+
int auxtrace_queues__add_event(struct auxtrace_queues *queues,
struct perf_session *session,
union perf_event *event, off_t data_offset,
@@ -331,6 +338,9 @@ int auxtrace_queues__add_event(struct auxtrace_queues *queues,
unsigned int idx;
int err;
+ if (filter_cpu(session, event->auxtrace.cpu))
+ return 0;
+
buffer = zalloc(sizeof(struct auxtrace_buffer));
if (!buffer)
return -ENOMEM;
diff --git a/tools/perf/util/auxtrace.h b/tools/perf/util/auxtrace.h
index 68e0aa40b24a..33b5e6cdf38c 100644
--- a/tools/perf/util/auxtrace.h
+++ b/tools/perf/util/auxtrace.h
@@ -74,6 +74,7 @@ enum itrace_period_type {
* @period: 'instructions' events period
* @period_type: 'instructions' events period type
* @initial_skip: skip N events at the beginning.
+ * @cpu_bitmap: CPUs for which to synthesize events, or NULL for all
*/
struct itrace_synth_opts {
bool set;
@@ -96,6 +97,7 @@ struct itrace_synth_opts {
unsigned long long period;
enum itrace_period_type period_type;
unsigned long initial_skip;
+ unsigned long *cpu_bitmap;
};
/**
--
2.9.4
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[GIT PULL 00/30] perf/core improvements and fixes Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-01 00:30 +0200 [PATCH 03/30] perf help: Elliminate dup code for reporting Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-01 00:30 +0200 [PATCH 12/30] x86/insn: perf tools: Add new ptwrite instruction Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-01 00:30 +0200 [PATCH 19/30] perf intel-pt: Factor out common code synthesizing event samples Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-01 00:30 +0200 [PATCH 30/30] perf auxtrace: Add CPU filter support Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-01 00:30 +0200 [PATCH 08/30] perf tools: Replace error() with pr_err() Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-01 00:30 +0200 [PATCH 05/30] perf config: Use pr_warning() Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-01 00:30 +0200 [PATCH 22/30] perf intel-pt: Tidy Intel PT evsel lookup into separate function Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-01 00:30 +0200 [PATCH 25/30] perf intel-pt: Move code in intel_pt_synth_events() to simplify attr setting Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-01 00:30 +0200 [PATCH 11/30] perf jit: fix typo: "incalid" -> "invalid" Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-01 00:30 +0200 [PATCH 24/30] perf intel-pt: Factor out intel_pt_set_event_name() Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-01 00:30 +0200 [PATCH 20/30] perf intel-pt: Remove unused instructions_sample_period Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-01 00:30 +0200 [PATCH 14/30] tools include: Add byte-swapping macros to kernel.h Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-01 00:30 +0200 [PATCH 04/30] perf help: Use pr_warning() Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-01 00:30 +0200 [PATCH 27/30] perf intel-pt: Add example script for power events and PTWRITE Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-01 00:30 +0200 [PATCH 29/30] perf intel-pt: Do not use TSC packets for calculating CPU cycles to TSC Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-01 00:30 +0200 [PATCH 17/30] perf script: Add 'synth' field for synthesized event payloads Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-01 00:30 +0200 [PATCH 26/30] perf intel-pt: Synthesize new power and "ptwrite" events Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-01 00:30 +0200 [PATCH 15/30] perf auxtrace: Add itrace option to output ptwrite events Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-01 00:30 +0200 [PATCH 01/30] perf tests: Add platform dependency to test 15 Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-01 00:30 +0200 [PATCH 23/30] perf intel-pt: Tidy messages into called function intel_pt_synth_event() Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-01 00:30 +0200 [PATCH 28/30] perf intel-pt: Update documentation to include new ptwrite and power events Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-01 00:30 +0200 [PATCH 21/30] perf intel-pt: Join needlessly wrapped lines Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-01 00:30 +0200 [PATCH 18/30] perf script: Add synthesized Intel PT power and ptwrite events Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-01 00:30 +0200 [PATCH 13/30] perf script: Add 'synth' event type for synthesized events Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-01 00:40 +0200 [PATCH 02/30] perf help: Introduce exec_failed() to avoid code duplication Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-01 00:40 +0200 [PATCH 10/30] perf tools: Kill die() Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-01 00:40 +0200 [PATCH 07/30] perf tools: Remove warning() Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-01 00:40 +0200 [PATCH 09/30] perf config: Do not die when parsing u64 or int config values Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-01 00:40 +0200 [PATCH 16/30] perf auxtrace: Add itrace option to output power events Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-01 00:40 +0200 Re: [GIT PULL 00/30] perf/core improvements and fixes Ingo Molnar <mingo@kernel.org> - 2017-07-01 10:50 +0200
csiph-web