}
}
-/*
- * usage
- */
-static void usage(FILE *ofp)
-{
- fprintf(ofp, "usage: lttng add-context -t TYPE [-k|-u] [OPTIONS]\n");
- fprintf(ofp, "\n");
- fprintf(ofp, "If no channel is given (-c), the context is added to\n");
- fprintf(ofp, "all channels.\n");
- fprintf(ofp, "\n");
- fprintf(ofp, "Otherwise the context is added only to the channel (-c).\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");
- fprintf(ofp, " --list-options Simple listing of options\n");
- fprintf(ofp, " -s, --session NAME Apply to session name\n");
- fprintf(ofp, " -c, --channel NAME Apply to channel\n");
- fprintf(ofp, " -k, --kernel Apply to the kernel tracer\n");
- fprintf(ofp, " -u, --userspace Apply to the user-space tracer\n");
- fprintf(ofp, " -j, --jul Apply to Java application using JUL\n");
- fprintf(ofp, " -l, --log4j Apply for Java application using LOG4j\n");
- 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");
- fprintf(ofp, " TYPE can be one of the strings below:\n");
- print_ctx_type(ofp);
- fprintf(ofp, "\n");
- fprintf(ofp, "Note that the vpid, vppid and vtid context types represent the virtual process id,\n"
- "virtual parent process id and virtual thread id as seen from the current execution context\n"
- "as opposed to the pid, ppid and tid which are kernel internal data structures.\n\n");
- fprintf(ofp, "Example:\n");
- fprintf(ofp, "This command will add the context information 'prio' and two per-cpu\n"
- "perf counters (hardware branch misses and cache misses), to all channels\n"
- "in the trace data output:\n");
- fprintf(ofp, "# lttng add-context -k -t prio -t perf:cpu:branch-misses -t perf:cpu:cache-misses\n");
- fprintf(ofp, "\n");
-}
-
/*
* Find context numerical value from string.
*
char *session_name = NULL;
if (argc < 2) {
- usage(stderr);
ret = CMD_ERROR;
goto end;
}
list_cmd_options(stdout, long_options);
goto end;
default:
- usage(stderr);
ret = CMD_UNDEFINED;
goto end;
}
if (!opt_type) {
ERR("Missing mandatory -t TYPE");
- usage(stderr);
ret = CMD_ERROR;
goto end;
}
{0, 0, 0, 0, 0, 0, 0}
};
-/*
- * usage
- */
-static void usage(FILE *ofp)
-{
- 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");
- fprintf(ofp, " -u, --userspace Apply to the user-space tracer\n");
- fprintf(ofp, "\n");
- fprintf(ofp, "Calibrate options:\n");
- fprintf(ofp, " --function Dynamic function entry/return probe (default)\n");
- fprintf(ofp, "\n");
-}
-
/*
* Calibrate LTTng.
*
list_cmd_options(stdout, long_options);
goto end;
default:
- usage(stderr);
ret = CMD_UNDEFINED;
goto end;
}
extern int _lttng_create_session_ext(const char *name, const char *url,
const char *datetime);
-/*
- * usage
- */
-static void usage(FILE *ofp)
-{
- fprintf(ofp, "usage: lttng create [NAME] [OPTIONS] \n");
- fprintf(ofp, "\n");
- fprintf(ofp, "Without a given NAME, the default is 'auto-<yyyymmdd>-<hhmmss>'\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, " -o, --output PATH Specify output path for traces\n");
- fprintf(ofp, " --no-output Traces will not be outputted\n");
- fprintf(ofp, " --snapshot Set the session in snapshot mode.\n");
- fprintf(ofp, " Created in no-output mode and uses the URL,\n");
- fprintf(ofp, " if one, as the default snapshot output.\n");
- fprintf(ofp, " Every channel will be set in overwrite mode\n");
- fprintf(ofp, " and with mmap output (splice not supported).\n");
- fprintf(ofp, " --live [USEC] Set the session in live-reading mode.\n");
- fprintf(ofp, " The delay parameter in micro-seconds is the\n");
- fprintf(ofp, " maximum time the user can wait for the data\n");
- fprintf(ofp, " to be flushed. Can be set with a network\n");
- fprintf(ofp, " URL (-U or -C/-D) and must have a relayd listening.\n");
- fprintf(ofp, " By default, %u is used for the timer and the\n",
- DEFAULT_LTTNG_LIVE_TIMER);
- fprintf(ofp, " network URL is set to net://127.0.0.1.\n");
- fprintf(ofp, " --shm-path PATH Path where shared memory holding buffers\n");
- fprintf(ofp, " should be created. Useful when used with pramfs\n");
- fprintf(ofp, " to extract trace data after crash.\n");
- fprintf(ofp, "\n");
- fprintf(ofp, "Extended Options:\n");
- fprintf(ofp, "\n");
- fprintf(ofp, "Using these options, each API call can be controlled individually.\n");
- fprintf(ofp, "\n");
- fprintf(ofp, " -U, --set-url=URL Set URL destination of the trace data.\n");
- fprintf(ofp, " It is persistent for the session lifetime.\n");
- fprintf(ofp, " This will set both data and control URL.\n");
- fprintf(ofp, " -C, --ctrl-url=URL Set control path URL. (Must use -D also)\n");
- fprintf(ofp, " -D, --data-url=URL Set data path URL. (Must use -C also)\n");
- fprintf(ofp, "\n");
- fprintf(ofp, "Please refer to the man page (lttng(1)) for more information on network\n");
- fprintf(ofp, "streaming mechanisms and explanation of the control and data port\n");
- fprintf(ofp, "You must have a running remote lttng-relayd for network streaming\n");
- fprintf(ofp, "\n");
- fprintf(ofp, "URL format is has followed:\n");
- fprintf(ofp, "\n");
- fprintf(ofp, " proto://[HOST|IP][:PORT1[:PORT2]][/TRACE_PATH]\n");
- fprintf(ofp, "\n");
- fprintf(ofp, " Supported protocols are (proto):\n");
- fprintf(ofp, " > file://...\n");
- fprintf(ofp, " Local filesystem full path.\n");
- fprintf(ofp, "\n");
- fprintf(ofp, " > net[6]://...\n");
- fprintf(ofp, " This will use the default network transport layer which is\n");
- fprintf(ofp, " TCP for both control (PORT1) and data port (PORT2).\n");
- fprintf(ofp, " The default ports are respectively 5342 and 5343.\n");
- fprintf(ofp, "\n");
- fprintf(ofp, " > tcp[6]://...\n");
- fprintf(ofp, " Can only be used with -C and -D together\n");
- fprintf(ofp, "\n");
- fprintf(ofp, "NOTE: IPv6 address MUST be enclosed in brackets '[]' (rfc2732)\n");
- fprintf(ofp, "\n");
- fprintf(ofp, "Examples:\n");
- fprintf(ofp, " # lttng create -U net://192.168.1.42\n");
- fprintf(ofp, " Uses TCP and default ports for the given destination.\n");
- fprintf(ofp, " # lttng create -U net6://[fe80::f66d:4ff:fe53:d220]\n");
- fprintf(ofp, " Uses TCP, default ports and IPv6.\n");
- fprintf(ofp, " # lttng create s1 -U net://myhost.com:3229\n");
- fprintf(ofp, " Set the consumer to the remote HOST on port 3229 for control.\n");
- fprintf(ofp, "\n");
-}
-
/*
* Retrieve the created session and mi output it based on provided argument
* This is currently a summary of what was pretty printed and is subject to
break;
}
default:
- usage(stderr);
ret = CMD_UNDEFINED;
goto end;
}
{0, 0, 0, 0, 0, 0, 0}
};
-/*
- * usage
- */
-static void usage(FILE *ofp)
-{
- 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");
- fprintf(ofp, " -n, --no-wait Don't wait for data availability\n");
- fprintf(ofp, "\n");
-}
-
/*
* destroy_session
*
list_cmd_options(stdout, long_options);
break;
default:
- usage(stderr);
ret = CMD_UNDEFINED;
break;
}
{0, 0, 0, 0, 0, 0, 0}
};
-/*
- * usage
- */
-static void usage(FILE *ofp)
-{
- 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 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");
-}
-
static int mi_partial_channel_print(char *channel_name, unsigned int enabled,
int success)
{
list_cmd_options(stdout, long_options);
goto end;
default:
- usage(stderr);
ret = CMD_UNDEFINED;
goto end;
}
opt_channels = (char*) poptGetArg(pc);
if (opt_channels == NULL) {
ERR("Missing channel name(s).\n");
- usage(stderr);
ret = CMD_ERROR;
goto end;
}
{0, 0, 0, 0, 0, 0, 0}
};
-/*
- * usage
- */
-static void usage(FILE *ofp)
-{
- fprintf(ofp, "usage: lttng disable-event NAME[,NAME2,...] (-k | -u | -j | -l | -p) [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 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 to the kernel tracer\n");
- fprintf(ofp, " -u, --userspace Apply to the user-space tracer\n");
- fprintf(ofp, " -j, --jul Apply to Java application using JUL\n");
- fprintf(ofp, " -l, --log4j Apply to Java application using LOG4j\n");
- fprintf(ofp, " -p, --python Apply to Python application using logging\n");
- fprintf(ofp, "\n");
- fprintf(ofp, "Event type options (Only supported with kernel domain):\n");
- fprintf(ofp, " --all All event types (default)\n");
- fprintf(ofp, " --tracepoint Tracepoint event\n");
- fprintf(ofp, " --syscall System call event\n");
- fprintf(ofp, " --probe Probe event\n");
- fprintf(ofp, " --function Function event\n");
- fprintf(ofp, "\n");
-}
-
static
const char *print_channel_name(const char *name)
{
list_cmd_options(stdout, long_options);
goto end;
default:
- usage(stderr);
ret = CMD_UNDEFINED;
goto end;
}
if ((opt_userspace || opt_jul || opt_log4j || opt_python)
&& opt_event_type != LTTNG_EVENT_ALL) {
ERR("Disabling userspace and agent (-j | -l | -p) event(s) based on instrumentation type is not supported.\n");
- usage(stderr);
ret = CMD_ERROR;
goto end;
}
opt_event_list = (char*) poptGetArg(pc);
if (opt_event_list == NULL && opt_disable_all == 0) {
ERR("Missing event name(s).\n");
- usage(stderr);
ret = CMD_ERROR;
goto end;
}
{0, 0, 0, 0, 0, 0, 0}
};
-/*
- * usage
- */
-static void usage(FILE *ofp)
-{
- 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 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");
- fprintf(ofp, "Channel options:\n");
- fprintf(ofp, " --discard Discard event when buffers are full%s\n",
- DEFAULT_CHANNEL_OVERWRITE ? "" : " (default)");
- fprintf(ofp, " --overwrite Flight recorder mode%s\n",
- DEFAULT_CHANNEL_OVERWRITE ? " (default)" : "");
- fprintf(ofp, " --subbuf-size SIZE Subbuffer size in bytes {+k,+M,+G}\n");
- fprintf(ofp, " (default UST uid: %zu, UST pid: %zu, kernel: %zu, metadata: %zu)\n",
- default_get_ust_uid_channel_subbuf_size(),
- default_get_ust_pid_channel_subbuf_size(),
- default_get_kernel_channel_subbuf_size(),
- default_get_metadata_subbuf_size());
- fprintf(ofp, " Rounded up to the next power of 2.\n");
- fprintf(ofp, " --num-subbuf NUM Number of subbufers\n");
- fprintf(ofp, " (default UST uid: %u, UST pid: %u, kernel: %u, metadata: %u)\n",
- DEFAULT_UST_UID_CHANNEL_SUBBUF_NUM, DEFAULT_UST_PID_CHANNEL_SUBBUF_NUM,
- DEFAULT_KERNEL_CHANNEL_SUBBUF_NUM, DEFAULT_METADATA_SUBBUF_NUM);
- fprintf(ofp, " Rounded up to the next power of 2.\n");
- fprintf(ofp, " --switch-timer USEC Switch timer interval in usec\n");
- fprintf(ofp, " (default UST uid: %u, UST pid: %u, kernel: %u, metadata: %u)\n",
- DEFAULT_UST_UID_CHANNEL_SWITCH_TIMER, DEFAULT_UST_PID_CHANNEL_SWITCH_TIMER,
- DEFAULT_KERNEL_CHANNEL_SWITCH_TIMER, DEFAULT_METADATA_SWITCH_TIMER);
- fprintf(ofp, " --read-timer USEC Read timer interval in usec.\n");
- fprintf(ofp, " (default UST uid: %u, UST pid: %u, kernel: %u, metadata: %u)\n",
- DEFAULT_UST_UID_CHANNEL_READ_TIMER, DEFAULT_UST_UID_CHANNEL_READ_TIMER,
- DEFAULT_KERNEL_CHANNEL_READ_TIMER, DEFAULT_METADATA_READ_TIMER);
- fprintf(ofp, " --output TYPE Channel output type (Values: %s, %s)\n",
- output_mmap, output_splice);
- fprintf(ofp, " (default UST uid: %s, UST pid: %s, kernel: %s, metadata: %s)\n",
- DEFAULT_UST_UID_CHANNEL_OUTPUT == LTTNG_EVENT_MMAP ? output_mmap : output_splice,
- DEFAULT_UST_PID_CHANNEL_OUTPUT == LTTNG_EVENT_MMAP ? output_mmap : output_splice,
- DEFAULT_KERNEL_CHANNEL_OUTPUT == LTTNG_EVENT_MMAP ? output_mmap : output_splice,
- DEFAULT_METADATA_OUTPUT == LTTNG_EVENT_MMAP ? output_mmap : output_splice);
- fprintf(ofp, " --buffers-uid Use per UID buffer (-u only)\n");
- fprintf(ofp, " --buffers-pid Use per PID buffer (-u only)\n");
- fprintf(ofp, " --buffers-global Use shared buffer for the whole system (-k only)\n");
- fprintf(ofp, " -C, --tracefile-size SIZE\n");
- fprintf(ofp, " Maximum size of each tracefile within a stream (in bytes). 0 means unlimited.\n");
- fprintf(ofp, " (default: %u)\n", DEFAULT_CHANNEL_TRACEFILE_SIZE);
- fprintf(ofp, " Note: traces generated with this option may inaccurately report\n");
- fprintf(ofp, " discarded events as per CTF 1.8.\n");
- fprintf(ofp, " -W, --tracefile-count COUNT\n");
- fprintf(ofp, " Used in conjunction with -C option, this will limit the number\n");
- fprintf(ofp, " of files created to the specified count. 0 means unlimited.\n");
- fprintf(ofp, " (default: %u)\n", DEFAULT_CHANNEL_TRACEFILE_COUNT);
- fprintf(ofp, "\n");
-}
-
/*
* Set default attributes depending on those already defined from the command
* line.
} else {
ERR("Unknown output type %s. Possible values are: %s, %s\n",
opt_output, output_mmap, output_splice);
- usage(stderr);
ret = CMD_ERROR;
goto error;
}
list_cmd_options(stdout, long_options);
goto end;
default:
- usage(stderr);
ret = CMD_UNDEFINED;
goto end;
}
opt_channels = (char*) poptGetArg(pc);
if (opt_channels == NULL) {
ERR("Missing channel name.\n");
- usage(stderr);
ret = CMD_ERROR;
success = 0;
goto mi_closing;
{0, 0, 0, 0, 0, 0, 0}
};
-/*
- * usage
- */
-static void usage(FILE *ofp)
-{
- fprintf(ofp, "usage: lttng enable-event NAME[,NAME2,...] (-k | -u | -j | -l | -p) [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 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 to the kernel tracer\n");
- fprintf(ofp, " -u, --userspace Apply to the user-space tracer\n");
- fprintf(ofp, " -j, --jul Apply to Java application using JUL\n");
- fprintf(ofp, " -l, --log4j Apply for Java application using LOG4j\n");
- fprintf(ofp, " -p, --python Apply for Python application\n");
- fprintf(ofp, "\n");
- fprintf(ofp, "Event options:\n");
- fprintf(ofp, " --tracepoint Tracepoint event (default)\n");
- fprintf(ofp, " - userspace tracer supports wildcards at end of string.\n");
- fprintf(ofp, " Don't forget to quote to deal with bash expansion.\n");
- fprintf(ofp, " e.g.:\n");
- fprintf(ofp, " \"*\"\n");
- fprintf(ofp, " \"app_component:na*\"\n");
- fprintf(ofp, " --probe (addr | symbol | symbol+offset)\n");
- fprintf(ofp, " Dynamic probe.\n");
- fprintf(ofp, " Addr and offset can be octal (0NNN...),\n");
- fprintf(ofp, " decimal (NNN...) or hexadecimal (0xNNN...)\n");
- fprintf(ofp, " --function (addr | symbol | symbol+offset)\n");
- fprintf(ofp, " Dynamic function entry/return probe.\n");
- fprintf(ofp, " Addr and offset can be octal (0NNN...),\n");
- fprintf(ofp, " decimal (NNN...) or hexadecimal (0xNNN...)\n");
- fprintf(ofp, " --syscall System call event\n");
- fprintf(ofp, "\n");
- fprintf(ofp, " --loglevel name\n");
- fprintf(ofp, " Tracepoint loglevel range from 0 to loglevel.\n");
- fprintf(ofp, " For JUL/LOG4j/Python domains, see the table below for the range values.\n");
- fprintf(ofp, " --loglevel-only name\n");
- fprintf(ofp, " Tracepoint loglevel (only this loglevel)\n");
- fprintf(ofp, "\n");
- fprintf(ofp, " The loglevel or loglevel-only options should be\n");
- fprintf(ofp, " combined with a tracepoint name or tracepoint\n");
- fprintf(ofp, " wildcard.\n");
- fprintf(ofp, " Available loglevels:\n");
- fprintf(ofp, " (higher value is more verbose)\n");
- fprintf(ofp, " TRACE_EMERG = 0\n");
- fprintf(ofp, " TRACE_ALERT = 1\n");
- fprintf(ofp, " TRACE_CRIT = 2\n");
- fprintf(ofp, " TRACE_ERR = 3\n");
- fprintf(ofp, " TRACE_WARNING = 4\n");
- fprintf(ofp, " TRACE_NOTICE = 5\n");
- fprintf(ofp, " TRACE_INFO = 6\n");
- fprintf(ofp, " TRACE_DEBUG_SYSTEM = 7\n");
- fprintf(ofp, " TRACE_DEBUG_PROGRAM = 8\n");
- fprintf(ofp, " TRACE_DEBUG_PROCESS = 9\n");
- fprintf(ofp, " TRACE_DEBUG_MODULE = 10\n");
- fprintf(ofp, " TRACE_DEBUG_UNIT = 11\n");
- fprintf(ofp, " TRACE_DEBUG_FUNCTION = 12\n");
- fprintf(ofp, " TRACE_DEBUG_LINE = 13\n");
- fprintf(ofp, " TRACE_DEBUG = 14\n");
- fprintf(ofp, " (shortcuts such as \"system\" are allowed)\n");
- fprintf(ofp, "\n");
- fprintf(ofp, " Available JUL domain loglevels:\n");
- fprintf(ofp, " JUL_OFF = INT32_MAX\n");
- fprintf(ofp, " JUL_SEVERE = %d\n", LTTNG_LOGLEVEL_JUL_SEVERE);
- fprintf(ofp, " JUL_WARNING = %d\n", LTTNG_LOGLEVEL_JUL_WARNING);
- fprintf(ofp, " JUL_INFO = %d\n", LTTNG_LOGLEVEL_JUL_INFO);
- fprintf(ofp, " JUL_CONFIG = %d\n", LTTNG_LOGLEVEL_JUL_CONFIG);
- fprintf(ofp, " JUL_FINE = %d\n", LTTNG_LOGLEVEL_JUL_FINE);
- fprintf(ofp, " JUL_FINER = %d\n", LTTNG_LOGLEVEL_JUL_FINER);
- fprintf(ofp, " JUL_FINEST = %d\n", LTTNG_LOGLEVEL_JUL_FINEST);
- fprintf(ofp, " JUL_ALL = INT32_MIN\n");
- fprintf(ofp, " (shortcuts such as \"severe\" are allowed)\n");
- fprintf(ofp, "\n");
- fprintf(ofp, " Available LOG4j domain loglevels:\n");
- fprintf(ofp, " LOG4J_OFF = INT32_MAX\n");
- fprintf(ofp, " LOG4J_FATAL = %d\n", LTTNG_LOGLEVEL_LOG4J_FATAL);
- fprintf(ofp, " LOG4J_ERROR = %d\n", LTTNG_LOGLEVEL_LOG4J_ERROR);
- fprintf(ofp, " LOG4J_WARN = %d\n", LTTNG_LOGLEVEL_LOG4J_WARN);
- fprintf(ofp, " LOG4J_INFO = %d\n", LTTNG_LOGLEVEL_LOG4J_INFO);
- fprintf(ofp, " LOG4J_DEBUG = %d\n", LTTNG_LOGLEVEL_LOG4J_DEBUG);
- fprintf(ofp, " LOG4J_TRACE = %d\n", LTTNG_LOGLEVEL_LOG4J_TRACE);
- fprintf(ofp, " LOG4J_ALL = INT32_MIN\n");
- fprintf(ofp, " (shortcuts such as \"severe\" are allowed)\n");
- fprintf(ofp, "\n");
- fprintf(ofp, " Available Python domain loglevels:\n");
- fprintf(ofp, " PYTHON_CRITICAL = %d\n", LTTNG_LOGLEVEL_PYTHON_CRITICAL);
- fprintf(ofp, " PYTHON_ERROR = %d\n", LTTNG_LOGLEVEL_PYTHON_ERROR);
- fprintf(ofp, " PYTHON_WARNING = %d\n", LTTNG_LOGLEVEL_PYTHON_WARNING);
- fprintf(ofp, " PYTHON_INFO = %d\n", LTTNG_LOGLEVEL_PYTHON_INFO);
- fprintf(ofp, " PYTHON_DEBUG = %d\n", LTTNG_LOGLEVEL_PYTHON_DEBUG);
- fprintf(ofp, " PYTHON_NOTSET = %d\n", LTTNG_LOGLEVEL_PYTHON_NOTSET);
- fprintf(ofp, " (shortcuts such as \"critical\" are allowed)\n");
- fprintf(ofp, "\n");
- fprintf(ofp, " -f, --filter \'expression\'\n");
- fprintf(ofp, " Filter expression on event fields and context.\n");
- fprintf(ofp, " Event recording depends on evaluation.\n");
- fprintf(ofp, " Only specify on first activation of\n");
- fprintf(ofp, " a given event within a session.\n");
- fprintf(ofp, " Filter only allowed when enabling\n");
- fprintf(ofp, " events within a session before tracing\n");
- fprintf(ofp, " is started. If the filter fails to link\n");
- fprintf(ofp, " with the event within the traced domain,\n");
- fprintf(ofp, " the event will be discarded. Currently,\n");
- fprintf(ofp, " filter is only implemented for the user-space\n");
- fprintf(ofp, " tracer.\n");
- fprintf(ofp, " Expression examples:.\n");
- fprintf(ofp, " \n");
- fprintf(ofp, " 'intfield > 500 && intfield < 503'\n");
- fprintf(ofp, " '(strfield == \"test\" || intfield != 10) && intfield > 33'\n");
- fprintf(ofp, " 'doublefield > 1.1 && intfield < 5.3'\n");
- fprintf(ofp, " \n");
- fprintf(ofp, " Wildcards are allowed at the end of strings:\n");
- fprintf(ofp, " 'seqfield1 == \"te*\"'\n");
- fprintf(ofp, " In string literals, the escape character is '\\'.\n");
- fprintf(ofp, " Use '\\*' for the '*' character, and '\\\\' for\n");
- fprintf(ofp, " the '\\' character. Wildcard match any sequence of,\n");
- fprintf(ofp, " characters including an empty sub-string (match 0 or\n");
- fprintf(ofp, " more characters).\n");
- fprintf(ofp, "\n");
- fprintf(ofp, " Context information can be used for filtering. The\n");
- fprintf(ofp, " examples below show usage of context filtering on\n");
- fprintf(ofp, " process name (with a wildcard), process ID range, and\n");
- fprintf(ofp, " unique thread ID for filtering. The process and\n");
- fprintf(ofp, " thread ID of running applications can be found under\n");
- fprintf(ofp, " columns \"PID\" and \"LWP\" of the \"ps -eLf\" command.\n");
- fprintf(ofp, "\n");
- fprintf(ofp, " '$ctx.procname == \"demo*\"'\n");
- fprintf(ofp, " '$ctx.vpid >= 4433 && $ctx.vpid < 4455'\n");
- fprintf(ofp, " '$ctx.vtid == 1234'\n");
- fprintf(ofp, " -x, --exclude LIST\n");
- fprintf(ofp, " Add exclusions to UST tracepoints:\n");
- fprintf(ofp, " Events that match any of the items\n");
- fprintf(ofp, " in the comma-separated LIST are not\n");
- fprintf(ofp, " enabled, even if they match a wildcard\n");
- fprintf(ofp, " definition of the event.\n");
- fprintf(ofp, "\n");
-}
-
/*
* Parse probe options.
*/
case OPT_EXCLUDE:
break;
default:
- usage(stderr);
ret = CMD_UNDEFINED;
goto end;
}
opt_event_list = (char*) poptGetArg(pc);
if (opt_event_list == NULL && opt_enable_all == 0) {
ERR("Missing event name(s).\n");
- usage(stderr);
ret = CMD_ERROR;
goto end;
}
{0, 0, 0, 0, 0, 0, 0}
};
-/*
- * usage
- */
-static void usage(FILE *ofp)
-{
- fprintf(ofp, "usage: lttng list [OPTIONS] [SESSION [SESSION OPTIONS]]\n");
- fprintf(ofp, "\n");
- fprintf(ofp, "With no arguments, list available tracing session(s)\n");
- fprintf(ofp, "\n");
- fprintf(ofp, "Without a session, -k lists available kernel events\n");
- fprintf(ofp, "Without a session, -u lists available userspace events\n");
- fprintf(ofp, "\n");
- fprintf(ofp, " -h, --help Show this help\n");
- fprintf(ofp, " --list-options Simple listing of options\n");
- fprintf(ofp, " -k, --kernel Select kernel domain\n");
- fprintf(ofp, " -u, --userspace Select user-space domain.\n");
- fprintf(ofp, " -j, --jul Apply for Java application using JUL\n");
- fprintf(ofp, " -l, --log4j Apply for Java application using LOG4J\n");
- fprintf(ofp, " -p, --python Apply for Python application using logging\n");
- fprintf(ofp, " -f, --fields List event fields.\n");
- fprintf(ofp, " --syscall List available system calls.\n");
- fprintf(ofp, "\n");
- fprintf(ofp, "Session Options:\n");
- fprintf(ofp, " -c, --channel NAME List details of a channel\n");
- fprintf(ofp, " -d, --domain List available domain(s)\n");
- fprintf(ofp, "\n");
-}
-
/*
* Get command line from /proc for a specific pid.
*
memset(&domain, 0, sizeof(domain));
if (argc < 1) {
- usage(stderr);
ret = CMD_ERROR;
goto end;
}
list_cmd_options(stdout, long_options);
goto end;
default:
- usage(stderr);
ret = CMD_UNDEFINED;
goto end;
}
{0, 0, 0, 0, 0, 0, 0}
};
-/*
- * usage
- */
-static void usage(FILE *ofp)
-{
- fprintf(ofp, "usage: lttng load [OPTIONS] [SESSION]\n");
- fprintf(ofp, "\n");
- fprintf(ofp, "Options:\n");
- fprintf(ofp, " -h, --help Show this help\n");
- fprintf(ofp, " -a, --all Load all sessions (default)\n");
- fprintf(ofp, " -i, --input-path PATH Input path of the session file(s).\n");
- fprintf(ofp, " If a directory, load all files in it\n");
- fprintf(ofp, " else try to load the given file.\n");
- fprintf(ofp, " -f, --force Override existing session(s).\n");
- fprintf(ofp, " This will destroy existing session(s)\n");
- fprintf(ofp, " before creating new one(s).\n");
-}
-
static int mi_partial_session(const char *session_name)
{
int ret;
opt_force = 1;
break;
default:
- usage(stderr);
ret = CMD_UNDEFINED;
goto end;
}
static struct mi_writer *writer;
-/*
- * usage
- */
-static void usage(FILE *ofp)
-{
- fprintf(ofp, "usage: lttng save [OPTIONS] [SESSION]\n");
- fprintf(ofp, "\n");
- fprintf(ofp, "Options:\n");
- fprintf(ofp, " -h, --help Show this help\n");
- fprintf(ofp, " -a, --all Save all sessions (default)\n");
- fprintf(ofp, " -o, --output-path Output path of the session configuration(s)\n");
- fprintf(ofp, " -f, --force Overwrite existing session configuration(s)\n");
-}
-
static int mi_partial_session(const char *session_name)
{
int ret;
list_cmd_options(stdout, save_opts);
goto end;
default:
- usage(stderr);
ret = CMD_UNDEFINED;
goto end;
}
{0, 0, 0, 0, 0, 0, 0}
};
-/*
- * usage
- */
-static void usage(FILE *ofp)
-{
- fprintf(ofp, "usage: lttng set-session NAME [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");
-}
-
/*
* Print the necessary mi for a session and name.
*/
list_cmd_options(stdout, long_options);
goto end;
default:
- usage(stderr);
ret = CMD_UNDEFINED;
goto end;
}
opt_session_name = (char *) poptGetArg(pc);
if (opt_session_name == NULL) {
ERR("Missing session name");
- usage(stderr);
ret = CMD_ERROR;
goto end;
}
{ NULL, NULL } /* Array closure */
};
-/*
- * usage
- */
-static void usage(FILE *ofp)
-{
- fprintf(ofp, "usage: lttng snapshot [OPTION] ACTION\n");
- fprintf(ofp, "\n");
- fprintf(ofp, "Actions:\n");
- fprintf(ofp, " add-output [-m <SIZE>] [-s <NAME>] [-n <NAME>] <URL> | -C <URL> -D <URL>\n");
- fprintf(ofp, " Setup and add an snapshot output for a session.\n");
- fprintf(ofp, "\n");
- fprintf(ofp, " del-output ID | NAME [-s <NAME>]\n");
- fprintf(ofp, " Delete an output for a session using the ID.\n");
- fprintf(ofp, "\n");
- fprintf(ofp, " list-output [-s <NAME>]\n");
- fprintf(ofp, " List the output of a session.\n");
- fprintf(ofp, "\n");
- fprintf(ofp, " record [-m <SIZE>] [-s <NAME>] [-n <NAME>] [<URL> | -C <URL> -D <URL>]\n");
- fprintf(ofp, " Snapshot a session's buffer(s) for all domains. If an URL is\n");
- fprintf(ofp, " specified, it is used instead of a previously added output.\n");
- fprintf(ofp, " Specifying only a name or/a size will override the current output value.\n");
- fprintf(ofp, " For instance, you can record a snapshot with a custom maximum size\n");
- fprintf(ofp, " or with a different name.\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 NAME Apply to session name\n");
- fprintf(ofp, " -n, --name NAME Name of the output or snapshot\n");
- fprintf(ofp, " -m, --max-size SIZE Maximum bytes size of the snapshot {+k,+M,+G}\n");
- fprintf(ofp, " -C, --ctrl-url URL Set control path URL. (Must use -D also)\n");
- fprintf(ofp, " -D, --data-url URL Set data path URL. (Must use -C also)\n");
- fprintf(ofp, "\n");
-}
-
/*
* Count and return the number of arguments in argv.
*/
int ret;
if (argc < 2 && (!opt_data_url || !opt_ctrl_url)) {
- usage(stderr);
ret = CMD_ERROR;
goto end;
}
long id;
if (argc < 2) {
- usage(stderr);
ret = CMD_ERROR;
goto end;
}
if (argv == NULL || (!opt_ctrl_url && opt_data_url) ||
(opt_ctrl_url && !opt_data_url)) {
- usage(stderr);
command_ret = CMD_ERROR;
goto end;
}
break;
}
default:
- usage(stderr);
ret = CMD_UNDEFINED;
goto end;
}
{0, 0, 0, 0, 0, 0, 0}
};
-/*
- * usage
- */
-static void usage(FILE *ofp)
-{
- 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");
-}
-
static int mi_print_session(char *session_name, int enabled)
{
int ret;
list_cmd_options(stdout, long_options);
goto end;
default:
- usage(stderr);
ret = CMD_UNDEFINED;
goto end;
}
{0, 0, 0, 0, 0, 0, 0}
};
-static void usage(FILE *ofp)
-{
- fprintf(ofp, "Usage: lttng status [options]\n");
- fprintf(ofp, "\n");
- fprintf(ofp, "Options:\n");
- fprintf(ofp, " -h, --help Show this help\n");
- fprintf(ofp, " --list-options List options\n");
-}
-
static int status(void)
{
const char *argv[2];
list_cmd_options(stdout, long_options);
goto end;
default:
- usage(stderr);
ret = CMD_UNDEFINED;
goto end;
}
if (poptPeekArg(pc) != NULL) {
ERR("This command does not accept positional arguments.\n");
- usage(stderr);
ret = CMD_UNDEFINED;
goto end;
}
{0, 0, 0, 0, 0, 0, 0}
};
-/*
- * usage
- */
-static void usage(FILE *ofp)
-{
- 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, --no-wait Don't wait for data availability\n");
- fprintf(ofp, "\n");
-}
/*
* Mi print of partial session
*/
list_cmd_options(stdout, long_options);
goto end;
default:
- usage(stderr);
ret = CMD_UNDEFINED;
goto end;
}
{ 0, 0, 0, 0, 0, 0, 0, },
};
-/*
- * usage
- */
-static void usage(FILE *ofp, const char *cmd_str)
-{
- fprintf(ofp, "usage: lttng %s [-k|-u] [OPTIONS]\n", cmd_str);
- fprintf(ofp, "\n");
- fprintf(ofp, "If no session is given (-s), the context is added to\n");
- fprintf(ofp, "the current sesssion. Exactly one domain (-k or -u)\n");
- fprintf(ofp, "must be specified.\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 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, " -p, --pid [PID] Process ID tracker. Leave PID empty when used with --all.\n");
- fprintf(ofp, " -a, --all All PIDs (use with --pid).\n");
- fprintf(ofp, "\n");
-}
-
static
int parse_pid_string(const char *_pid_string,
int all, int **_pid_list, int *nr_pids)
ret = parse_pid_string(pid_string, all, &pid_list, &nr_pids);
if (ret != CMD_SUCCESS) {
ERR("Error parsing PID string");
- usage(stderr, cmd_str);
retval = CMD_ERROR;
goto end;
}
struct mi_writer *writer = NULL;
if (argc < 1) {
- usage(stderr, cmd_str);
command_ret = CMD_ERROR;
goto end;
}
opt_pid = 1;
break;
default:
- usage(stderr, cmd_str);
command_ret = CMD_UNDEFINED;
goto end;
}
/* Currently only PID tracker is supported */
if (!opt_pid) {
ERR("Please specify at least one tracker with its expected arguments");
- usage(stderr, cmd_str);
command_ret = CMD_ERROR;
goto end;
}
{0, 0, 0, 0, 0, 0, 0}
};
-/*
- * usage
- */
-static void usage(FILE *ofp)
-{
- 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");
-}
-
/*
* create_version
*/
list_cmd_options(stdout, long_options);
goto end;
default:
- usage(stderr);
ret = CMD_UNDEFINED;
goto end;
}
/* Is the session we are trying to view is in live mode. */
static int session_live_mode;
-/*
- * usage
- */
-static void usage(FILE *ofp)
-{
- fprintf(ofp, "usage: lttng view [SESSION_NAME] [OPTIONS]\n");
- fprintf(ofp, "\n");
- fprintf(ofp, "By default, the babeltrace viewer will be used for text viewing\n");
- fprintf(ofp, "\n");
- 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");
- fprintf(ofp, " -e, --viewer CMD Specify viewer and/or options to use\n");
- fprintf(ofp, " This will completely override the default viewers so\n");
- fprintf(ofp, " please make sure to specify the full command. The trace\n");
- fprintf(ofp, " directory path of the session will be appended at the end\n");
- fprintf(ofp, " to the arguments\n");
- fprintf(ofp, "\n");
-}
-
static struct viewers *parse_options(void)
{
if (opt_viewer == NULL) {
list_cmd_options(stdout, long_options);
goto end;
default:
- usage(stderr);
ret = CMD_UNDEFINED;
goto end;
}