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 tcptop: Fix PID column alignment when pids are large #5004

Merged

Conversation

bernhardkaindl
Copy link
Contributor

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: It seems that GitHub CI fails on a few test cases (flaky), not caused by this PR.

Signed-off-by: Bernhard Kaindl <bernhardkaindl7@gmail.com>
@yonghong-song yonghong-song merged commit b0b4239 into iovisor:master May 19, 2024
12 checks passed
@bernhardkaindl bernhardkaindl deleted the tcptop-pid-column-alignment branch May 22, 2024 19:37
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.

None yet

2 participants