Re: [PATCH v2 5/6] perf stat: Enable iiostat mode for x86 platforms

From: Namhyung Kim
Date: Wed Jan 13 2021 - 22:40:22 EST


On Wed, Jan 13, 2021 at 9:08 PM Alexander Antonov
<alexander.antonov@xxxxxxxxxxxxxxx> wrote:
>
>
> On 1/6/2021 12:02 PM, Namhyung Kim wrote:
> > On Wed, Dec 23, 2020 at 10:03 PM Alexander Antonov
> > <alexander.antonov@xxxxxxxxxxxxxxx> 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 <alexander.antonov@xxxxxxxxxxxxxxx>
> >> ---

[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 <alexander.antonov@xxxxxxxxxxxxxxx>
> >> +
> >> +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