From: Jiri Olsa <jolsa@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: lkml <linux-kernel@vger.kernel.org>,
David Ahern <dsahern@gmail.com>, Ingo Molnar <mingo@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: [PATCH 2/3] perf script: Pass perf_script into process_event
Date: Thu, 26 Nov 2015 14:55:24 +0100 [thread overview]
Message-ID: <1448546125-29245-2-git-send-email-jolsa@kernel.org> (raw)
In-Reply-To: <1448546125-29245-1-git-send-email-jolsa@kernel.org>
Passing perf_script struct into process_event function.
Link: http://lkml.kernel.org/n/tip-jad0bjspvazzf5v4bsnz74ax@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/perf/builtin-script.c | 26 ++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 8e3f8048d2d0..3c3f8d0e3064 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -588,8 +588,17 @@ static void print_sample_flags(u32 flags)
printf(" %-4s ", str);
}
-static void process_event(union perf_event *event, struct perf_sample *sample,
- struct perf_evsel *evsel, struct addr_location *al)
+struct perf_script {
+ struct perf_tool tool;
+ struct perf_session *session;
+ bool show_task_events;
+ bool show_mmap_events;
+ bool show_switch_events;
+};
+
+static void process_event(struct perf_script *script __maybe_unused, union perf_event *event,
+ struct perf_sample *sample, struct perf_evsel *evsel,
+ struct addr_location *al)
{
struct thread *thread = al->thread;
struct perf_event_attr *attr = &evsel->attr;
@@ -663,12 +672,13 @@ static int cleanup_scripting(void)
return scripting_ops ? scripting_ops->stop_script() : 0;
}
-static int process_sample_event(struct perf_tool *tool __maybe_unused,
+static int process_sample_event(struct perf_tool *tool,
union perf_event *event,
struct perf_sample *sample,
struct perf_evsel *evsel,
struct machine *machine)
{
+ struct perf_script *scr = container_of(tool, struct perf_script, tool);
struct addr_location al;
if (debug_mode) {
@@ -697,21 +707,13 @@ static int process_sample_event(struct perf_tool *tool __maybe_unused,
if (scripting_ops)
scripting_ops->process_event(event, sample, evsel, &al);
else
- process_event(event, sample, evsel, &al);
+ process_event(scr, event, sample, evsel, &al);
out_put:
addr_location__put(&al);
return 0;
}
-struct perf_script {
- struct perf_tool tool;
- struct perf_session *session;
- bool show_task_events;
- bool show_mmap_events;
- bool show_switch_events;
-};
-
static int process_attr(struct perf_tool *tool, union perf_event *event,
struct perf_evlist **pevlist)
{
--
2.4.3
next prev parent reply other threads:[~2015-11-26 13:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-26 13:55 [PATCH 1/3] perf script: Remove default_scripting_ops Jiri Olsa
2015-11-26 13:55 ` Jiri Olsa [this message]
2015-11-26 16:22 ` [PATCH 2/3] perf script: Pass perf_script into process_event Arnaldo Carvalho de Melo
2015-11-26 17:55 ` [PATCHv2 " Jiri Olsa
2015-11-27 7:45 ` [tip:perf/core] " tip-bot for Jiri Olsa
2015-11-26 13:55 ` [PATCH 3/3] perf script: Align event name properly Jiri Olsa
2015-11-26 14:25 ` David Ahern
2015-11-26 14:30 ` Jiri Olsa
2015-11-26 14:34 ` David Ahern
2015-12-27 11:59 ` Jiri Olsa
2015-11-26 16:33 ` [PATCH 1/3] perf script: Remove default_scripting_ops Arnaldo Carvalho de Melo
2015-11-27 7:43 ` [tip:perf/core] " tip-bot for Jiri Olsa
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=1448546125-29245-2-git-send-email-jolsa@kernel.org \
--to=jolsa@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@kernel.org \
--cc=dsahern@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox