mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yang Jihong <yangjihong1@huawei.com>
To: Namhyung Kim <namhyung@kernel.org>
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 06/17] perf kwork: Implement perf kwork report
Date: Thu, 28 Jul 2022 19:55:42 +0800	[thread overview]
Message-ID: <d27ab7d1-bb9c-6086-1ea1-345ec82adeea@huawei.com> (raw)
In-Reply-To: <CAM9d7chkZzYmuuo3XZ4NdpAErv-5ermDBtOQ+ZaO30t=KuTNQg@mail.gmail.com>

Hello Namhyung ,

On 2022/7/28 8:00, Namhyung Kim wrote:
> On Fri, Jul 8, 2022 at 6:53 PM Yang Jihong <yangjihong1@huawei.com> wrote:
>>
>> Implements framework of perf kwork report, which is used to report time
>> properties such as run time and frequency:
>>
>> Test cases:
>>
>>    # perf kwork
>>
>>     Usage: perf kwork [<options>] {record|report}
>>
>>        -D, --dump-raw-trace  dump raw trace in ASCII
>>        -f, --force           don't complain, do it
>>        -k, --kwork <kwork>   list of kwork to profile (irq, softirq, workqueue, etc)
>>        -v, --verbose         be more verbose (show symbol address, etc)
>>
>>    # perf kwork report -h
>>
>>     Usage: perf kwork report [<options>]
>>
>>        -C, --cpu <cpu>       list of cpus to profile
>>        -i, --input <file>    input file name
>>        -n, --name <name>     event name to profile
>>        -s, --sort <key[,key2...]>
>>                              sort by key(s): runtime, max, count
>>        -S, --with-summary    Show summary with statistics
>>            --time <str>      Time span for analysis (start,stop)
>>
>>    # perf kwork report
>>
>>      Kwork Name                     | Cpu  | Total Runtime | Count     | Max runtime   | Max runtime start   | Max runtime end     |
>>     --------------------------------------------------------------------------------------------------------------------------------
>>     --------------------------------------------------------------------------------------------------------------------------------
>>
>>    # perf kwork report -S
>>
>>      Kwork Name                     | Cpu  | Total Runtime | Count     | Max runtime   | Max runtime start   | Max runtime end     |
>>     --------------------------------------------------------------------------------------------------------------------------------
>>     --------------------------------------------------------------------------------------------------------------------------------
>>      Total count            :         0
>>      Total runtime   (msec) :     0.000 (0.000% load average)
>>      Total time span (msec) :     0.000
>>     --------------------------------------------------------------------------------------------------------------------------------
>>
>>    # perf kwork report -C 0,100
>>    Requested CPU 100 too large. Consider raising MAX_NR_CPUS
>>    Invalid cpu bitmap
>>
>>    # perf kwork report -s runtime1
>>      Error: Unknown --sort key: `runtime1'
>>
>>     Usage: perf kwork report [<options>]
>>
>>        -C, --cpu <cpu>       list of cpus to profile
>>        -i, --input <file>    input file name
>>        -n, --name <name>     event name to profile
>>        -s, --sort <key[,key2...]>
>>                              sort by key(s): runtime, max, count
>>        -S, --with-summary    Show summary with statistics
>>            --time <str>      Time span for analysis (start,stop)
>>
>>    # perf kwork report -i perf_no_exist.data
>>    failed to open perf_no_exist.data: No such file or directory
>>
>>    # perf kwork report --time 00FFF,
>>    Invalid time span
>>
>> Since there are no report supported events, the output is empty.
>>
>> Briefly describe the data structure:
>> 1. "class" indicates event type. For example, irq and softiq correspond
>> to different types.
>> 2. "cluster" refers to a specific event corresponding to a type. For
>> example, RCU and TIMER in softirq correspond to different clusters,
>> which contains three types of events: raise, entry, and exit.
> 
> Maybe I'm too late... but it's now "work", right?
> 
Yes, The code has been changed to "work" according to previous 
suggestion, but commit message forgets to modify ...

>> 3. "atom" includes time of each sample and sample of the previous phase.
>> (For example, exit corresponds to entry, which is used for timehist.)
>>
>> Signed-off-by: Yang Jihong <yangjihong1@huawei.com>
>> ---
>>   tools/perf/Documentation/perf-kwork.txt |  33 +
>>   tools/perf/builtin-kwork.c              | 859 +++++++++++++++++++++++-
>>   tools/perf/util/kwork.h                 | 161 +++++
>>   3 files changed, 1051 insertions(+), 2 deletions(-)
>>
>> diff --git a/tools/perf/Documentation/perf-kwork.txt b/tools/perf/Documentation/perf-kwork.txt
>> index c5b52f61da99..b79b2c0d047e 100644
>> --- a/tools/perf/Documentation/perf-kwork.txt
>> +++ b/tools/perf/Documentation/perf-kwork.txt
>> @@ -17,8 +17,11 @@ There are several variants of 'perf kwork':
>>     'perf kwork record <command>' to record the kernel work
>>     of an arbitrary workload.
>>
>> +  'perf kwork report' to report the per kwork runtime.
>> +
>>       Example usage:
>>           perf kwork record -- sleep 1
>> +        perf kwork report
>>
>>   OPTIONS
>>   -------
>> @@ -38,6 +41,36 @@ OPTIONS
>>   --verbose::
>>          Be more verbose. (show symbol address, etc)
>>
>> +OPTIONS for 'perf kwork report'
>> +----------------------------
>> +
>> +-C::
>> +--cpu::
>> +       Only show events for the given CPU(s) (comma separated list).
>> +
>> +-i::
>> +--input::
>> +       Input file name. (default: perf.data unless stdin is a fifo)
>> +
>> +-n::
>> +--name::
>> +       Only show events for the given name.
>> +
>> +-s::
>> +--sort::
>> +       Sort by key(s): runtime, max, count
>> +
>> +-S::
>> +--with-summary::
>> +       Show summary with statistics
>> +
>> +--time::
>> +       Only analyze samples within given time window: <start>,<stop>. Times
>> +       have the format seconds.microseconds. If start is not given (i.e., time
>> +       string is ',x.y') then analysis starts at the beginning of the file. If
>> +       stop time is not given (i.e, time string is 'x.y,') then analysis goes
>> +       to end of file.
>> +
>>   SEE ALSO
>>   --------
>>   linkperf:perf-record[1]
>> diff --git a/tools/perf/builtin-kwork.c b/tools/perf/builtin-kwork.c
>> index 8086236b7513..9c488d647995 100644
>> --- a/tools/perf/builtin-kwork.c
>> +++ b/tools/perf/builtin-kwork.c
>> @@ -25,6 +25,460 @@
>>   #include <linux/time64.h>
>>   #include <linux/zalloc.h>
>>
>> +/*
>> + * report header elements width
>> + */
>> +#define PRINT_CPU_WIDTH 4
>> +#define PRINT_COUNT_WIDTH 9
>> +#define PRINT_RUNTIME_WIDTH 10
>> +#define PRINT_TIMESTAMP_WIDTH 17
>> +#define PRINT_KWORK_NAME_WIDTH 30
>> +#define RPINT_DECIMAL_WIDTH 3
>> +#define PRINT_TIME_UNIT_SEC_WIDTH 2
>> +#define PRINT_TIME_UNIT_MESC_WIDTH 3
> 
> MSEC ?
> 
Yes, I'll fix in next patch,thanks for your review.

Regards,
Jihong
.

  reply	other threads:[~2022-07-28 11:55 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
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 [this message]
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=d27ab7d1-bb9c-6086-1ea1-345ec82adeea@huawei.com \
    --to=yangjihong1@huawei.com \
    --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=namhyung@kernel.org \
    --cc=pc@us.ibm.com \
    --cc=peterz@infradead.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