Re: perf script, libperf: python binding bug (bytearrays vs. strings)
From: Hagen Paul Pfeifer
Date: Sun Sep 27 2020 - 05:20:18 EST
Short addendum: even under python2 not everything is perfect. It seems that
the "comm-name-memory-reuse" problem is a general problem - for python3 and
python2.
In the following example the prev_comm name should be chrome only, but is
"chromesandbox", common_comm is correctly "chrome". I believe that the memory
area for prev_comm & next_comm has not been fully memset'ed before
(memset(mem, 0, 16)).
That the string in Python3 is now a bytearray instead of a string is a
second, independent problem.
Python 2 example:
sched__sched_switch 2 563232.889356634 2924848 chrome prev_comm=chromesandbox, prev_pid=2924848, prev_prio=120, prev_state=S, next_comm=swapper/2, next_pid=0, next_prio=120
Sample: {addr=0, cpu=2, datasrc=84410401, datasrc_decode=N/A|SNP N/A|TLB N/A|LCK N/A, ip=18446744072189289569, period=1, phys_addr=0, pid=2924848, tid=2924848, time=563232889356634, transaction=0, values=[(0L, 0L)], weight=0}
Hagen