linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fix IPC output in perf intel-pt-events script
@ 2023-03-10 11:10 Roman Lozko
  2023-03-10 13:32 ` Adrian Hunter
  0 siblings, 1 reply; 7+ messages in thread
From: Roman Lozko @ 2023-03-10 11:10 UTC (permalink / raw)
  To: adrian.hunter; +Cc: linux-perf-users, Roman Lozko

Integers are not converted to floats during division in Python 2
which results in incorrect IPC values, convert to float explicitly.

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:
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-03-14 11:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-10 11:10 [PATCH] fix IPC output in perf intel-pt-events script Roman Lozko
2023-03-10 13:32 ` Adrian Hunter
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

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).