Skip to content

Commit

Permalink
tools/offcputime: Fix python3 string output
Browse files Browse the repository at this point in the history
When using non-folded output, some of the strings would
be printed as raw byte arrays on python3, like this:

    b'finish_task_switch'
    b'__schedule'
    b'schedule'
    b'worker_thread'
    b'kthread'
    b'ret_from_fork'
    -                kworker/u16:1 (22022)
        2267942

This commit updates the code to treat these as utf8 strings,
consistent with all the other strings printed from this tool.
  • Loading branch information
lava authored and yonghong-song committed Nov 5, 2020
1 parent 8e807dc commit 57975a1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/offcputime.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,15 +303,15 @@ def signal_ignore(signal, frame):
print(" [Missed Kernel Stack]")
else:
for addr in kernel_stack:
print(" %s" % b.ksym(addr))
print(" %s" % b.ksym(addr).decode('utf-8', 'replace'))
if not args.kernel_stacks_only:
if need_delimiter and k.user_stack_id >= 0 and k.kernel_stack_id >= 0:
print(" --")
if stack_id_err(k.user_stack_id):
print(" [Missed User Stack]")
else:
for addr in user_stack:
print(" %s" % b.sym(addr, k.tgid))
print(" %s" % b.sym(addr, k.tgid).decode('utf-8', 'replace'))
print(" %-16s %s (%d)" % ("-", k.name.decode('utf-8', 'replace'), k.pid))
print(" %d\n" % v.value)

Expand Down

0 comments on commit 57975a1

Please sign in to comment.