Skip to content

perf stat: Introduce iostat mode to provide I/O performance metrics

[email protected] lkml 6 versions – Applied

Status from this message: Thanks, applied.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest posting 2/24 patches 1 replyApplied
  2. v5 posting 1/24 patches 1 replySuperseded
  3. v45 patches 13 repliesSuperseded
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v35 patches1 replySuperseded
v26 patches12 repliesSuperseded
v15 patches4 repliesSuperseded

Changes in v5 from the cover letter

- Addressed comments from Namhyung Kim:
1. Removed AGGR_PCIE_PORT aggregation mode
2. Added iostat_prepare() function
3. Moved implementation specific fprintf() calls to separate x86-related function
4. Fixed code-related issues
- Moved __weak iostat's functions to separate util/iostat.c file

Patches in v5 posting 2/2 Applied

#Subject and filesSizeRepliesApplied
1/4perf stat: Basic support for iostat in perftools/perf/builtin-stat.c tools/perf/util/Build tools/perf/util/iostat.c +4 more+156 -120 replies
2/4perf stat: Helper functions for PCIe root ports list in iostat modetools/perf/arch/x86/util/iostat.c+110 -00 replies
3/4perf stat: Enable iostat mode for x86 platformstools/perf/Documentation/perf-iostat.txt tools/perf/Makefile.perf tools/perf/arch/x86/util/Build +3 more+466 -10 replies
4/4perf: Update .gitignore filetools/perf/.gitignore+1 -00 replies

Reviews trailers per patch

All 4 patches have a Reviewed-by or Acked-by.

PatchNamhyung Kim
1/4A-b
2/4A-b
3/4A-b
4/4A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v5 thread

Cover letter [RESEND PATCH v5 0/4] perf stat: Introduce iostat mode to provide I/O performance metrics

From: Alexander Antonov <[email protected]>

Resending V5 with added Acked-by: Namhyung Kim <[email protected]> tag.

Thanks,
Alexander

The previous version can be found at:
v4: https://lkml.kernel.org/r/[email protected]/
Changes in this revision are:
v4 -> v5:
- Addressed comments from Namhyung Kim:
1. Removed AGGR_PCIE_PORT aggregation mode
2. Added iostat_prepare() function
3. Moved implementation specific fprintf() calls to separate x86-related function
4. Fixed code-related issues
- Moved __weak iostat's functions to separate util/iostat.c file

The previous version can be found at:
v3: https://lkml.kernel.org/r/[email protected]/
Changes in this revision are:
v3 -> v4:
- Addressed comment from Namhyung Kim:
1. Removed NULL-termination of root ports list

The previous version can be found at:
v2: https://lkml.kernel.org/r/[email protected]

Changes in this revision are:
v2 -> v3:
- Addressed comments from Namhyung Kim:
1. Removed perf_device pointer from evsel structure. Use priv field instead
2. Renamed 'iiostat' to 'iostat'
3. Renamed 'show' mode to 'list' mode
4. Renamed iiostat_delete_root_ports() to iiostat_release() and iostat_show_root_ports() to iostat_list()

The previous version can be found at:
v1: https://lkml.kernel.org/r/[email protected]

Changes in this revision are:
v1 -> v2:
- Addressed comment from Arnaldo Carvalho de Melo:
1. Using 'perf iiostat' subcommand instead of 'perf stat --iiostat':
- Added perf-iiostat.sh script to use short command
- Updated manual pages to get help for 'perf iiostat'
- Added 'perf-iiostat' to perf's gitignore file

Mode is intended to provide four I/O performance metrics in MB per each root port:

 - Inbound Read:   I/O devices below root port read from the host memory
 - Inbound Write:  I/O devices below root port write to the host memory
 - Outbound Read:  CPU reads from I/O devices below root port

- Outbound Write: CPU writes to I/O devices below root port

Each metric requiries only one uncore event which increments at every 4B transfer in corresponding direction. The formulas to compute metrics are generic:

    #EventCount * 4B / (1024 * 1024)

Note: iostat introduces new perf data aggregation mode - per PCIe root port hence -e and -M options are not supported.

Usage examples:

1. List all PCIe root ports (example for 2-S platform):

   $ perf iostat list
   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 PCIe root ports:

   $ perf iostat -- 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 PCIe root ports:

   $ perf iostat 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 (4):
perf stat: Basic support for iostat in perf
perf stat: Helper functions for PCIe root ports list in iostat mode perf stat: Enable iostat mode for x86 platforms
perf: Update .gitignore file

 tools/perf/.gitignore                    |   1 +
 tools/perf/Documentation/perf-iostat.txt |  88 +++++
 tools/perf/Makefile.perf                 |   5 +-
 tools/perf/arch/x86/util/Build           |   1 +
 tools/perf/arch/x86/util/iostat.c        | 470 +++++++++++++++++++++++
 tools/perf/builtin-stat.c                |  21 +-
 tools/perf/command-list.txt              |   1 +
 tools/perf/perf-iostat.sh                |  12 +
 tools/perf/util/Build                    |   1 +
 tools/perf/util/iostat.c                 |  53 +++
 tools/perf/util/iostat.h                 |  47 +++
 tools/perf/util/stat-display.c           |  40 +-
 tools/perf/util/stat-shadow.c            |   5 +-
 tools/perf/util/stat.h                   |   1 +
 14 files changed, 733 insertions(+), 13 deletions(-)
 create mode 100644 tools/perf/Documentation/perf-iostat.txt
 create mode 100644 tools/perf/arch/x86/util/iostat.c
 create mode 100644 tools/perf/perf-iostat.sh
 create mode 100644 tools/perf/util/iostat.c
 create mode 100644 tools/perf/util/iostat.h

base-commit: 4c391ea001cb2e7bd9a691a886c0dcb030c1791c

Signature · 1 line
2.21.3