Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Byte String Prefix in Output #5179

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

TwilightTechie
Copy link

Byte strings are printed directly, leading to output with the 'b' prefix

example:
Caller Avg Spin Count Max spin Total spin
b'ep_poll+0x16b' 1096 26576 8180 29145121
b'drm_fb_helper_damage_work+0x97' 1705 32 2870 54580
b'process_one_work+0x178' 1325 55 2520 72879
b'ext4_evict_inode+0x283' 1625 11 2400 17880

This fix decode the byte strings
After fix:
Caller Avg Spin Count Max spin Total spin
process_one_work+0x178 1569 24 3530 37657
ep_poll+0x16b 1037 12 3090 12450
kthread+0xf2 2336 3 2830 7010
rcu_tasks_kthread+0xa4 1642 5 2490 8210

Copy link
Contributor

@ekyooo ekyooo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you change the commit title like below, similar to other tools, it will make it easier to view the git log later.
"tools/klockstat: ~~"

@@ -431,7 +431,7 @@ def display(sort, maxs, totals, counts):

avg = totals[k].value / counts[k].value

print("%40s %10lu %6lu %10lu %10lu" % (caller, avg, counts[k].value, maxs[k].value, totals[k].value))
print("%40s %10lu %6lu %10lu %10lu" % (caller.decode('utf-8'), avg, counts[k].value, maxs[k].value, totals[k].value))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you provide a second argument to prevent a UnicodeDecodeError, similar to how other tools handle it?
caller.decode('utf-8', 'replace')

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ekyooo thanks for the review, I have updated the PR. Do let me know if anything else is required.

Byte strings are printed directly, leading to output with the 'b'
prefix

example:
Caller   Avg Spin  Count   Max spin Total spin
b'ep_poll+0x16b'       1096  26576       8180   29145121
b'drm_fb_helper_damage_work+0x97'       1705     32       2870      54580
b'process_one_work+0x178'       1325     55       2520      72879
b'ext4_evict_inode+0x283'       1625     11       2400      17880

This fix decode the byte strings
After fix:

                              Caller   Avg Spin  Count   Max spin Total spin
              process_one_work+0x178       1569     24       3530      37657
                       ep_poll+0x16b       1037     12       3090      12450
                        kthread+0xf2       2336      3       2830       7010
              rcu_tasks_kthread+0xa4       1642      5       2490       8210

Signed-off-by: Anup Sharma <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants