From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>, Ingo Molnar <mingo@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
LKML <linux-kernel@vger.kernel.org>,
Andi Kleen <ak@linux.intel.com>, Ian Rogers <irogers@google.com>,
Stephane Eranian <eranian@google.com>,
James Clark <james.clark@arm.com>,
German Gomez <german.gomez@arm.com>,
Mark Rutland <mark.rutland@arm.com>, Leo Yan <leo.yan@linaro.org>
Subject: Re: [PATCH v2] perf tools: Add SPE total latency as PERF_SAMPLE_WEIGHT
Date: Thu, 9 Dec 2021 16:07:35 -0300 [thread overview]
Message-ID: <YbJT9z/F5FjdyXdh@kernel.org> (raw)
In-Reply-To: <20211201220855.1260688-1-namhyung@kernel.org>
Em Wed, Dec 01, 2021 at 02:08:55PM -0800, Namhyung Kim escreveu:
> Use total latency info in the SPE counter packet as sample weight so
> that we can see it in local_weight and (global) weight sort keys.
>
> Maybe we can use PERF_SAMPLE_WEIGHT_STRUCT to support ins_lat as well
> but I'm not sure which latency it matches. So just adding total
> latency first.
Thanks, applied.
- Arnaldo
> Cc: German Gomez <german.gomez@arm.com>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Reviewed-by: Leo Yan <leo.yan@linaro.org>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
> tools/perf/util/arm-spe-decoder/arm-spe-decoder.c | 2 ++
> tools/perf/util/arm-spe-decoder/arm-spe-decoder.h | 1 +
> tools/perf/util/arm-spe.c | 5 ++++-
> 3 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/arm-spe-decoder/arm-spe-decoder.c b/tools/perf/util/arm-spe-decoder/arm-spe-decoder.c
> index 3fc528c9270c..5e390a1a79ab 100644
> --- a/tools/perf/util/arm-spe-decoder/arm-spe-decoder.c
> +++ b/tools/perf/util/arm-spe-decoder/arm-spe-decoder.c
> @@ -179,6 +179,8 @@ static int arm_spe_read_record(struct arm_spe_decoder *decoder)
> decoder->record.phys_addr = ip;
> break;
> case ARM_SPE_COUNTER:
> + if (idx == SPE_CNT_PKT_HDR_INDEX_TOTAL_LAT)
> + decoder->record.latency = payload;
> break;
> case ARM_SPE_CONTEXT:
> decoder->record.context_id = payload;
> diff --git a/tools/perf/util/arm-spe-decoder/arm-spe-decoder.h b/tools/perf/util/arm-spe-decoder/arm-spe-decoder.h
> index 46a8556a9e95..69b31084d6be 100644
> --- a/tools/perf/util/arm-spe-decoder/arm-spe-decoder.h
> +++ b/tools/perf/util/arm-spe-decoder/arm-spe-decoder.h
> @@ -33,6 +33,7 @@ struct arm_spe_record {
> enum arm_spe_sample_type type;
> int err;
> u32 op;
> + u32 latency;
> u64 from_ip;
> u64 to_ip;
> u64 timestamp;
> diff --git a/tools/perf/util/arm-spe.c b/tools/perf/util/arm-spe.c
> index 4748bcfe61de..82c08f2a60d0 100644
> --- a/tools/perf/util/arm-spe.c
> +++ b/tools/perf/util/arm-spe.c
> @@ -317,6 +317,7 @@ static int arm_spe__synth_mem_sample(struct arm_spe_queue *speq,
> sample.addr = record->virt_addr;
> sample.phys_addr = record->phys_addr;
> sample.data_src = data_src;
> + sample.weight = record->latency;
>
> return arm_spe_deliver_synth_event(spe, speq, event, &sample);
> }
> @@ -334,6 +335,7 @@ static int arm_spe__synth_branch_sample(struct arm_spe_queue *speq,
> sample.id = spe_events_id;
> sample.stream_id = spe_events_id;
> sample.addr = record->to_ip;
> + sample.weight = record->latency;
>
> return arm_spe_deliver_synth_event(spe, speq, event, &sample);
> }
> @@ -980,7 +982,8 @@ arm_spe_synth_events(struct arm_spe *spe, struct perf_session *session)
> attr.type = PERF_TYPE_HARDWARE;
> attr.sample_type = evsel->core.attr.sample_type & PERF_SAMPLE_MASK;
> attr.sample_type |= PERF_SAMPLE_IP | PERF_SAMPLE_TID |
> - PERF_SAMPLE_PERIOD | PERF_SAMPLE_DATA_SRC;
> + PERF_SAMPLE_PERIOD | PERF_SAMPLE_DATA_SRC |
> + PERF_SAMPLE_WEIGHT;
> if (spe->timeless_decoding)
> attr.sample_type &= ~(u64)PERF_SAMPLE_TIME;
> else
> --
> 2.34.0.384.gca35af8252-goog
--
- Arnaldo
prev parent reply other threads:[~2021-12-09 19:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-01 22:08 [PATCH v2] perf tools: Add SPE total latency as PERF_SAMPLE_WEIGHT Namhyung Kim
2021-12-09 19:07 ` Arnaldo Carvalho de Melo [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YbJT9z/F5FjdyXdh@kernel.org \
--to=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=eranian@google.com \
--cc=german.gomez@arm.com \
--cc=irogers@google.com \
--cc=james.clark@arm.com \
--cc=jolsa@redhat.com \
--cc=leo.yan@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox