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

libbpf-tools/tcptop: Fix PID column alignment when pids are large #4986

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

bernhardkaindl
Copy link
Contributor

@bernhardkaindl bernhardkaindl commented May 6, 2024

Fix PID column alignment when PIDs are large in libbpf-tools/tcptop:

Check the maximum width of the PIDs on the system and adjust the format to avoid column misalignment:

PID     COMM         LADDR                 RADDR                  RX_KB  TX_KB
1987802 wget         127.0.0.1:44960       127.0.0.1:443              6      0
1987815 wget         127.0.0.1:44968       127.0.0.1:443              6      0
2770    stunnel      127.0.0.1:51460       127.0.0.1:80               4      0
2770    stunnel      127.0.0.1:51452       127.0.0.1:80               4      0
1936412 sshd         10.71.56.137:22       10.71.8.14:45682           0      2
1987805 curl         127.0.0.1:44964       127.0.0.1:443              1      0
1987818 curl         127.0.0.1:44972       127.0.0.1:443              1      0
2770    stunnel      127.0.0.1:51456       127.0.0.1:80               0      0
2770    stunnel      127.0.0.1:51464       127.0.0.1:80               0      0
1918977 sshd         10.71.56.137:22       10.71.8.14:51046           0      0
  • Also fix the alignment of the "TX_KB" label by moving the trailing "\n" character from it to the format string
  • Also add libbpf-tools/tcptop_example.txt documenting the example.

PS: GitHub CI fails on a few test cases (flaky) so I added a minor commits to make CI less flaky.

@bernhardkaindl bernhardkaindl force-pushed the libbpf-tcptop-fix-pid-column-alignment branch from f6518d5 to c0ab716 Compare May 8, 2024 19:51
@bernhardkaindl bernhardkaindl force-pushed the libbpf-tcptop-fix-pid-column-alignment branch from 4610b4f to 4c286a2 Compare May 8, 2024 23:11
@yonghong-song
Copy link
Collaborator

Looks like you have 5 commits but it seems only the first commit is relevant to this pull request. Could you rebase on top of master and re-push the pull request?

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