Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp443525imn; Thu, 28 Jul 2022 05:42:02 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tpErgqz60UHIUrRxosDad7GR8asQwme7mHON/+rKnExJCR4Z6V+UdKLngE1bMh9zghA1zU X-Received: by 2002:a05:6402:d45:b0:43c:b9f5:9ed1 with SMTP id ec5-20020a0564020d4500b0043cb9f59ed1mr7085888edb.309.1659012121907; Thu, 28 Jul 2022 05:42:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659012121; cv=none; d=google.com; s=arc-20160816; b=j+j4zF2HqSrNp5hEHsLLFpuolh5gYo2x3BIF6fOO4zGS63+VAZiXZbUG3jSq+hofrH JTa7OtPbex7q5ZAEmj5OItbzSBBYUmWF/45pAE/L4260whlmF7pPnDCINTa6ZYOoCZIt vwdyhLk71TTgujyD9v2eWuz8dny+jiCG8NjhMYuja/u11bnrTYvNvf49MyCbh/JP1apZ hmWDvhbI5+BmQiupxcBbm0siGzG5g7LXtLhnMsPEXv6aPGi693PufrG4m9uxh3PhvgFe c5fBu1pK8izQzvIVaruDxb1Mv9AlAkXup0IEJGHrP173VLkJEP44d7+lHMs0H/ZW27r3 IIyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=T6nN2K6UGmQgfeRdQhzo502STGI7YkX1Kx3CeX19PWM=; b=XctGwi7zMPGO/I4BMTJxUa57eDg06IEYceLfHSkGBqn+HOlHOFgRICe0ipsupaNqe4 dABOkaxbta1MyIkJHkux8xFQ7rsxFpw3htCynuwoStoj206JI5lEo7xfPvU4yNeGi0Ox xnE3qKmvrHFu53uJVqiTzOdxSEijm13KM0xAVPbQFv4uHh1JYYyA35tJN0muccGMwa9t iXwYLtcBrXVkDhFSbMuZW6MGCEQIe6PQU+0Y+wcVZ8nZMUj06Giar2xVLFH4AkmBlf4g kjnXh8J0CjeR5k/cKXGXXUcbZJLolpZ7rn5yrgYCu52znOZ9+ocW2ggVvPH9YYAc+w90 UmAA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k18-20020aa7d8d2000000b0043bc450a117si587428eds.407.2022.07.28.05.41.37; Thu, 28 Jul 2022 05:42:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236127AbiG1Lzs (ORCPT + 99 others); Thu, 28 Jul 2022 07:55:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229648AbiG1Lzq (ORCPT ); Thu, 28 Jul 2022 07:55:46 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEF0E39B9B; Thu, 28 Jul 2022 04:55:45 -0700 (PDT) Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Ltpts2kMvzlVw5; Thu, 28 Jul 2022 19:53:09 +0800 (CST) Received: from kwepemm600003.china.huawei.com (7.193.23.202) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 28 Jul 2022 19:55:43 +0800 Received: from [10.67.111.205] (10.67.111.205) by kwepemm600003.china.huawei.com (7.193.23.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 28 Jul 2022 19:55:42 +0800 Subject: Re: [RFC v3 06/17] perf kwork: Implement perf kwork report To: Namhyung Kim CC: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , "Paul Clarke" , linux-kernel , linux-perf-users References: <20220709015033.38326-1-yangjihong1@huawei.com> <20220709015033.38326-7-yangjihong1@huawei.com> From: Yang Jihong Message-ID: Date: Thu, 28 Jul 2022 19:55:42 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.111.205] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemm600003.china.huawei.com (7.193.23.202) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Namhyung , On 2022/7/28 8:00, Namhyung Kim wrote: > On Fri, Jul 8, 2022 at 6:53 PM Yang Jihong 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 [] {record|report} >> >> -D, --dump-raw-trace dump raw trace in ASCII >> -f, --force don't complain, do it >> -k, --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 [] >> >> -C, --cpu list of cpus to profile >> -i, --input input file name >> -n, --name event name to profile >> -s, --sort >> sort by key(s): runtime, max, count >> -S, --with-summary Show summary with statistics >> --time 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 [] >> >> -C, --cpu list of cpus to profile >> -i, --input input file name >> -n, --name event name to profile >> -s, --sort >> sort by key(s): runtime, max, count >> -S, --with-summary Show summary with statistics >> --time 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 >> --- >> 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 ' 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: ,. 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 >> #include >> >> +/* >> + * 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 .