From: Namhyung Kim <namhyung@kernel.org>
To: Yang Jihong <yangjihong1@huawei.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>, Paul Clarke <pc@us.ibm.com>,
linux-kernel <linux-kernel@vger.kernel.org>,
linux-perf-users <linux-perf-users@vger.kernel.org>
Subject: Re: [RFC v3 01/17] perf kwork: New tool
Date: Wed, 27 Jul 2022 16:33:32 -0700 [thread overview]
Message-ID: <CAM9d7cjRPSsoAk22xTO=BFQTVn+HmMZkcm7grNehHkbtRWwhgw@mail.gmail.com> (raw)
In-Reply-To: <20220709015033.38326-2-yangjihong1@huawei.com>
Hello,
On Fri, Jul 8, 2022 at 6:53 PM Yang Jihong <yangjihong1@huawei.com> wrote:
>
> The perf-kwork tool is used to trace time properties of kernel work
> (such as irq, softirq, and workqueue), including runtime, latency,
> and timehist, using the infrastructure in the perf tools to allow
> tracing extra targets.
>
> This is the first commit to reuse perf_record framework code to
> implement a simple record function, kwork is not supported currently.
>
> Test cases:
>
> # perf
>
> usage: perf [--version] [--help] [OPTIONS] COMMAND [ARGS]
>
> The most commonly used perf commands are:
> <SNIP>
> iostat Show I/O performance metrics
> kallsyms Searches running kernel for symbols
> kmem Tool to trace/measure kernel memory properties
> kvm Tool to trace/measure kvm guest os
> kwork Tool to trace/measure kernel work properties (latencies)
> list List all symbolic event types
> lock Analyze lock events
> mem Profile memory accesses
> record Run a command and record its profile into perf.data
> <SNIP>
> See 'perf help COMMAND' for more information on a specific command.
>
> # perf kwork
>
> Usage: perf kwork [<options>] {record}
>
> -D, --dump-raw-trace dump raw trace in ASCII
> -f, --force don't complain, do it
> -k, --kwork <kwork> list of kwork to profile
> -v, --verbose be more verbose (show symbol address, etc)
>
> # perf kwork record -- sleep 1
> [ perf record: Woken up 0 times to write data ]
> [ perf record: Captured and wrote 1.787 MB perf.data ]
>
> Signed-off-by: Yang Jihong <yangjihong1@huawei.com>
> ---
[SNIP]
> +
> +static int perf_kwork__record(struct perf_kwork *kwork,
> + int argc, const char **argv)
> +{
> + const char **rec_argv;
> + unsigned int rec_argc, i, j;
> + struct kwork_class *class;
> +
> + const char *const record_args[] = {
> + "record",
> + "-a",
> + "-R",
> + "-m", "1024",
> + "-c", "1",
Please consider adding '--synth task' to skip costly synthesis
if you don't need user space symbols.
> + };
> +
> + rec_argc = ARRAY_SIZE(record_args) + argc - 1;
> +
> + list_for_each_entry(class, &kwork->class_list, list)
> + rec_argc += 2 * class->nr_tracepoints;
> +
> + rec_argv = calloc(rec_argc + 1, sizeof(char *));
> + if (rec_argv == NULL)
> + return -ENOMEM;
> +
> + for (i = 0; i < ARRAY_SIZE(record_args); i++)
> + rec_argv[i] = strdup(record_args[i]);
> +
> + list_for_each_entry(class, &kwork->class_list, list) {
> + for (j = 0; j < class->nr_tracepoints; j++) {
> + rec_argv[i++] = strdup("-e");
> + rec_argv[i++] = strdup(class->tp_handlers[j].name);
> + }
> + }
> +
> + for (j = 1; j < (unsigned int)argc; j++, i++)
> + rec_argv[i] = argv[j];
> +
> + BUG_ON(i != rec_argc);
> +
> + pr_debug("record comm: ");
> + for (j = 0; j < rec_argc; j++)
> + pr_debug("%s ", rec_argv[j]);
> + pr_debug("\n");
> +
> + return cmd_record(i, rec_argv);
> +}
next prev parent reply other threads:[~2022-07-27 23:33 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-09 1:50 [RFC v3 00/17] perf: Add perf kwork Yang Jihong
2022-07-09 1:50 ` [RFC v3 01/17] perf kwork: New tool Yang Jihong
2022-07-26 17:27 ` Arnaldo Carvalho de Melo
2022-07-27 0:38 ` Yang Jihong
2022-07-27 23:33 ` Namhyung Kim [this message]
2022-07-28 11:48 ` Yang Jihong
2022-07-09 1:50 ` [RFC v3 02/17] perf kwork: Add irq kwork record support Yang Jihong
2022-07-27 23:42 ` Namhyung Kim
2022-07-28 11:50 ` Yang Jihong
2022-07-09 1:50 ` [RFC v3 03/17] perf kwork: Add softirq " Yang Jihong
2022-07-09 1:50 ` [RFC v3 04/17] perf kwork: Add workqueue " Yang Jihong
2022-07-09 1:50 ` [RFC v3 05/17] tools lib: Add list_last_entry_or_null Yang Jihong
2022-07-09 1:50 ` [RFC v3 06/17] perf kwork: Implement perf kwork report Yang Jihong
2022-07-26 17:40 ` Arnaldo Carvalho de Melo
2022-07-27 0:39 ` Yang Jihong
2022-07-27 14:04 ` Arnaldo Carvalho de Melo
2022-07-28 12:01 ` Yang Jihong
2022-07-28 0:00 ` Namhyung Kim
2022-07-28 11:55 ` Yang Jihong
2022-07-09 1:50 ` [RFC v3 07/17] perf kwork: Add irq report support Yang Jihong
2022-07-09 1:50 ` [RFC v3 08/17] perf kwork: Add softirq " Yang Jihong
2022-07-09 1:50 ` [RFC v3 09/17] perf kwork: Add workqueue " Yang Jihong
2022-07-09 1:50 ` [RFC v3 10/17] perf kwork: Implement perf kwork latency Yang Jihong
2022-07-09 1:50 ` [RFC v3 11/17] perf kwork: Add softirq latency support Yang Jihong
2022-07-09 1:50 ` [RFC v3 12/17] perf kwork: Add workqueue " Yang Jihong
2022-07-09 1:50 ` [RFC v3 13/17] perf kwork: Implement perf kwork timehist Yang Jihong
2022-07-09 1:50 ` [RFC v3 14/17] perf kwork: Implement bpf trace Yang Jihong
2022-07-09 1:50 ` [RFC v3 15/17] perf kwork: Add irq trace bpf support Yang Jihong
2022-07-25 21:39 ` Arnaldo Carvalho de Melo
2022-07-09 1:50 ` [RFC v3 16/17] perf kwork: Add softirq " Yang Jihong
2022-07-09 1:50 ` [RFC v3 17/17] perf kwork: Add workqueue " Yang Jihong
2022-07-16 9:14 ` [RFC v3 00/17] perf: Add perf kwork Yang Jihong
2022-07-17 13:29 ` Arnaldo Carvalho de Melo
2022-07-25 21:45 ` [RFC v3 00/17] perf: Add perf kwork (using BPF skels) Arnaldo Carvalho de Melo
2022-07-27 0:36 ` Yang Jihong
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='CAM9d7cjRPSsoAk22xTO=BFQTVn+HmMZkcm7grNehHkbtRWwhgw@mail.gmail.com' \
--to=namhyung@kernel.org \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=pc@us.ibm.com \
--cc=peterz@infradead.org \
--cc=yangjihong1@huawei.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).