From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83C9EC433DB for ; Thu, 14 Jan 2021 16:44:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 50BFD23B1C for ; Thu, 14 Jan 2021 16:44:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726511AbhANQnt (ORCPT ); Thu, 14 Jan 2021 11:43:49 -0500 Received: from mga03.intel.com ([134.134.136.65]:50417 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725878AbhANQns (ORCPT ); Thu, 14 Jan 2021 11:43:48 -0500 IronPort-SDR: MrRIM6UxgSgob59hePHYcCrY5NtlS/dXuK2mmgBP0QfrN2MGqMDKHzkLLTZG0YDIFfUsaxHncq W5uQRO2VW+uQ== X-IronPort-AV: E=McAfee;i="6000,8403,9864"; a="178489179" X-IronPort-AV: E=Sophos;i="5.79,347,1602572400"; d="scan'208";a="178489179" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jan 2021 08:41:35 -0800 IronPort-SDR: +5KIU+xfNsh18q/Q0Essm6+uCVm4HO6B5iYLITBnzN3rWS5ekz90+aM9KvC6qheRcMJHmJ88JE iiFieRJ/FiGg== X-IronPort-AV: E=Sophos;i="5.79,347,1602572400"; d="scan'208";a="353964485" Received: from aantonov-mobl.ccr.corp.intel.com (HELO [10.249.226.96]) ([10.249.226.96]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jan 2021 08:41:32 -0800 Subject: Re: [PATCH v2 5/6] perf stat: Enable iiostat mode for x86 platforms To: Namhyung Kim Cc: Arnaldo Carvalho de Melo , linux-kernel , Jiri Olsa , Andi Kleen , Alexander Shishkin , Mark Rutland , Ian Rogers , Ingo Molnar , Peter Zijlstra References: <20201223130320.3930-1-alexander.antonov@linux.intel.com> <20201223130320.3930-6-alexander.antonov@linux.intel.com> <358dd76f-c6ec-b894-14be-659df0802c87@linux.intel.com> From: Alexander Antonov Message-ID: <20f98862-9087-0368-7124-19a8f2b54db9@linux.intel.com> Date: Thu, 14 Jan 2021 19:41:30 +0300 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-Transfer-Encoding: 8bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/14/2021 6:39 AM, Namhyung Kim wrote: > On Wed, Jan 13, 2021 at 9:08 PM Alexander Antonov > wrote: >> >> On 1/6/2021 12:02 PM, Namhyung Kim wrote: >>> On Wed, Dec 23, 2020 at 10:03 PM Alexander Antonov >>> wrote: >>>> This functionality is based on recently introduced sysfs attributes >>>> for Intel® Xeon® Scalable processor family (code name Skylake-SP): >>>> Commit bb42b3d39781 ("perf/x86/intel/uncore: Expose an Uncore unit to >>>> IIO PMON mapping") >>>> >>>> Mode is intended to provide four I/O performance metrics in MB per each >>>> IIO stack: >>>> - Inbound Read: I/O devices below IIO stack read from the host memory >>>> - Inbound Write: I/O devices below IIO stack write to the host memory >>>> - Outbound Read: CPU reads from I/O devices below IIO stack >>>> - Outbound Write: CPU writes to I/O devices below IIO stack >>>> >>>> Each metric requiries only one IIO event which increments at every 4B >>>> transfer in corresponding direction. The formulas to compute metrics >>>> are generic: >>>> #EventCount * 4B / (1024 * 1024) >>> Hmm.. maybe we can do this with JSON metrics, no? >> Do you mean to add metrics to *-metrics.json file? >> Looks like it's possible but in this case JSON file should be updated >> for each >> new enabled platform and calculations will be the same. >> I would prefer to leave it as is because perf will work without changing of >> userspace part once IIO sysfs attributes are added for new platforms. > OK. > >>>> Signed-off-by: Alexander Antonov >>>> --- > [SNIP] >>>> diff --git a/tools/perf/perf-iiostat.sh b/tools/perf/perf-iiostat.sh >>>> new file mode 100644 >>>> index 000000000000..2c5168d2550b >>>> --- /dev/null >>>> +++ b/tools/perf/perf-iiostat.sh >>>> @@ -0,0 +1,12 @@ >>>> +#!/bin/bash >>>> +# SPDX-License-Identifier: GPL-2.0 >>>> +# perf iiostat >>>> +# Alexander Antonov >>>> + >>>> +if [[ "$1" == "show" ]] || [[ "$1" =~ ([a-f0-9A-F]{1,}):([a-f0-9A-F]{1,2})(,)? ]]; then >>>> + DELIMITER="=" >>>> +else >>>> + DELIMITER=" " >>>> +fi >>>> + >>>> +perf stat --iiostat$DELIMITER$* >>> Why is this needed? >>> >>> Thanks, >>> Namhyung >> Arnaldo raised question relates to format of 'perf stat --iiostat' >> subcommand >> and explained how it can be changed to 'perf iiostat' through the aliases >> mechanism in perf. > Yeah, I know that. What I'm asking is the DELIMITER part. > > Thanks, > Namhyung I'm using DELIMITER to resolve two different cases for format of iiostat command: The first one is the command with an option for iiostat mode, for example: 'perf iiostat show' which should be converted to 'perf stat --iiostat=show' or 'perf iiostat 0000:ae,0000:5d' to 'perf stat --iiostat=0000:ae,0000:5d'. The second is the command without any option for iiostat: 'perf iiostat -I 1000' should be converted to 'perf stat --iiostat -I 1000'. Thanks, Alexander