From 32a6298d8929c91842c9a5c09f1a3f4660c32eec Mon Sep 17 00:00:00 2001 From: David Goulet Date: Tue, 21 Aug 2012 11:38:27 -0400 Subject: [PATCH] Standardize lttng command line usage text Signed-off-by: David Goulet --- src/bin/lttng/commands/add_context.c | 25 ++++++++--------------- src/bin/lttng/commands/calibrate.c | 13 +++--------- src/bin/lttng/commands/destroy.c | 3 ++- src/bin/lttng/commands/disable_channels.c | 12 +++-------- src/bin/lttng/commands/disable_consumer.c | 2 +- src/bin/lttng/commands/disable_events.c | 14 ++++--------- src/bin/lttng/commands/enable_channels.c | 12 +++-------- src/bin/lttng/commands/enable_consumer.c | 2 +- src/bin/lttng/commands/enable_events.c | 20 ++++-------------- src/bin/lttng/commands/start.c | 3 ++- src/bin/lttng/commands/stop.c | 3 ++- src/bin/lttng/commands/version.c | 6 ++++-- src/bin/lttng/commands/view.c | 1 + src/bin/lttng/lttng.c | 2 +- 14 files changed, 39 insertions(+), 79 deletions(-) diff --git a/src/bin/lttng/commands/add_context.c b/src/bin/lttng/commands/add_context.c index 38708fce1..b580d037b 100644 --- a/src/bin/lttng/commands/add_context.c +++ b/src/bin/lttng/commands/add_context.c @@ -142,13 +142,7 @@ static struct poptOption long_options[] = { {"channel", 'c', POPT_ARG_STRING, &opt_channel_name, 0, 0, 0}, {"event", 'e', POPT_ARG_STRING, &opt_event_name, 0, 0, 0}, {"kernel", 'k', POPT_ARG_VAL, &opt_kernel, 1, 0, 0}, -#if 0 - /* Not implemented yet */ - {"pid", 'p', POPT_ARG_INT, &opt_pid, 0, 0, 0}, - {"userspace", 'u', POPT_ARG_STRING | POPT_ARGFLAG_OPTIONAL, &opt_cmd_name, OPT_USERSPACE, 0, 0}, -#else {"userspace", 'u', POPT_ARG_NONE, 0, OPT_USERSPACE, 0, 0}, -#endif {"type", 't', POPT_ARG_STRING, &opt_type, OPT_TYPE, 0, 0}, {"list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL}, {0, 0, 0, 0, 0, 0, 0} @@ -302,13 +296,15 @@ static void print_ctx_type(FILE *ofp) */ static void usage(FILE *ofp) { - fprintf(ofp, "usage: lttng add-context -t TYPE\n"); + fprintf(ofp, "usage: lttng add-context -t TYPE [-k|-u] [OPTIONS]\n"); fprintf(ofp, "\n"); fprintf(ofp, "If no channel and no event is given (-c/-e), the context\n"); - fprintf(ofp, "will be added to all events and all channels.\n"); - fprintf(ofp, "Otherwise the context will be added only to the channel (-c)\n"); + fprintf(ofp, "is added to all events and all channels.\n"); + fprintf(ofp, "\n"); + fprintf(ofp, "Otherwise the context is added only to the channel (-c)\n"); fprintf(ofp, "and/or event (-e) indicated.\n"); - fprintf(ofp, "Exactly one domain (-k/--kernel or -u/--userspace) must be specified.\n"); + fprintf(ofp, "\n"); + fprintf(ofp, "Exactly one domain (-k or -u) must be specified.\n"); fprintf(ofp, "\n"); fprintf(ofp, "Options:\n"); fprintf(ofp, " -h, --help Show this help\n"); @@ -317,14 +313,9 @@ static void usage(FILE *ofp) fprintf(ofp, " -c, --channel NAME Apply to channel\n"); fprintf(ofp, " -e, --event NAME Apply to event\n"); fprintf(ofp, " -k, --kernel Apply to the kernel tracer\n"); -#if 0 - fprintf(ofp, " -u, --userspace [CMD] Apply to the user-space tracer\n"); - fprintf(ofp, " If no CMD, the domain used is UST global\n"); - fprintf(ofp, " otherwise the domain is UST EXEC_NAME\n"); - fprintf(ofp, " -p, --pid PID If -u, apply to specific PID (domain: UST PID)\n"); -#else fprintf(ofp, " -u, --userspace Apply to the user-space tracer\n"); -#endif + fprintf(ofp, "\n"); + fprintf(ofp, "Context:\n"); fprintf(ofp, " -t, --type TYPE Context type. You can repeat that option on\n"); fprintf(ofp, " the command line to specify multiple contexts at once.\n"); fprintf(ofp, " (--kernel preempts --userspace)\n"); diff --git a/src/bin/lttng/commands/calibrate.c b/src/bin/lttng/commands/calibrate.c index a14570eea..600765fcc 100644 --- a/src/bin/lttng/commands/calibrate.c +++ b/src/bin/lttng/commands/calibrate.c @@ -84,21 +84,16 @@ static struct poptOption long_options[] = { */ static void usage(FILE *ofp) { - fprintf(ofp, "usage: lttng calibrate [options] [calibrate_options]\n"); + fprintf(ofp, "usage: lttng calibrate [-k|-u] [OPTIONS]\n"); fprintf(ofp, "\n"); + fprintf(ofp, "Options:\n"); fprintf(ofp, " -h, --help Show this help\n"); fprintf(ofp, " --list-options Simple listing of options\n"); fprintf(ofp, " -k, --kernel Apply to the kernel tracer\n"); -#if 0 - fprintf(ofp, " -u, --userspace [CMD] Apply to the user-space tracer (domain: UST\n"); - fprintf(ofp, " EXEC_NAME). If no CMD, the domain is UST global.\n"; - fprintf(ofp, " (-k preempts -u)\n"); - fprintf(ofp, " -p, --pid PID If -u, apply to specific PID (domain: UST PID)\n"); -#else fprintf(ofp, " -u, --userspace Apply to the user-space tracer\n"); -#endif fprintf(ofp, "\n"); fprintf(ofp, "Calibrate options:\n"); + fprintf(ofp, " --function Dynamic function entry/return probe (default)\n"); #if 0 fprintf(ofp, " --tracepoint Tracepoint event (default)\n"); fprintf(ofp, " --probe\n"); @@ -109,8 +104,6 @@ static void usage(FILE *ofp) #endif fprintf(ofp, " --syscall System call eventl\n"); fprintf(ofp, " --marker User-space marker (deprecated)\n"); -#else - fprintf(ofp, " --function Dynamic function entry/return probe (default)\n"); #endif fprintf(ofp, "\n"); } diff --git a/src/bin/lttng/commands/destroy.c b/src/bin/lttng/commands/destroy.c index cdc2c538c..fea96f175 100644 --- a/src/bin/lttng/commands/destroy.c +++ b/src/bin/lttng/commands/destroy.c @@ -49,11 +49,12 @@ static struct poptOption long_options[] = { */ static void usage(FILE *ofp) { - fprintf(ofp, "usage: lttng destroy [options] [NAME]\n"); + fprintf(ofp, "usage: lttng destroy [NAME] [OPTIONS]\n"); fprintf(ofp, "\n"); fprintf(ofp, "Where NAME is an optional session name. If not specified, lttng will\n"); fprintf(ofp, "get it from the configuration directory (.lttng).\n"); fprintf(ofp, "\n"); + fprintf(ofp, "Options:\n"); fprintf(ofp, " -h, --help Show this help\n"); fprintf(ofp, " -a, --all Destroy all sessions\n"); fprintf(ofp, " --list-options Simple listing of options\n"); diff --git a/src/bin/lttng/commands/disable_channels.c b/src/bin/lttng/commands/disable_channels.c index 7378ee7a0..d861b3770 100644 --- a/src/bin/lttng/commands/disable_channels.c +++ b/src/bin/lttng/commands/disable_channels.c @@ -65,20 +65,14 @@ static struct poptOption long_options[] = { */ static void usage(FILE *ofp) { - fprintf(ofp, "usage: lttng disable-channel NAME[,NAME2,...] [options]\n"); + fprintf(ofp, "usage: lttng disable-channel NAME[,NAME2,...] [-k|-u] [OPTIONS]\n"); fprintf(ofp, "\n"); + fprintf(ofp, "Options:\n"); fprintf(ofp, " -h, --help Show this help\n"); fprintf(ofp, " --list-options Simple listing of options\n"); - fprintf(ofp, " -s, --session Apply to session name\n"); + fprintf(ofp, " -s, --session NAME Apply to session name\n"); fprintf(ofp, " -k, --kernel Apply to the kernel tracer\n"); -#if 0 - fprintf(ofp, " -u, --userspace [CMD] Apply to the user-space tracer\n"); - fprintf(ofp, " If no CMD, the domain used is UST global\n"); - fprintf(ofp, " or else the domain is UST EXEC_NAME\n"); - fprintf(ofp, " -p, --pid PID If -u, apply to specific PID (domain: UST PID)\n"); -#else fprintf(ofp, " -u, --userspace Apply to the user-space tracer\n"); -#endif fprintf(ofp, "\n"); } diff --git a/src/bin/lttng/commands/disable_consumer.c b/src/bin/lttng/commands/disable_consumer.c index 58361db1e..ead58b890 100644 --- a/src/bin/lttng/commands/disable_consumer.c +++ b/src/bin/lttng/commands/disable_consumer.c @@ -66,7 +66,7 @@ static void usage(FILE *ofp) fprintf(ofp, "Options:\n"); fprintf(ofp, " -h, --help Show this help\n"); fprintf(ofp, " --list-options Simple listing of options\n"); - fprintf(ofp, " -s, --session=NAME Apply to session name\n"); + fprintf(ofp, " -s, --session NAME Apply to session name\n"); fprintf(ofp, " -k, --kernel Apply to the kernel tracer\n"); fprintf(ofp, " -u, --userspace Apply to the user-space tracer\n"); fprintf(ofp, "\n"); diff --git a/src/bin/lttng/commands/disable_events.c b/src/bin/lttng/commands/disable_events.c index c0b8bf9d0..b238b9d60 100644 --- a/src/bin/lttng/commands/disable_events.c +++ b/src/bin/lttng/commands/disable_events.c @@ -69,22 +69,16 @@ static struct poptOption long_options[] = { */ static void usage(FILE *ofp) { - fprintf(ofp, "usage: lttng disable-event NAME[,NAME2,...] [options]\n"); + fprintf(ofp, "usage: lttng disable-event NAME[,NAME2,...] [-k|-u] [OPTIONS]\n"); fprintf(ofp, "\n"); + fprintf(ofp, "Options:\n"); fprintf(ofp, " -h, --help Show this help\n"); fprintf(ofp, " --list-options Simple listing of options\n"); - fprintf(ofp, " -s, --session Apply to session name\n"); - fprintf(ofp, " -c, --channel Apply to this channel\n"); + fprintf(ofp, " -s, --session NAME Apply to session name\n"); + fprintf(ofp, " -c, --channel NAME Apply to this channel\n"); fprintf(ofp, " -a, --all-events Disable all tracepoints\n"); fprintf(ofp, " -k, --kernel Apply for the kernel tracer\n"); -#if 0 - fprintf(ofp, " -u, --userspace [CMD] Apply to the user-space tracer\n"); - fprintf(ofp, " If no CMD, the domain used is UST global\n"); - fprintf(ofp, " or else the domain is UST EXEC_NAME\n"); - fprintf(ofp, " -p, --pid PID If -u, apply to specific PID (domain: UST PID)\n"); -#else fprintf(ofp, " -u, --userspace Apply to the user-space tracer\n"); -#endif fprintf(ofp, "\n"); } diff --git a/src/bin/lttng/commands/enable_channels.c b/src/bin/lttng/commands/enable_channels.c index 9b5f8d64d..57c8a1eb8 100644 --- a/src/bin/lttng/commands/enable_channels.c +++ b/src/bin/lttng/commands/enable_channels.c @@ -81,20 +81,14 @@ static struct poptOption long_options[] = { */ static void usage(FILE *ofp) { - fprintf(ofp, "usage: lttng enable-channel NAME[,NAME2,...] [options] [channel_options]\n"); + fprintf(ofp, "usage: lttng enable-channel NAME[,NAME2,...] [-u|-k] [OPTIONS]\n"); fprintf(ofp, "\n"); + fprintf(ofp, "Options:\n"); fprintf(ofp, " -h, --help Show this help\n"); fprintf(ofp, " --list-options Simple listing of options\n"); - fprintf(ofp, " -s, --session Apply to session name\n"); + fprintf(ofp, " -s, --session NAME Apply to session name\n"); fprintf(ofp, " -k, --kernel Apply to the kernel tracer\n"); -#if 0 - fprintf(ofp, " -u, --userspace [CMD] Apply to the user-space tracer\n"); - fprintf(ofp, " If no CMD, the domain used is UST global\n"); - fprintf(ofp, " or else the domain is UST EXEC_NAME\n"); - fprintf(ofp, " -p, --pid PID If -u, apply to specific PID (domain: UST PID)\n"); -#else fprintf(ofp, " -u, --userspace Apply to the user-space tracer\n"); -#endif fprintf(ofp, "\n"); fprintf(ofp, "Channel options:\n"); fprintf(ofp, " --discard Discard event when buffers are full%s\n", diff --git a/src/bin/lttng/commands/enable_consumer.c b/src/bin/lttng/commands/enable_consumer.c index 77e3ad911..692cdda02 100644 --- a/src/bin/lttng/commands/enable_consumer.c +++ b/src/bin/lttng/commands/enable_consumer.c @@ -78,7 +78,7 @@ static void usage(FILE *ofp) fprintf(ofp, "Options:\n"); fprintf(ofp, " -h, --help Show this help\n"); fprintf(ofp, " --list-options Simple listing of options\n"); - fprintf(ofp, " -s, --session=NAME Apply to session name\n"); + fprintf(ofp, " -s, --session NAME Apply to session name\n"); fprintf(ofp, " -k, --kernel Apply to the kernel tracer\n"); fprintf(ofp, " -u, --userspace Apply to the user-space tracer\n"); fprintf(ofp, "\n"); diff --git a/src/bin/lttng/commands/enable_events.c b/src/bin/lttng/commands/enable_events.c index 453545732..a2c8a68b2 100644 --- a/src/bin/lttng/commands/enable_events.c +++ b/src/bin/lttng/commands/enable_events.c @@ -71,13 +71,7 @@ static struct poptOption long_options[] = { {"all", 'a', POPT_ARG_VAL, &opt_enable_all, 1, 0, 0}, {"channel", 'c', POPT_ARG_STRING, &opt_channel_name, 0, 0, 0}, {"kernel", 'k', POPT_ARG_VAL, &opt_kernel, 1, 0, 0}, -#if 0 - /* Not implemented yet */ - {"userspace", 'u', POPT_ARG_STRING | POPT_ARGFLAG_OPTIONAL, &opt_cmd_name, OPT_USERSPACE, 0, 0}, - {"pid", 'p', POPT_ARG_INT, &opt_pid, 0, 0, 0}, -#else {"userspace", 'u', POPT_ARG_NONE, 0, OPT_USERSPACE, 0, 0}, -#endif {"tracepoint", 0, POPT_ARG_NONE, 0, OPT_TRACEPOINT, 0, 0}, {"probe", 0, POPT_ARG_STRING, &opt_probe, OPT_PROBE, 0, 0}, {"function", 0, POPT_ARG_STRING, &opt_function, OPT_FUNCTION, 0, 0}, @@ -101,22 +95,16 @@ static struct poptOption long_options[] = { */ static void usage(FILE *ofp) { - fprintf(ofp, "usage: lttng enable-event NAME[,NAME2,...] [options] [event_options]\n"); + fprintf(ofp, "usage: lttng enable-event NAME[,NAME2,...] [-k|-u] [OPTIONS] \n"); fprintf(ofp, "\n"); + fprintf(ofp, "Options:\n"); fprintf(ofp, " -h, --help Show this help\n"); fprintf(ofp, " --list-options Simple listing of options\n"); - fprintf(ofp, " -s, --session Apply to session name\n"); - fprintf(ofp, " -c, --channel Apply to this channel\n"); + fprintf(ofp, " -s, --session NAME Apply to session name\n"); + fprintf(ofp, " -c, --channel NAME Apply to this channel\n"); fprintf(ofp, " -a, --all Enable all tracepoints and syscalls\n"); fprintf(ofp, " -k, --kernel Apply for the kernel tracer\n"); -#if 0 - fprintf(ofp, " -u, --userspace [CMD] Apply to the user-space tracer\n"); - fprintf(ofp, " If no CMD, the domain used is UST global\n"); - fprintf(ofp, " or else the domain is UST EXEC_NAME\n"); - fprintf(ofp, " -p, --pid PID If -u, apply to specific PID (domain: UST PID)\n"); -#else fprintf(ofp, " -u, --userspace Apply to the user-space tracer\n"); -#endif fprintf(ofp, "\n"); fprintf(ofp, "Event options:\n"); fprintf(ofp, " --tracepoint Tracepoint event (default)\n"); diff --git a/src/bin/lttng/commands/start.c b/src/bin/lttng/commands/start.c index 44554fb37..b1840c3e8 100644 --- a/src/bin/lttng/commands/start.c +++ b/src/bin/lttng/commands/start.c @@ -47,11 +47,12 @@ static struct poptOption long_options[] = { */ static void usage(FILE *ofp) { - fprintf(ofp, "usage: lttng start [options] [NAME]\n"); + fprintf(ofp, "usage: lttng start [NAME] [OPTIONS]\n"); fprintf(ofp, "\n"); fprintf(ofp, "Where NAME is an optional session name. If not specified, lttng will\n"); fprintf(ofp, "get it from the configuration directory (.lttng).\n"); fprintf(ofp, "\n"); + fprintf(ofp, "Options:\n"); fprintf(ofp, " -h, --help Show this help\n"); fprintf(ofp, " --list-options Simple listing of options\n"); fprintf(ofp, "\n"); diff --git a/src/bin/lttng/commands/stop.c b/src/bin/lttng/commands/stop.c index 6ed67fdab..998a2a42a 100644 --- a/src/bin/lttng/commands/stop.c +++ b/src/bin/lttng/commands/stop.c @@ -47,11 +47,12 @@ static struct poptOption long_options[] = { */ static void usage(FILE *ofp) { - fprintf(ofp, "usage: lttng stop [options] [NAME]\n"); + fprintf(ofp, "usage: lttng stop [NAME] [OPTIONS]\n"); fprintf(ofp, "\n"); fprintf(ofp, "Where NAME is an optional session name. If not specified, lttng will\n"); fprintf(ofp, "get it from the configuration directory (.lttng).\n"); fprintf(ofp, "\n"); + fprintf(ofp, "Options:\n"); fprintf(ofp, " -h, --help Show this help\n"); fprintf(ofp, " --list-options Simple listing of options\n"); fprintf(ofp, "\n"); diff --git a/src/bin/lttng/commands/version.c b/src/bin/lttng/commands/version.c index a6bbd6aec..7f69de3dd 100644 --- a/src/bin/lttng/commands/version.c +++ b/src/bin/lttng/commands/version.c @@ -44,8 +44,9 @@ static struct poptOption long_options[] = { */ static void usage(FILE *ofp) { - fprintf(ofp, "usage: lttng version\n"); + fprintf(ofp, "usage: lttng version [OPTIONS]\n"); fprintf(ofp, "\n"); + fprintf(ofp, "Options:\n"); fprintf(ofp, " -h, --help Show this help\n"); fprintf(ofp, " --list-options Simple listing of options\n"); fprintf(ofp, "\n"); @@ -78,7 +79,8 @@ int cmd_version(int argc, const char **argv) } MSG("lttng version " VERSION " - " VERSION_NAME); - MSG("Web site: http://lttng.org/"); + MSG("\n" VERSION_DESCRIPTION "\n"); + MSG("Web site: http://lttng.org"); MSG("\nlttng is free software and under the GPL license and part LGPL"); end: diff --git a/src/bin/lttng/commands/view.c b/src/bin/lttng/commands/view.c index 9508743e6..430f8b62c 100644 --- a/src/bin/lttng/commands/view.c +++ b/src/bin/lttng/commands/view.c @@ -88,6 +88,7 @@ static void usage(FILE *ofp) fprintf(ofp, "Where SESSION_NAME is an optional session name. If not specified, lttng will\n"); fprintf(ofp, "get it from the configuration file (.lttngrc).\n"); fprintf(ofp, "\n"); + fprintf(ofp, "Options:\n"); fprintf(ofp, " -h, --help Show this help\n"); fprintf(ofp, " --list-options Simple listing of options\n"); fprintf(ofp, " -t, --trace-path PATH Trace directory path for the viewer\n"); diff --git a/src/bin/lttng/lttng.c b/src/bin/lttng/lttng.c index f41e9767d..e6ca9cfd9 100644 --- a/src/bin/lttng/lttng.c +++ b/src/bin/lttng/lttng.c @@ -82,7 +82,7 @@ static struct cmd_struct commands[] = { static void usage(FILE *ofp) { fprintf(ofp, "LTTng Trace Control " VERSION" - " VERSION_NAME"\n\n"); - fprintf(ofp, "usage: lttng [OPTIONS] \n"); + fprintf(ofp, "usage: lttng [OPTIONS] []\n"); fprintf(ofp, "\n"); fprintf(ofp, "Options:\n"); fprintf(ofp, " -h, --help Show this help\n"); -- 2.34.1