From: Hari Bathini <hbathini@linux.vnet.ibm.com>
To: ast@fb.com, peterz@infradead.org,
lkml <linux-kernel@vger.kernel.org>,
acme@kernel.org, alexander.shishkin@linux.intel.com,
mingo@redhat.com
Cc: daniel@iogearbox.net, rostedt@goodmis.org,
Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>,
ebiederm@xmission.com, sargun@sargun.me,
Aravinda Prasad <aravinda@linux.vnet.ibm.com>,
brendan.d.gregg@gmail.com, jolsa@redhat.com
Subject: [PATCH v7 6/8] perf tool: add script print support for namespace events
Date: Tue, 21 Feb 2017 19:32:19 +0530 [thread overview]
Message-ID: <148768573968.30285.17200542889651567470.stgit@hbathini.in.ibm.com> (raw)
In-Reply-To: <148768564246.30285.16450228018975882950.stgit@hbathini.in.ibm.com>
Add script print support for events of type PERF_RECORD_NAMESPACES.
Signed-off-by: Hari Bathini <hbathini@linux.vnet.ibm.com>
---
tools/perf/builtin-script.c | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index f1ce806..66d62c9 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -830,6 +830,7 @@ struct perf_script {
bool show_task_events;
bool show_mmap_events;
bool show_switch_events;
+ bool show_namespace_events;
bool allocated;
struct cpu_map *cpus;
struct thread_map *threads;
@@ -1118,6 +1119,41 @@ static int process_comm_event(struct perf_tool *tool,
return ret;
}
+static int process_namespaces_event(struct perf_tool *tool,
+ union perf_event *event,
+ struct perf_sample *sample,
+ struct machine *machine)
+{
+ struct thread *thread;
+ struct perf_script *script = container_of(tool, struct perf_script, tool);
+ struct perf_session *session = script->session;
+ struct perf_evsel *evsel = perf_evlist__id2evsel(session->evlist, sample->id);
+ int ret = -1;
+
+ thread = machine__findnew_thread(machine, event->namespaces.pid,
+ event->namespaces.tid);
+ if (thread == NULL) {
+ pr_debug("problem processing NAMESPACES event, skipping it.\n");
+ return -1;
+ }
+
+ if (perf_event__process_namespaces(tool, event, sample, machine) < 0)
+ goto out;
+
+ if (!evsel->attr.sample_id_all) {
+ sample->cpu = 0;
+ sample->time = 0;
+ sample->tid = event->namespaces.tid;
+ sample->pid = event->namespaces.pid;
+ }
+ print_sample_start(sample, thread, evsel);
+ perf_event__fprintf(event, stdout);
+ ret = 0;
+out:
+ thread__put(thread);
+ return ret;
+}
+
static int process_fork_event(struct perf_tool *tool,
union perf_event *event,
struct perf_sample *sample,
@@ -1293,6 +1329,8 @@ static int __cmd_script(struct perf_script *script)
}
if (script->show_switch_events)
script->tool.context_switch = process_switch_event;
+ if (script->show_namespace_events)
+ script->tool.namespaces = process_namespaces_event;
ret = perf_session__process_events(script->session);
@@ -2181,6 +2219,8 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
"Show the mmap events"),
OPT_BOOLEAN('\0', "show-switch-events", &script.show_switch_events,
"Show context switch events (if recorded)"),
+ OPT_BOOLEAN('\0', "show-namespace-events", &script.show_namespace_events,
+ "Show namespace events (if recorded)"),
OPT_BOOLEAN('f', "force", &symbol_conf.force, "don't complain, do it"),
OPT_BOOLEAN(0, "ns", &nanosecs,
"Use 9 decimal places when displaying time"),
next prev parent reply other threads:[~2017-02-21 14:03 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-21 14:01 [PATCH v7 0/8] perf: add support for analyzing events for containers Hari Bathini
2017-02-21 14:01 ` [PATCH v7 1/8] perf: add PERF_RECORD_NAMESPACES to include namespaces related info Hari Bathini
2017-02-24 12:14 ` Peter Zijlstra
2017-03-01 20:45 ` Arnaldo Carvalho de Melo
2017-02-21 14:01 ` [PATCH v7 2/8] perf tool: " Hari Bathini
2017-03-01 21:02 ` Arnaldo Carvalho de Melo
2017-03-03 8:54 ` Hari Bathini
2017-02-21 14:01 ` [PATCH v7 3/8] perf tool: update about the new option to record namespace events Hari Bathini
2017-03-01 21:03 ` Arnaldo Carvalho de Melo
2017-02-21 14:01 ` [PATCH v7 4/8] perf tool: synthesize namespace events for current processes Hari Bathini
2017-03-01 21:05 ` Arnaldo Carvalho de Melo
2017-03-03 8:57 ` Hari Bathini
2017-02-21 14:01 ` [PATCH v7 5/8] perf tool: add print support for namespace events Hari Bathini
2017-03-01 21:06 ` Arnaldo Carvalho de Melo
2017-02-21 14:02 ` Hari Bathini [this message]
2017-03-01 21:08 ` [PATCH v7 6/8] perf tool: add script " Arnaldo Carvalho de Melo
2017-02-21 14:02 ` [PATCH v7 7/8] perf tool: update about the new option to show " Hari Bathini
2017-02-21 14:03 ` [PATCH v7 8/8] perf tool: add cgroup identifier entry in perf report Hari Bathini
2017-02-22 16:48 ` Jiri Olsa
2017-03-01 21:16 ` Arnaldo Carvalho de Melo
2017-03-03 8:59 ` Hari Bathini
2017-02-22 11:11 ` [PATCH v7 0/8] perf: add support for analyzing events for containers Jiri Olsa
2017-02-22 12:40 ` Hari Bathini
2017-02-22 13:52 ` 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=148768573968.30285.17200542889651567470.stgit@hbathini.in.ibm.com \
--to=hbathini@linux.vnet.ibm.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=ananth@linux.vnet.ibm.com \
--cc=aravinda@linux.vnet.ibm.com \
--cc=ast@fb.com \
--cc=brendan.d.gregg@gmail.com \
--cc=daniel@iogearbox.net \
--cc=ebiederm@xmission.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=sargun@sargun.me \
/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).