Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1306249
| From | Wang Nan <wangnan0@huawei.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 30/53] perf record: Extract synthesize code to record__synthesize() |
| Date | 2016-01-11 15:00 +0100 |
| Message-ID | <qPLaS-38k-73@gated-at.bofh.it> (permalink) |
| References | <qPL17-34y-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Create record__synthesize(). It can be used to creating tracking events
for each perf.data after perf supporting splitting into multiple
outputs.
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Signed-off-by: He Kuang <hekuang@huawei.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
---
tools/perf/builtin-record.c | 132 +++++++++++++++++++++++++-------------------
1 file changed, 76 insertions(+), 56 deletions(-)
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index bd1692c..10f1349 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -475,6 +475,81 @@ static void workload_exec_failed_signal(int signo __maybe_unused,
static void snapshot_sig_handler(int sig);
+static int record__synthesize(struct record *rec)
+{
+ struct perf_session *session = rec->session;
+ struct machine *machine = &session->machines.host;
+ struct perf_data_file *file = &rec->file;
+ struct record_opts *opts = &rec->opts;
+ struct perf_tool *tool = &rec->tool;
+ int fd = perf_data_file__fd(file);
+ int err = 0;
+ static bool warned_kmaps = false, warned_modules = false;
+
+ if (file->is_pipe) {
+ err = perf_event__synthesize_attrs(tool, session,
+ process_synthesized_event);
+ if (err < 0) {
+ pr_err("Couldn't synthesize attrs.\n");
+ goto out;
+ }
+
+ if (have_tracepoints(&rec->evlist->entries)) {
+ /*
+ * FIXME err <= 0 here actually means that
+ * there were no tracepoints so its not really
+ * an error, just that we don't need to
+ * synthesize anything. We really have to
+ * return this more properly and also
+ * propagate errors that now are calling die()
+ */
+ err = perf_event__synthesize_tracing_data(tool, fd, rec->evlist,
+ process_synthesized_event);
+ if (err <= 0) {
+ pr_err("Couldn't record tracing data.\n");
+ goto out;
+ }
+ rec->bytes_written += err;
+ }
+ }
+
+ if (rec->opts.full_auxtrace) {
+ err = perf_event__synthesize_auxtrace_info(rec->itr, tool,
+ session, process_synthesized_event);
+ if (err)
+ goto out;
+ }
+
+ err = perf_event__synthesize_kernel_mmap(tool, process_synthesized_event,
+ machine);
+ if (err < 0 && !warned_kmaps) {
+ warned_kmaps = true;
+ pr_err("Couldn't record kernel reference relocation symbol\n"
+ "Symbol resolution may be skewed if relocation was used (e.g. kexec).\n"
+ "Check /proc/kallsyms permission or run as root.\n");
+ }
+
+ err = perf_event__synthesize_modules(tool, process_synthesized_event,
+ machine);
+ if (err < 0 && !warned_modules) {
+ warned_modules = true;
+ pr_err("Couldn't record kernel module information.\n"
+ "Symbol resolution may be skewed if relocation was used (e.g. kexec).\n"
+ "Check /proc/modules permission or run as root.\n");
+ }
+
+ if (perf_guest) {
+ machines__process_guests(&session->machines,
+ perf_event__synthesize_guest_os, tool);
+ }
+
+ err = __machine__synthesize_threads(machine, tool, &opts->target, rec->evlist->threads,
+ process_synthesized_event, opts->sample_address,
+ opts->proc_map_timeout);
+out:
+ return err;
+}
+
static int __cmd_record(struct record *rec, int argc, const char **argv)
{
int err;
@@ -569,63 +644,8 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
machine = &session->machines.host;
- if (file->is_pipe) {
- err = perf_event__synthesize_attrs(tool, session,
- process_synthesized_event);
- if (err < 0) {
- pr_err("Couldn't synthesize attrs.\n");
- goto out_child;
- }
-
- if (have_tracepoints(&rec->evlist->entries)) {
- /*
- * FIXME err <= 0 here actually means that
- * there were no tracepoints so its not really
- * an error, just that we don't need to
- * synthesize anything. We really have to
- * return this more properly and also
- * propagate errors that now are calling die()
- */
- err = perf_event__synthesize_tracing_data(tool, fd, rec->evlist,
- process_synthesized_event);
- if (err <= 0) {
- pr_err("Couldn't record tracing data.\n");
- goto out_child;
- }
- rec->bytes_written += err;
- }
- }
-
- if (rec->opts.full_auxtrace) {
- err = perf_event__synthesize_auxtrace_info(rec->itr, tool,
- session, process_synthesized_event);
- if (err)
- goto out_delete_session;
- }
-
- err = perf_event__synthesize_kernel_mmap(tool, process_synthesized_event,
- machine);
- if (err < 0)
- pr_err("Couldn't record kernel reference relocation symbol\n"
- "Symbol resolution may be skewed if relocation was used (e.g. kexec).\n"
- "Check /proc/kallsyms permission or run as root.\n");
-
- err = perf_event__synthesize_modules(tool, process_synthesized_event,
- machine);
+ err = record__synthesize(rec);
if (err < 0)
- pr_err("Couldn't record kernel module information.\n"
- "Symbol resolution may be skewed if relocation was used (e.g. kexec).\n"
- "Check /proc/modules permission or run as root.\n");
-
- if (perf_guest) {
- machines__process_guests(&session->machines,
- perf_event__synthesize_guest_os, tool);
- }
-
- err = __machine__synthesize_threads(machine, tool, &opts->target, rec->evlist->threads,
- process_synthesized_event, opts->sample_address,
- opts->proc_map_timeout);
- if (err != 0)
goto out_child;
if (rec->realtime_prio) {
--
1.8.3.4
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 00/53] perf tools: Bugfix, BPF improvement and perf record flight record mode Wang Nan <wangnan0@huawei.com> - 2016-01-11 14:50 +0100
[PATCH 44/53] perf tools: Automatically add new channel according to evlist Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:00 +0100
[PATCH 01/53] perf tools: Add -lutil in python lib list for broken python-config Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:00 +0100
Re: [PATCH 01/53] perf tools: Add -lutil in python lib list for broken python-config Jiri Olsa <jolsa@redhat.com> - 2016-01-12 10:50 +0100
[tip:perf/urgent] perf tools: Add -lutil in python lib list for broken python-config tip-bot for Wang Nan <tipbot@zytor.com> - 2016-01-12 11:10 +0100
[PATCH 09/53] perf: bpf: Fix build breakage due to libbpf Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:00 +0100
[tip:perf/urgent] perf bpf: Fix build breakage due to libbpf "tip-bot for Naveen N. Rao" <tipbot@zytor.com> - 2016-01-12 11:20 +0100
[PATCH 52/53] perf record: Toggle tailsize ring buffer for reading Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:00 +0100
[PATCH 17/53] perf test: Improve bp_signal Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:00 +0100
Re: [PATCH 17/53] perf test: Improve bp_signal Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-11 22:40 +0100
Re: [PATCH 17/53] perf test: Improve bp_signal "Wangnan (F)" <wangnan0@huawei.com> - 2016-01-12 05:20 +0100
Re: [PATCH 17/53] perf test: Improve bp_signal Jiri Olsa <jolsa@redhat.com> - 2016-01-12 10:30 +0100
Re: [PATCH 17/53] perf test: Improve bp_signal Will Deacon <will.deacon@arm.com> - 2016-01-12 15:20 +0100
Re: [PATCH 17/53] perf test: Improve bp_signal Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-12 15:20 +0100
[PATCH 47/53] perf record: Don't read from and poll overwrite channel Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:00 +0100
[PATCH 28/53] perf tools: Move timestamp creation to util Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:00 +0100
[PATCH 39/53] perf record: Re-synthesize tracking events after output switching Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:00 +0100
[PATCH 33/53] perf record: Introduce record__finish_output() to finish a perf.data Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:00 +0100
[PATCH 46/53] perf tools: Squash overwrite setting into channel Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:00 +0100
[PATCH 34/53] perf record: Use OPT_BOOLEAN_SET for buildid cache related options Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:00 +0100
[PATCH 43/53] perf tools: Add evlist channel helpers Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:00 +0100
[PATCH 51/53] perf record: Read from tailsize ring buffer Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:00 +0100
[PATCH 42/53] perf record: Prevent reading invalid data in record__mmap_read Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:00 +0100
Re: [PATCH 42/53] perf record: Prevent reading invalid data in record__mmap_read Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2016-01-11 15:30 +0100
Re: [PATCH 42/53] perf record: Prevent reading invalid data in record__mmap_read Arnaldo Carvalho de Melo <acme@redhat.com> - 2016-01-11 16:10 +0100
Re: [PATCH 42/53] perf record: Prevent reading invalid data in record__mmap_read Arnaldo Carvalho de Melo <acme@redhat.com> - 2016-01-11 16:10 +0100
[PATCH 40/53] perf record: Generate tracking events for process forked by perf Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:00 +0100
[PATCH 41/53] perf record: Ensure return non-zero rc when mmap fail Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:00 +0100
[PATCH 49/53] perf tools: Consider TAILSIZE bit when caclulate is_pos Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:00 +0100
[PATCH 31/53] perf tools: Add perf_data_file__switch() helper Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:00 +0100
[PATCH 50/53] perf tools: Set tailsize attribut bit for overwrite events Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:00 +0100
[PATCH 45/53] perf tools: Operate multiple channels Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:00 +0100
[PATCH 30/53] perf record: Extract synthesize code to record__synthesize() Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:00 +0100
[PATCH 07/53] tools: Move Makefile.arch from perf/config to tools/scripts Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:00 +0100
Re: [PATCH 07/53] tools: Move Makefile.arch from perf/config to tools/scripts "Wangnan (F)" <wangnan0@huawei.com> - 2016-01-11 15:10 +0100
Re: [PATCH 07/53] tools: Move Makefile.arch from perf/config to tools/scripts Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-11 15:20 +0100
[tip:perf/urgent] tools: Move Makefile.arch from perf/ config to tools/scripts tip-bot for Wang Nan <tipbot@zytor.com> - 2016-01-12 11:20 +0100
[PATCH 53/53] perf record: Allow generate tracking events at the end of output Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:00 +0100
[PATCH 48/53] perf tools: Enable overwrite settings Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:00 +0100
[PATCH 11/53] perf test: Fix false TEST_OK result for 'perf test hist' Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:10 +0100
Re: [PATCH 11/53] perf test: Fix false TEST_OK result for 'perf test hist' Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2016-01-11 15:30 +0100
Re: [PATCH 11/53] perf test: Fix false TEST_OK result for 'perf test hist' Arnaldo Carvalho de Melo <acme@redhat.com> - 2016-01-11 16:00 +0100
Re: [PATCH 11/53] perf test: Fix false TEST_OK result for 'perf test hist' Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-11 16:40 +0100
[tip:perf/urgent] perf test: Fix false TEST_OK result for ' perf test hist' tip-bot for Wang Nan <tipbot@zytor.com> - 2016-01-12 11:20 +0100
[PATCH 15/53] perf tools: Fix symbols searching for offline module in buildid-cache Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:10 +0100
[PATCH 06/53] perf tools: Fix PowerPC native building Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:10 +0100
[tip:perf/urgent] perf tools: Fix PowerPC native building tip-bot for Wang Nan <tipbot@zytor.com> - 2016-01-12 11:20 +0100
[PATCH 23/53] perf tools: Support setting different slots in a BPF map separately Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:10 +0100
[PATCH 02/53] perf tools: Fix phony build target for build-test Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:10 +0100
[tip:perf/urgent] perf tools: Fix phony build target for build-test tip-bot for Wang Nan <tipbot@zytor.com> - 2016-01-12 11:20 +0100
[PATCH 19/53] perf tools: Enable BPF object configure syntax Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:10 +0100
[PATCH 05/53] perf tools: Test correct path of perf in build-test Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:10 +0100
Re: [PATCH 05/53] perf tools: Test correct path of perf in build-test Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-11 16:30 +0100
Re: [PATCH 05/53] perf tools: Test correct path of perf in build-test Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-11 23:10 +0100
Re: [PATCH 05/53] perf tools: Test correct path of perf in build-test Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-11 23:40 +0100
Re: [PATCH 05/53] perf tools: Test correct path of perf in build-test Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-11 23:50 +0100
Re: [PATCH 05/53] perf tools: Test correct path of perf in build-test "Wangnan (F)" <wangnan0@huawei.com> - 2016-01-12 08:20 +0100
Re: [PATCH 05/53] perf tools: Test correct path of perf in build-test Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-12 15:10 +0100
[PATCH 20/53] perf record: Apply config to BPF objects before recording Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:10 +0100
[PATCH 14/53] perf test: Check environment before start real BPF test Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:10 +0100
Re: [PATCH 14/53] perf test: Check environment before start real BPF test Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-11 23:00 +0100
Re: [PATCH 14/53] perf test: Check environment before start real BPF test "Wangnan (F)" <wangnan0@huawei.com> - 2016-01-12 08:50 +0100
[PATCH 26/53] perf data: Support converting data from bpf_perf_event_output() Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:10 +0100
[PATCH 36/53] perf record: Split output into multiple files via '--switch-output' Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:10 +0100
[PATCH 12/53] perf test: Reset err after using it hold errcode in hist testcases Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:10 +0100
[tip:perf/urgent] perf test: Reset err after using it hold errcode in hist testcases tip-bot for Wang Nan <tipbot@zytor.com> - 2016-01-12 11:20 +0100
[PATCH 29/53] perf tools: Make ordered_events reusable Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:10 +0100
Re: [PATCH 29/53] perf tools: Make ordered_events reusable Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-11 22:40 +0100
[PATCH 04/53] perf tools: Pass O option to Makefile.perf in build-test Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:10 +0100
[PATCH 32/53] perf record: Turns auxtrace_snapshot_enable into 3 states Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:10 +0100
[PATCH 16/53] perf tools: Fix mmap2 event allocation in synthesize code Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:10 +0100
Re: [PATCH 16/53] perf tools: Fix mmap2 event allocation in synthesize code Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-11 22:10 +0100
[PATCH 16/53 v2] perf tools: Fix mmap2 event allocation in synthesize code Wang Nan <wangnan0@huawei.com> - 2016-01-12 11:20 +0100
RE: [PATCH 16/53 v2] perf tools: Fix mmap2 event allocation in synthesize code 平松雅巳 / HIRAMATU,MASAMI <masami.hiramatsu.pt@hitachi.com> - 2016-01-12 11:50 +0100
Re: [PATCH 16/53 v2] perf tools: Fix mmap2 event allocation in synthesize code "Wangnan (F)" <wangnan0@huawei.com> - 2016-01-12 12:00 +0100
Re: [PATCH 16/53 v2] perf tools: Fix mmap2 event allocation in synthesize code "acme@kernel.org" <acme@kernel.org> - 2016-01-12 15:30 +0100
RE: [PATCH 16/53 v2] perf tools: Fix mmap2 event allocation in synthesize code 平松雅巳 / HIRAMATU,MASAMI <masami.hiramatsu.pt@hitachi.com> - 2016-01-13 01:50 +0100
[tip:perf/urgent] perf tools: Fix mmap2 event allocation in synthesize code tip-bot for Wang Nan <tipbot@zytor.com> - 2016-01-13 10:50 +0100
[PATCH 08/53] perf tools: Add missing sources in perf's MANIFEST Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:10 +0100
[PATCH 21/53] perf tools: Enable passing event to BPF object Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:10 +0100
[PATCH 25/53] perf tools: Introduce bpf-output event Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:20 +0100
[PATCH 18/53] perf tools: Add API to config maps in bpf object Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:20 +0100
[PATCH 24/53] perf tools: Enable indices setting syntax for BPF maps Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:20 +0100
[PATCH 22/53] perf tools: Support perf event alias name Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:20 +0100
[PATCH 13/53] perf tools: Prevent calling machine__delete() on non-allocated machine Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:20 +0100
Re: [PATCH 13/53] perf tools: Prevent calling machine__delete() on non-allocated machine Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-11 16:50 +0100
Re: [PATCH 13/53] perf tools: Prevent calling machine__delete() on non-allocated machine "Wangnan (F)" <wangnan0@huawei.com> - 2016-01-12 08:10 +0100
Re: [PATCH 13/53] perf tools: Prevent calling machine__delete() on non-allocated machine Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-12 15:10 +0100
[PATCH 10/53] tools build: Add BPF feature check to test-all Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:20 +0100
[tip:perf/urgent] tools build: Add BPF feature check to test-all tip-bot for Wang Nan <tipbot@zytor.com> - 2016-01-12 11:20 +0100
[PATCH 37/53] perf record: Force enable --timestamp-filename when --switch-output is provided Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:20 +0100
[PATCH 03/53] perf tools: Set parallel making options build-test Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:20 +0100
[PATCH 35/53] perf record: Add '--timestamp-filename' option to append timestamp to output filename Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:30 +0100
[PATCH 38/53] perf record: Disable buildid cache options by default in switch output mode Wang Nan <wangnan0@huawei.com> - 2016-01-11 15:30 +0100
csiph-web