Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp5173043pxu; Thu, 10 Dec 2020 15:07:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJx5NVoIyoSWcuhX17l772Np5EZ4tgVozPNulfxNanu6/+QR8gtuPFsjtK2+SvPP6L7NnA+W X-Received: by 2002:a50:d5c1:: with SMTP id g1mr9351407edj.299.1607641639970; Thu, 10 Dec 2020 15:07:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607641639; cv=none; d=google.com; s=arc-20160816; b=v3hYRY5Qg/cCvt4rURupTQnAwUiO2DlVY51qvlfcbdw831KV96KOKJj0utnhNEaLE9 A+1D9Qx/3I9u5nZtyaRrlwN+T8uG8seol4f/lILVwo8Za3Ekv48nlaeCJGH+mwaHuQpe umMFYZw1N8Ff+N9eyPoA1VQK05aVvPju8mmi5HanRNZGjRmSVN/v55wx1ZvAnWEr2XS3 8Y7xYr7/ktgNLc3TT/MZOWvvZ/HI0qhfgfr5VXh6j1dT8ua4BKK8gcDypUu4vFo9s3Jd U+bQhZhPlbnQSLWW5Swm+DMCE5bQ24lkkR9hkZ2ey4n+PFWAdGQQF6Gw9TEJOuDfCkJI 3mgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:ironport-sdr:ironport-sdr; bh=TeOSwm9qdDA/dx4rB8omqzO5oyiGRDuQWIBm4en5PyM=; b=NBtN6bIiorxckmYXTByjdjdjrHocEQKkBxf26Cxdj53VQWqJRph1XCJ8nd3dMAbGC0 6TvUaYKDVh7TvWvlNesx39Br1rK6PNOUiXbneHR6sr7cxaXKC0n42kjdWxeT2XstZx1g f5IKk+RPSOnZKrN4fYrewdrwlAtWlGrLH9P87YduWlAdpTTbX4UsJHyHFV85n58KZl6J dyo+r/ywP6V8zOFe9ufCbx5eFDtsQcCsMm9y0qY8Ttl9HXKUKiid9w50NoGeA9PSBHJ8 OCJB30TJNBnaVmYe2UmQlhdwcjOB7NEx6s3uW0yiKFstM6aW2cBrp8D9nTswysFMuyuI MuAg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hq14si3546253ejc.99.2020.12.10.15.06.57; Thu, 10 Dec 2020 15:07:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728200AbgLJJFe (ORCPT + 99 others); Thu, 10 Dec 2020 04:05:34 -0500 Received: from mga11.intel.com ([192.55.52.93]:6071 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725789AbgLJJFd (ORCPT ); Thu, 10 Dec 2020 04:05:33 -0500 IronPort-SDR: YBrn1K4rBLHh4/GvqXM3NKgzlUZueoT5HQf7+c5tKGUYTnyhluYa70/6zuOkrTcJOLvDJDD9Q+ +fdPHzh/bK0g== X-IronPort-AV: E=McAfee;i="6000,8403,9830"; a="170712731" X-IronPort-AV: E=Sophos;i="5.78,408,1599548400"; d="scan'208";a="170712731" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Dec 2020 01:03:47 -0800 IronPort-SDR: Dj7UvgcF4zrBcK7+nlkOysADaagPsYet2XXFgkijKbtftcHdqMcgzhOYfAYdFYSp/PUd2zkWdQ ADjJ/Mq1d5lg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,408,1599548400"; d="scan'208";a="408450101" Received: from nntpdsd52-183.inn.intel.com ([10.125.52.183]) by orsmga001.jf.intel.com with ESMTP; 10 Dec 2020 01:03:42 -0800 From: Alexander Antonov To: acme@kernel.org Cc: linux-kernel@vger.kernel.org, jolsa@redhat.com, alexander.shishkin@linux.intel.com, mark.rutland@arm.com, namhyung@kernel.org, mingo@redhat.com, peterz@infradead.org, ak@linux.intel.com, alexander.antonov@linux.intel.com Subject: [PATCH 0/5] perf stat: Introduce --iiostat mode to provide I/O performance metrics Date: Thu, 10 Dec 2020 12:03:35 +0300 Message-Id: <20201210090340.14358-1-alexander.antonov@linux.intel.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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) Note: --iiostat introduces new perf data aggregation mode - per I/O stack hence -e and -M options are not supported. Usage examples: 1. List all IIO stacks (example for 2-S platform): $ perf stat --iiostat=show S0-uncore_iio_0<0000:00> S1-uncore_iio_0<0000:80> S0-uncore_iio_1<0000:17> S1-uncore_iio_1<0000:85> S0-uncore_iio_2<0000:3a> S1-uncore_iio_2<0000:ae> S0-uncore_iio_3<0000:5d> S1-uncore_iio_3<0000:d7> 2. Collect metrics for all I/O stacks: $ perf stat --iiostat -- dd if=/dev/zero of=/dev/nvme0n1 bs=1M oflag=direct 357708+0 records in 357707+0 records out 375083606016 bytes (375 GB, 349 GiB) copied, 215.974 s, 1.7 GB/s Performance counter stats for 'system wide': port Inbound Read(MB) Inbound Write(MB) Outbound Read(MB) Outbound Write(MB) 0000:00 1 0 2 3 0000:80 0 0 0 0 0000:17 352552 43 0 21 0000:85 0 0 0 0 0000:3a 3 0 0 0 0000:ae 0 0 0 0 0000:5d 0 0 0 0 0000:d7 0 0 0 0 3. Collect metrics for comma separated list of I/O stacks: $ perf stat --iiostat=0000:17,0:3a -- dd if=/dev/zero of=/dev/nvme0n1 bs=1M oflag=direct 357708+0 records in 357707+0 records out 375083606016 bytes (375 GB, 349 GiB) copied, 197.08 s, 1.9 GB/s Performance counter stats for 'system wide': port Inbound Read(MB) Inbound Write(MB) Outbound Read(MB) Outbound Write(MB) 0000:17 358559 44 0 22 0000:3a 3 2 0 0 197.081983474 seconds time elapsed Alexander Antonov (5): perf stat: Add AGGR_IIO_STACK mode perf evsel: Introduce an observed performance device perf stat: Basic support for iiostat in perf stat perf stat: Helper functions for IIO stacks list in iiostat mode perf stat: Enable --iiostat mode for x86 platforms tools/perf/Documentation/perf-stat.txt | 31 ++ tools/perf/arch/x86/util/Build | 1 + tools/perf/arch/x86/util/iiostat.c | 460 ++++++++++++++++++ tools/perf/builtin-stat.c | 38 +- tools/perf/util/evsel.h | 1 + tools/perf/util/iiostat.h | 33 ++ .../scripting-engines/trace-event-python.c | 2 +- tools/perf/util/stat-display.c | 51 +- tools/perf/util/stat-shadow.c | 11 +- tools/perf/util/stat.c | 3 +- tools/perf/util/stat.h | 2 + 11 files changed, 625 insertions(+), 8 deletions(-) create mode 100644 tools/perf/arch/x86/util/iiostat.c create mode 100644 tools/perf/util/iiostat.h base-commit: 644bf4b0f7acde641d3db200b4db66977e96c3bd -- 2.19.1