From: Adrian Hunter <adrian.hunter@intel.com>
To: Roman Lozko <lozko.roma@gmail.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH] fix IPC output in perf intel-pt-events script
Date: Fri, 10 Mar 2023 15:32:23 +0200 [thread overview]
Message-ID: <01f16399-f600-2b45-766f-0b5e5f868345@intel.com> (raw)
In-Reply-To: <20230310111001.2836295-1-lozko.roma@gmail.com>
On 10/03/23 13:10, Roman Lozko wrote:
> Integers are not converted to floats during division in Python 2
> which results in incorrect IPC values, convert to float explicitly.
Thanks for finding this. Obviously Python 3 is preferred nowadays
but Python 2 seems to be still a thing.
AFAICT, it would be better to fix this by adding:
from __future__ import division
at the top of the script, next to from __future__ import print_function
Also the patch subject should be:
perf scripts: intel-pt-events.py: Fix IPC output for Python 2
Also a Fixes tag could be added i.e.
Fixes: a483e64c0b62 ("perf scripting python: intel-pt-events.py: Add --insn-trace and --src-trace")
>
> Signed-off-by: Roman Lozko <lozko.roma@gmail.com>
> ---
> tools/perf/scripts/python/intel-pt-events.py | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/scripts/python/intel-pt-events.py b/tools/perf/scripts/python/intel-pt-events.py
> index 08862a2582f4..26e840e17062 100644
> --- a/tools/perf/scripts/python/intel-pt-events.py
> +++ b/tools/perf/scripts/python/intel-pt-events.py
> @@ -269,7 +269,7 @@ def print_common_ip(param_dict, sample, symbol, dso):
> if "cyc_cnt" in sample:
> cyc_cnt = sample["cyc_cnt"]
> insn_cnt = get_optional_zero(sample, "insn_cnt")
> - ipc_str = " IPC: %#.2f (%u/%u)" % (insn_cnt / cyc_cnt, insn_cnt, cyc_cnt)
> + ipc_str = " IPC: %#.2f (%u/%u)" % (float(insn_cnt) / cyc_cnt, insn_cnt, cyc_cnt)
> else:
> ipc_str = ""
> if glb_insn and glb_disassembler is not None:
next prev parent reply other threads:[~2023-03-10 13:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-10 11:10 [PATCH] fix IPC output in perf intel-pt-events script Roman Lozko
2023-03-10 13:32 ` Adrian Hunter [this message]
2023-03-10 14:02 ` Roman Lozko
2023-03-10 14:19 ` Adrian Hunter
2023-03-10 15:04 ` [PATCH v2] perf scripts: intel-pt-events.py: Fix IPC output for Python 2 Roman Lozko
2023-03-10 16:50 ` Adrian Hunter
2023-03-14 11:44 ` Arnaldo Carvalho de Melo
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=01f16399-f600-2b45-766f-0b5e5f868345@intel.com \
--to=adrian.hunter@intel.com \
--cc=linux-perf-users@vger.kernel.org \
--cc=lozko.roma@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).