From: Wang Nan <wangnan0@huawei.com>
To: <acme@kernel.org>
Cc: <linux-kernel@vger.kernel.org>, <pi3orama@163.com>,
Wang Nan <wangnan0@huawei.com>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
"Adrian Hunter" <adrian.hunter@intel.com>,
David Ahern <dsahern@gmail.com>, Jiri Olsa <jolsa@kernel.org>,
Milian Wolff <milian.wolff@kdab.com>,
Namhyung Kim <namhyung@kernel.org>
Subject: [PATCH] perf tools: Add sample types for bpf-output event
Date: Fri, 1 Apr 2016 13:26:42 +0000 [thread overview]
Message-ID: <1459517202-42320-1-git-send-email-wangnan0@huawei.com> (raw)
Before this patch we can see very large time in the events before
bpf-output event. For example:
# ./perf trace -vv -T --ev sched:sched_switch \
--ev bpf-output/no-inherit,name=evt/ \
--ev ./test_bpf_trace.c/map:channel.event=evt/ \
usleep 10
...
18446744073709.551 (18446564645918.480 ms): usleep/4157 nanosleep(rqtp: 0x7ffd3f0dc4e0 ) ...
18446744073709.551 ( ): evt:Raise a BPF event!..)
179427791.076 ( ): perf_bpf_probe:func_begin:(ffffffff810eb9a0))
179427791.081 ( ): sched:sched_switch:usleep:4157 [120] S ==> swapper/2:0 [120])
...
We can also see the differences between bpf-output events and
breakpoint events:
For bpf output event:
sample_type IP|TID|RAW|IDENTIFIER
For tracepoint events:
sample_type IP|TID|TIME|CPU|PERIOD|RAW|IDENTIFIER
This patch fix this differences by adding more sample type for
bpf-output events.
After this patch:
# ./perf trace -vv -T --ev sched:sched_switch \
--ev bpf-output/no-inherit,name=evt/ \
--ev ./test_bpf_trace.c/map:channel.event=evt/ \
usleep 10
...
179877370.878 ( 0.003 ms): usleep/5336 nanosleep(rqtp: 0x7ffff866c450 ) ...
179877370.878 ( ): evt:Raise a BPF event!..)
179877370.878 ( ): perf_bpf_probe:func_begin:(ffffffff810eb9a0))
179877370.882 ( ): sched:sched_switch:usleep:5336 [120] S ==> swapper/4:0 [120])
179877370.945 ( ): evt:Raise a BPF event!..)
...
# ./perf trace -vv -T --ev sched:sched_switch \
--ev bpf-output/no-inherit,name=evt/ \
--ev ./test_bpf_trace.c/map:channel.event=evt/ \
usleep 10 2>&1 | grep sample_type
sample_type IP|TID|TIME|ID|CPU|PERIOD|RAW
sample_type IP|TID|TIME|ID|CPU|PERIOD|RAW
sample_type IP|TID|TIME|ID|CPU|PERIOD|RAW
sample_type IP|TID|TIME|ID|CPU|PERIOD|RAW
sample_type IP|TID|TIME|ID|CPU|PERIOD|RAW
sample_type IP|TID|TIME|ID|CPU|PERIOD|RAW
The 'IDENTIFIER' is not required because all events have the
same sample_type.
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Milian Wolff <milian.wolff@kdab.com>
Cc: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/util/evsel.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 738ce22..3fd7c2c 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -226,7 +226,8 @@ struct perf_evsel *perf_evsel__new_idx(struct perf_event_attr *attr, int idx)
perf_evsel__init(evsel, attr, idx);
if (perf_evsel__is_bpf_output(evsel)) {
- evsel->attr.sample_type |= PERF_SAMPLE_RAW;
+ evsel->attr.sample_type |= (PERF_SAMPLE_RAW | PERF_SAMPLE_TIME |
+ PERF_SAMPLE_CPU | PERF_SAMPLE_PERIOD),
evsel->attr.sample_period = 1;
}
--
1.8.3.4
next reply other threads:[~2016-04-01 13:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-01 13:26 Wang Nan [this message]
2016-04-01 15:16 ` [PATCH] perf tools: Add sample types for bpf-output event Arnaldo Carvalho de Melo
2016-04-01 15:19 ` Arnaldo Carvalho de Melo
2016-04-06 7:10 ` [tip:perf/core] perf bpf: Add sample types for 'bpf-output' event tip-bot for Wang Nan
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=1459517202-42320-1-git-send-email-wangnan0@huawei.com \
--to=wangnan0@huawei.com \
--cc=acme@kernel.org \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=dsahern@gmail.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=milian.wolff@kdab.com \
--cc=namhyung@kernel.org \
--cc=pi3orama@163.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).