-
Notifications
You must be signed in to change notification settings - Fork 4k
tcppktlat: Add histogram mode with per-PID grouping #5430
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
base: master
Are you sure you want to change the base?
Conversation
libbpf-tools/tcppktlat_example.txt
Outdated
| Trace latency between TCP received pkt and picked up by userspace thread. | ||
|
|
||
| USAGE: tcppktlat [--help] [-T] [-p PID] [-t TID] [-l LPORT] [-r RPORT] [-v] | ||
| USAGE: tcppktlat [--help] [-T] [-H] [-p PID] [-t TID] [-l LPORT] [-r RPORT] [-w] [-v] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The USAGE description in tcppktlat_example.txt is inconsistent with the actual implementation in tcppktlat. c
libbpf-tools/tcppktlat.c
Outdated
| env.histogram = true; | ||
| if (arg) { | ||
| errno = 0; | ||
| env.interval = strtoul(arg, NULL, 10); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The -H option allows specifying interval both as an optional argument and as a positional argument, which creates ambiguity.
| fprintf(stderr, "Invalid delay (in us): %s\n", arg); | ||
| argp_usage(state); | ||
| if (env.histogram) { | ||
| /* For histogram mode, positional args are interval and count */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Positional argument behavior depends on -H, but this is unclear in the help message.
libbpf-tools/tcppktlat.bpf.c
Outdated
| hkey = pid; | ||
|
|
||
| histp = bpf_map_lookup_or_try_init(&hists, &hkey, &zero); | ||
| if (histp) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explicit error handling would be preferable, similar to the else case. For example:
if (!histp)
goto cleanup;
Add -H option to display latency as histograms grouped by PID. Supports periodic printing with interval argument and works with existing filters like -p, -t, -l, -r. Signed-off-by: Wenbo Zhang <[email protected]>
|
@ekyooo addressed, thx! |
Add -H option to display latency as histograms grouped by PID. Supports periodic printing with interval argument and works with existing filters like -p, -t, -l, -r.