From: Namhyung Kim <namhyung@kernel.org>
To: Ingo Molnar <mingo@kernel.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>, Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Stephane Eranian <eranian@google.com>,
LKML <linux-kernel@vger.kernel.org>,
linux-perf-users@vger.kernel.org
Subject: [PATCH 09/10] perf top: Add --all-cgroups option
Date: Mon, 24 Feb 2020 13:37:48 +0900 [thread overview]
Message-ID: <20200224043749.69466-10-namhyung@kernel.org> (raw)
In-Reply-To: <20200224043749.69466-1-namhyung@kernel.org>
The --all-cgroups option is to enable cgroup profiling support. It
tells kernel to record CGROUP events in the ring buffer so that perf
report can identify task/cgroup association later.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/Documentation/perf-top.txt | 4 ++++
tools/perf/builtin-top.c | 9 +++++++++
2 files changed, 13 insertions(+)
diff --git a/tools/perf/Documentation/perf-top.txt b/tools/perf/Documentation/perf-top.txt
index 324b6b53c86b..ddab103af8c7 100644
--- a/tools/perf/Documentation/perf-top.txt
+++ b/tools/perf/Documentation/perf-top.txt
@@ -272,6 +272,10 @@ Default is to monitor all CPUS.
Record events of type PERF_RECORD_NAMESPACES and display it with the
'cgroup_id' sort key.
+--all-cgroups::
+ Record events of type PERF_RECORD_CGROUP and display it with the
+ 'cgroup' sort key.
+
--switch-on EVENT_NAME::
Only consider events after this event is found.
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 8affcab75604..5666212b2f0c 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1244,6 +1244,8 @@ static int __cmd_top(struct perf_top *top)
if (opts->record_namespaces)
top->tool.namespace_events = true;
+ if (opts->record_cgroup)
+ top->tool.cgroup_events = true;
ret = perf_event__synthesize_bpf_events(top->session, perf_event__process,
&top->session->machines.host,
@@ -1251,6 +1253,11 @@ static int __cmd_top(struct perf_top *top)
if (ret < 0)
pr_debug("Couldn't synthesize BPF events: Pre-existing BPF programs won't have symbols resolved.\n");
+ ret = perf_event__synthesize_cgroups(&top->tool, perf_event__process,
+ &top->session->machines.host);
+ if (ret < 0)
+ pr_debug("Couldn't synthesize cgroup events.\n");
+
machine__synthesize_threads(&top->session->machines.host, &opts->target,
top->evlist->core.threads, false,
top->nr_threads_synthesize);
@@ -1543,6 +1550,8 @@ int cmd_top(int argc, const char **argv)
"number of thread to run event synthesize"),
OPT_BOOLEAN(0, "namespaces", &opts->record_namespaces,
"Record namespaces events"),
+ OPT_BOOLEAN(0, "all-cgroups", &opts->record_cgroup,
+ "Record cgroup events"),
OPTS_EVSWITCH(&top.evswitch),
OPT_END()
};
--
2.25.0.265.gbab2e86ba0-goog
next prev parent reply other threads:[~2020-02-24 4:38 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-24 4:37 [PATCHSET 00/10] perf: Improve cgroup profiling (v5) Namhyung Kim
2020-02-24 4:37 ` [PATCH 01/10] perf/core: Add PERF_RECORD_CGROUP event Namhyung Kim
2020-02-24 4:37 ` [PATCH 02/10] perf/core: Add PERF_SAMPLE_CGROUP feature Namhyung Kim
2020-02-24 4:37 ` [PATCH 03/10] tools lib api fs: Move cgroupsfs__mountpoint() Namhyung Kim
2020-02-24 4:37 ` [PATCH 04/10] perf tools: Basic support for CGROUP event Namhyung Kim
2020-02-24 4:37 ` [PATCH 05/10] perf tools: Maintain cgroup hierarchy Namhyung Kim
2020-02-24 4:37 ` [PATCH 06/10] perf report: Add 'cgroup' sort key Namhyung Kim
2020-03-06 14:10 ` Jiri Olsa
2020-02-24 4:37 ` [PATCH 07/10] perf record: Support synthesizing cgroup events Namhyung Kim
2020-03-06 14:14 ` Jiri Olsa
2020-03-06 14:15 ` Jiri Olsa
2020-02-24 4:37 ` [PATCH 08/10] perf record: Add --all-cgroups option Namhyung Kim
2020-02-24 4:37 ` Namhyung Kim [this message]
2020-02-24 4:37 ` [PATCH 10/10] perf script: Add --show-cgroup-events option Namhyung Kim
2020-03-06 15:05 ` [PATCHSET 00/10] perf: Improve cgroup profiling (v5) Jiri Olsa
2020-03-22 23:58 ` Namhyung Kim
2020-03-24 16:34 ` Tejun Heo
2020-03-24 20:15 ` Peter Zijlstra
2020-03-24 21:24 ` Arnaldo Melo
2020-03-25 10:24 ` Namhyung Kim
2020-03-25 12:17 ` Arnaldo Carvalho de Melo
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=20200224043749.69466-10-namhyung@kernel.org \
--to=namhyung@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=eranian@google.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome