From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org,
Adrian Hunter <adrian.hunter@intel.com>,
Andi Kleen <ak@linux.intel.com>,
Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 17/30] perf script: Add 'synth' field for synthesized event payloads
Date: Fri, 30 Jun 2017 19:25:01 -0300 [thread overview]
Message-ID: <20170630222514.11832-18-acme@kernel.org> (raw)
In-Reply-To: <20170630222514.11832-1-acme@kernel.org>
From: Adrian Hunter <adrian.hunter@intel.com>
Add a field to display the content the raw_data of a synthesized event.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Link: http://lkml.kernel.org/r/1495786658-18063-22-git-send-email-adrian.hunter@intel.com
[ Resolved conflict with 106dacd86f04 ("perf script: Support -F brstackoff,dso") ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/Documentation/perf-script.txt | 6 +++++-
tools/perf/builtin-script.c | 20 ++++++++++++++++++--
2 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/tools/perf/Documentation/perf-script.txt b/tools/perf/Documentation/perf-script.txt
index e2468ed6a307..5ee8796be96e 100644
--- a/tools/perf/Documentation/perf-script.txt
+++ b/tools/perf/Documentation/perf-script.txt
@@ -117,7 +117,8 @@ OPTIONS
Comma separated list of fields to print. Options are:
comm, tid, pid, time, cpu, event, trace, ip, sym, dso, addr, symoff,
srcline, period, iregs, brstack, brstacksym, flags, bpf-output, brstackinsn, brstackoff,
- callindent, insn, insnlen. Field list can be prepended with the type, trace, sw or hw,
+ callindent, insn, insnlen, synth.
+ Field list can be prepended with the type, trace, sw or hw,
to indicate to which event type the field list applies.
e.g., -F sw:comm,tid,time,ip,sym and -F trace:time,cpu,trace
@@ -193,6 +194,9 @@ OPTIONS
instruction bytes and the instruction length of the current
instruction.
+ The synth field is used by synthesized events which may be created when
+ Instruction Trace decoding.
+
Finally, a user may not set fields to none for all event types.
i.e., -F "" is not allowed.
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 2999e7e425f6..e87b480bbdd0 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -86,6 +86,7 @@ enum perf_output_field {
PERF_OUTPUT_INSNLEN = 1U << 22,
PERF_OUTPUT_BRSTACKINSN = 1U << 23,
PERF_OUTPUT_BRSTACKOFF = 1U << 24,
+ PERF_OUTPUT_SYNTH = 1U << 25,
};
struct output_option {
@@ -117,6 +118,7 @@ struct output_option {
{.str = "insnlen", .field = PERF_OUTPUT_INSNLEN},
{.str = "brstackinsn", .field = PERF_OUTPUT_BRSTACKINSN},
{.str = "brstackoff", .field = PERF_OUTPUT_BRSTACKOFF},
+ {.str = "synth", .field = PERF_OUTPUT_SYNTH},
};
enum {
@@ -196,7 +198,8 @@ static struct {
.fields = PERF_OUTPUT_COMM | PERF_OUTPUT_TID |
PERF_OUTPUT_CPU | PERF_OUTPUT_TIME |
PERF_OUTPUT_EVNAME | PERF_OUTPUT_IP |
- PERF_OUTPUT_SYM | PERF_OUTPUT_DSO,
+ PERF_OUTPUT_SYM | PERF_OUTPUT_DSO |
+ PERF_OUTPUT_SYNTH,
.invalid_fields = PERF_OUTPUT_TRACE | PERF_OUTPUT_BPF_OUTPUT,
},
@@ -1200,6 +1203,15 @@ static void print_sample_bpf_output(struct perf_sample *sample)
(char *)(sample->raw_data));
}
+static void print_sample_synth(struct perf_sample *sample __maybe_unused,
+ struct perf_evsel *evsel)
+{
+ switch (evsel->attr.config) {
+ default:
+ break;
+ }
+}
+
struct perf_script {
struct perf_tool tool;
struct perf_session *session;
@@ -1284,6 +1296,10 @@ static void process_event(struct perf_script *script,
if (PRINT_FIELD(TRACE))
event_format__print(evsel->tp_format, sample->cpu,
sample->raw_data, sample->raw_size);
+
+ if (attr->type == PERF_TYPE_SYNTH && PRINT_FIELD(SYNTH))
+ print_sample_synth(sample, evsel);
+
if (PRINT_FIELD(ADDR))
print_sample_addr(sample, thread, attr);
@@ -2605,7 +2621,7 @@ int cmd_script(int argc, const char **argv)
"Valid types: hw,sw,trace,raw,synth. "
"Fields: comm,tid,pid,time,cpu,event,trace,ip,sym,dso,"
"addr,symoff,period,iregs,brstack,brstacksym,flags,"
- "bpf-output,callindent,insn,insnlen,brstackinsn",
+ "bpf-output,callindent,insn,insnlen,brstackinsn,synth",
parse_output_fields),
OPT_BOOLEAN('a', "all-cpus", &system_wide,
"system-wide collection from all CPUs"),
--
2.9.4
next prev parent reply other threads:[~2017-06-30 22:26 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-30 22:24 [GIT PULL 00/30] perf/core improvements and fixes Arnaldo Carvalho de Melo
2017-06-30 22:24 ` [PATCH 01/30] perf tests: Add platform dependency to test 15 Arnaldo Carvalho de Melo
2017-06-30 22:24 ` [PATCH 02/30] perf help: Introduce exec_failed() to avoid code duplication Arnaldo Carvalho de Melo
2017-06-30 22:24 ` [PATCH 03/30] perf help: Elliminate dup code for reporting Arnaldo Carvalho de Melo
2017-06-30 22:24 ` [PATCH 04/30] perf help: Use pr_warning() Arnaldo Carvalho de Melo
2017-06-30 22:24 ` [PATCH 05/30] perf config: " Arnaldo Carvalho de Melo
2017-06-30 22:24 ` [PATCH 06/30] perf event-parse: " Arnaldo Carvalho de Melo
2017-06-30 22:24 ` [PATCH 07/30] perf tools: Remove warning() Arnaldo Carvalho de Melo
2017-06-30 22:24 ` [PATCH 08/30] perf tools: Replace error() with pr_err() Arnaldo Carvalho de Melo
2017-06-30 22:24 ` [PATCH 09/30] perf config: Do not die when parsing u64 or int config values Arnaldo Carvalho de Melo
2017-06-30 22:24 ` [PATCH 10/30] perf tools: Kill die() Arnaldo Carvalho de Melo
2017-06-30 22:24 ` [PATCH 11/30] perf jit: fix typo: "incalid" -> "invalid" Arnaldo Carvalho de Melo
2017-06-30 22:24 ` [PATCH 12/30] x86/insn: perf tools: Add new ptwrite instruction Arnaldo Carvalho de Melo
2017-06-30 22:24 ` [PATCH 13/30] perf script: Add 'synth' event type for synthesized events Arnaldo Carvalho de Melo
2017-06-30 22:24 ` [PATCH 14/30] tools include: Add byte-swapping macros to kernel.h Arnaldo Carvalho de Melo
2017-06-30 22:24 ` [PATCH 15/30] perf auxtrace: Add itrace option to output ptwrite events Arnaldo Carvalho de Melo
2017-06-30 22:25 ` [PATCH 16/30] perf auxtrace: Add itrace option to output power events Arnaldo Carvalho de Melo
2017-06-30 22:25 ` Arnaldo Carvalho de Melo [this message]
2017-06-30 22:25 ` [PATCH 18/30] perf script: Add synthesized Intel PT power and ptwrite events Arnaldo Carvalho de Melo
2017-06-30 22:25 ` [PATCH 19/30] perf intel-pt: Factor out common code synthesizing event samples Arnaldo Carvalho de Melo
2017-06-30 22:25 ` [PATCH 20/30] perf intel-pt: Remove unused instructions_sample_period Arnaldo Carvalho de Melo
2017-06-30 22:25 ` [PATCH 21/30] perf intel-pt: Join needlessly wrapped lines Arnaldo Carvalho de Melo
2017-06-30 22:25 ` [PATCH 22/30] perf intel-pt: Tidy Intel PT evsel lookup into separate function Arnaldo Carvalho de Melo
2017-06-30 22:25 ` [PATCH 23/30] perf intel-pt: Tidy messages into called function intel_pt_synth_event() Arnaldo Carvalho de Melo
2017-06-30 22:25 ` [PATCH 24/30] perf intel-pt: Factor out intel_pt_set_event_name() Arnaldo Carvalho de Melo
2017-06-30 22:25 ` [PATCH 25/30] perf intel-pt: Move code in intel_pt_synth_events() to simplify attr setting Arnaldo Carvalho de Melo
2017-06-30 22:25 ` [PATCH 26/30] perf intel-pt: Synthesize new power and "ptwrite" events Arnaldo Carvalho de Melo
2017-06-30 22:25 ` [PATCH 27/30] perf intel-pt: Add example script for power events and PTWRITE Arnaldo Carvalho de Melo
2017-06-30 22:25 ` [PATCH 28/30] perf intel-pt: Update documentation to include new ptwrite and power events Arnaldo Carvalho de Melo
2017-06-30 22:25 ` [PATCH 29/30] perf intel-pt: Do not use TSC packets for calculating CPU cycles to TSC Arnaldo Carvalho de Melo
2017-06-30 22:25 ` [PATCH 30/30] perf auxtrace: Add CPU filter support Arnaldo Carvalho de Melo
2017-07-01 8:41 ` [GIT PULL 00/30] perf/core improvements and fixes Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170630222514.11832-18-acme@kernel.org \
--to=acme@kernel.org \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=ak@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.