From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Hari Bathini <hbathini@linux.vnet.ibm.com>
Cc: ast@fb.com, peterz@infradead.org,
lkml <linux-kernel@vger.kernel.org>,
alexander.shishkin@linux.intel.com, mingo@redhat.com,
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: Re: [PATCH v7 5/8] perf tool: add print support for namespace events
Date: Wed, 1 Mar 2017 18:06:49 -0300 [thread overview]
Message-ID: <20170301210649.GL15145@kernel.org> (raw)
In-Reply-To: <148768571212.30285.8979607887293145010.stgit@hbathini.in.ibm.com>
Em Tue, Feb 21, 2017 at 07:31:52PM +0530, Hari Bathini escreveu:
> +++ b/tools/perf/util/event.c
> @@ -1104,6 +1104,33 @@ size_t perf_event__fprintf_comm(union perf_event *event, FILE *fp)
> return fprintf(fp, "%s: %s:%d/%d\n", s, event->comm.comm, event->comm.pid, event->comm.tid);
> }
>
> +size_t perf_event__fprintf_namespaces(union perf_event *event, FILE *fp)
> +{
> + size_t ret = 0;
> + struct perf_ns_link_info *ns_link_info;
> + u32 nr_namespaces, idx;
> +
> + ns_link_info = event->namespaces.link_info;
> + nr_namespaces = event->namespaces.nr_namespaces;
Perfect, no magic numbers here. :-)
- Arnaldo
> + ret += fprintf(fp, " %d/%d - nr_namespaces: %u\n\t[",
> + event->namespaces.pid,
> + event->namespaces.tid,
> + nr_namespaces);
> +
> + for (idx = 0; idx < nr_namespaces; idx++) {
> + if (idx && (idx % 4 == 0))
> + ret += fprintf(fp, "\n\t ");
> +
> + ret += fprintf(fp, "%u/%s: %lu/0x%lx%s", idx,
> + perf_ns__name(idx), (u64)ns_link_info[idx].dev,
> + (u64)ns_link_info[idx].ino,
> + ((idx + 1) != nr_namespaces) ? ", " : "]\n\n");
> + }
> +
> + return ret;
> +}
> +
> int perf_event__process_comm(struct perf_tool *tool __maybe_unused,
> union perf_event *event,
> struct perf_sample *sample,
> @@ -1300,6 +1327,9 @@ size_t perf_event__fprintf(union perf_event *event, FILE *fp)
> case PERF_RECORD_MMAP:
> ret += perf_event__fprintf_mmap(event, fp);
> break;
> + case PERF_RECORD_NAMESPACES:
> + ret += perf_event__fprintf_namespaces(event, fp);
> + break;
> case PERF_RECORD_MMAP2:
> ret += perf_event__fprintf_mmap2(event, fp);
> break;
> diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
> index c73ad47..8eb470b 100644
> --- a/tools/perf/util/event.h
> +++ b/tools/perf/util/event.h
> @@ -673,6 +673,7 @@ size_t perf_event__fprintf_itrace_start(union perf_event *event, FILE *fp);
> size_t perf_event__fprintf_switch(union perf_event *event, FILE *fp);
> size_t perf_event__fprintf_thread_map(union perf_event *event, FILE *fp);
> size_t perf_event__fprintf_cpu_map(union perf_event *event, FILE *fp);
> +size_t perf_event__fprintf_namespaces(union perf_event *event, FILE *fp);
> size_t perf_event__fprintf(union perf_event *event, FILE *fp);
>
> u64 kallsyms__get_function_start(const char *kallsyms_filename,
> diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
> index 060fabb..5f46ad0 100644
> --- a/tools/perf/util/machine.c
> +++ b/tools/perf/util/machine.c
> @@ -519,6 +519,9 @@ int machine__process_namespaces_event(struct machine *machine __maybe_unused,
> "\nWARNING: perf tool seems to support more namespaces than"
> " the kernel.\nTry updating the kernel..\n\n");
>
> + if (dump_trace)
> + perf_event__fprintf_namespaces(event, stdout);
> +
> if (thread == NULL ||
> thread__set_namespaces(thread, sample->time, &event->namespaces)) {
> dump_printf("problem processing PERF_RECORD_NAMESPACES, skipping event.\n");
next prev parent reply other threads:[~2017-03-01 21:17 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 [this message]
2017-02-21 14:02 ` [PATCH v7 6/8] perf tool: add script " Hari Bathini
2017-03-01 21:08 ` 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=20170301210649.GL15145@kernel.org \
--to=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=hbathini@linux.vnet.ibm.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).