-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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: fix some tools error info and usage #3245
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,20 +37,20 @@ const char *argp_program_bug_address = "<bpf@vger.kernel.org>"; | |
const char argp_program_doc[] = | ||
"Summarize on-CPU time per task as a histogram.\n" | ||
"\n" | ||
"USAGE: cpudist [--help] [-O] [-T] [-m] [-P] [-L] [-p PID] [interval] [count]\n" | ||
"USAGE: cpudist [--help] [-O] [-T] [-M] [-P] [-L] [-p PID] [interval] [count]\n" | ||
"\n" | ||
"EXAMPLES:\n" | ||
" cpudist # summarize on-CPU time as a histogram" | ||
" cpudist -O # summarize off-CPU time as a histogram" | ||
" cpudist 1 10 # print 1 second summaries, 10 times" | ||
" cpudist -mT 1 # 1s summaries, milliseconds, and timestamps" | ||
" cpudist -MT 1 # 1s summaries, milliseconds, and timestamps" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. similarly. py version is sticking with -m. What's your rationale for making these incompatible changes? |
||
" cpudist -P # show each PID separately" | ||
" cpudist -p 185 # trace PID 185 only"; | ||
|
||
static const struct argp_option opts[] = { | ||
{ "offcpu", 'O', NULL, 0, "Measure off-CPU time" }, | ||
{ "timestamp", 'T', NULL, 0, "Include timestamp on output" }, | ||
{ "milliseconds", 'm', NULL, 0, "Millisecond histogram" }, | ||
{ "milliseconds", 'M', NULL, 0, "Millisecond histogram" }, | ||
{ "pids", 'P', NULL, 0, "Print a histogram per process ID" }, | ||
{ "tids", 'L', NULL, 0, "Print a histogram per thread ID" }, | ||
{ "pid", 'p', "PID", 0, "Trace this PID only" }, | ||
|
@@ -66,7 +66,7 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state) | |
case 'v': | ||
env.verbose = true; | ||
break; | ||
case 'm': | ||
case 'M': | ||
env.milliseconds = true; | ||
break; | ||
case 'p': | ||
|
@@ -203,7 +203,7 @@ int main(int argc, char **argv) | |
|
||
obj = cpudist_bpf__open(); | ||
if (!obj) { | ||
fprintf(stderr, "failed to open and/or load BPF ojbect\n"); | ||
fprintf(stderr, "failed to open BPF object\n"); | ||
return 1; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,18 +31,18 @@ const char *argp_program_bug_address = "<bpf@vger.kernel.org>"; | |
const char argp_program_doc[] = | ||
"Trace direct reclaim latency.\n" | ||
"\n" | ||
"USAGE: drsnoop [--help] [-p PID] [-t TID] [-d DURATION] [-e]\n" | ||
"USAGE: drsnoop [--help] [-p PID] [-t TID] [-d DURATION] [-E]\n" | ||
"\n" | ||
"EXAMPLES:\n" | ||
" drsnoop # trace all direct reclaim events\n" | ||
" drsnoop -p 123 # trace pid 123\n" | ||
" drsnoop -t 123 # trace tid 123 (use for threads only)\n" | ||
" drsnoop -d 10 # trace for 10 seconds only\n" | ||
" drsnoop -e # trace all direct reclaim events with extended faileds\n"; | ||
" drsnoop -E # trace all direct reclaim events with extended faileds\n"; | ||
|
||
static const struct argp_option opts[] = { | ||
{ "duration", 'd', "DURATION", 0, "Total duration of trace in seconds" }, | ||
{ "extended", 'e', NULL, 0, "Extended fields output" }, | ||
{ "extended", 'E', NULL, 0, "Extended fields output" }, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this seems to be libbpf-tools exclusive argument, but again, why changing it in the first place? |
||
{ "pid", 'p', "PID", 0, "Process PID to trace" }, | ||
{ "tid", 't', "TID", 0, "Thread TID to trace" }, | ||
{ "verbose", 'v', NULL, 0, "Verbose debug output" }, | ||
|
@@ -69,7 +69,7 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state) | |
} | ||
env.duration = duration; | ||
break; | ||
case 'e': | ||
case 'E': | ||
env.extended = true; | ||
break; | ||
case 'p': | ||
|
@@ -156,7 +156,7 @@ int main(int argc, char **argv) | |
|
||
obj = drsnoop_bpf__open(); | ||
if (!obj) { | ||
fprintf(stderr, "failed to open and/or load BPF object\n"); | ||
fprintf(stderr, "failed to open BPF object\n"); | ||
return 1; | ||
} | ||
|
||
|
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.
biolatency.py is using
-m
, why sudden and diverging change?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.
Oh, my motivation is I think maybe it's easier to remember. Lowercase parameters need parameter values (except -v), and uppercase ones belong to the switch class, so you don't need to add parameter values.
Oh sorry, I haven't checked the email from iovisor/bcc recently, I missed it. I will look at it later (Maybe weekend).
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.
I haven't heard about such naming convention, tbh. I think the harm of changing existing arguments and, especially, diverging from .py tool, is much bigger. So let's not do such renamings unnecessarily.
And thanks for checking the other PR.
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.
Got it, I will be consistent with .py tool. Thanks!