- int ret;
-
- set_opt_session_info();
-
- if (opt_list_apps) {
- ret = process_opt_list_apps();
- if (ret < 0) {
- goto end;
- }
- goto error;
- }
-
- if (opt_list_session) {
- ret = process_opt_list_sessions();
- if (ret < 0) {
- goto end;
- }
- goto error;
- }
-
- /* Session creation or auto session set on */
- if (auto_session || opt_create_session) {
- DBG("Creating a new session");
- ret = process_opt_create_session();
- if (ret < 0) {
- goto end;
- }
- }
-
- ret = set_session_uuid();
- if (ret < 0) {
- ERR("Session %s not found", opt_session_name);
- goto error;
- }
-
- if (opt_destroy_session) {
- ret = lttng_destroy_session(¤t_uuid);
- if (ret < 0) {
- goto end;
- }
- MSG("Session %s destroyed.", opt_session_name);
- }
-
- if (opt_list_traces) {
- ret = process_opt_list_traces();
- if (ret < 0) {
- goto end;
- }
- }
-
- /*
- * Action on traces (kernel or/and userspace).
- */
-
- if (opt_trace_kernel) {
- if (auto_trace || opt_create_trace) {
- DBG("Creating a kernel trace");
- ret = process_kernel_create_trace();
- if (ret < 0) {
- goto end;
- }
- }
-
- if (opt_event_list != NULL) {
- ret = process_opt_kernel_event();
- if (ret < 0) {
- goto end;
- }
- } else {
- // Enable all events
- }
-
- if (auto_trace || opt_start_trace) {
- DBG("Starting kernel tracing");
- ret = process_kernel_start_trace();
- if (ret < 0) {
- goto end;
- }
- }
-
- if (opt_stop_trace) {
- DBG("Stopping kernel tracing");
- ret = lttng_kernel_stop_tracing();
- if (ret < 0) {
- goto end;
- }
- }
- }
-
- if (opt_trace_pid != 0) {
- if (auto_trace || opt_create_trace) {
- DBG("Create a userspace trace for pid %d", opt_trace_pid);
- ret = lttng_ust_create_trace(opt_trace_pid);
- if (ret < 0) {
- goto end;
- }
- MSG("Trace created successfully!");
- }
-
- if (auto_trace || opt_start_trace) {
- DBG("Start trace for pid %d", opt_trace_pid);
- ret = lttng_ust_start_trace(opt_trace_pid);
- if (ret < 0) {
- goto end;
- }
- MSG("Trace started successfully!");
- } else if (opt_stop_trace) {
- DBG("Stop trace for pid %d", opt_trace_pid);
- ret = lttng_ust_stop_trace(opt_trace_pid);
- if (ret < 0) {
- goto end;
- }
- MSG("Trace stopped successfully!");
- }
-
- }
-
- return 0;
-
-end:
- ERR("%s", lttng_get_readable_code(ret));
-error: /* fall through */
- return ret;
-}
-
-/*
- * process_kernel_start_trace
- *
- * Start a kernel trace.
- */
-static int process_kernel_start_trace(void)
-{
- int ret;
-
- ret = lttng_kernel_create_stream();
- if (ret < 0) {
- goto error;
- }
-
- ret = lttng_kernel_start_tracing();
- if (ret < 0) {
- goto error;
- }
-
- MSG("Kernel tracing started");
-
- return 0;
-
-error:
- return ret;
+ fprintf(ofp, "LTTng Trace Control " VERSION"\n\n");
+ fprintf(ofp, "usage: lttng [options] <command>\n");
+ fprintf(ofp, "\n");
+ fprintf(ofp, "Options:\n");
+ fprintf(ofp, " -h, --help Show this help\n");
+ fprintf(ofp, " -g, --group NAME Unix tracing group name. (default: tracing)\n");
+ fprintf(ofp, " -v, --verbose Verbose mode\n");
+ fprintf(ofp, " -q, --quiet Quiet mode\n");
+ fprintf(ofp, " -n, --no-sessiond Don't spawn a session daemon\n");
+ fprintf(ofp, " --sessiond-path Session daemon full path\n");
+ fprintf(ofp, " --list-options Simple listing of lttng options\n");
+ fprintf(ofp, " --list-commands Simple listing of lttng commands\n");
+ fprintf(ofp, "\n");
+ fprintf(ofp, "Commands:\n");
+ fprintf(ofp, " add-context Add context to event or/and channel\n");
+ fprintf(ofp, " calibrate Quantify LTTng overhead\n");
+ fprintf(ofp, " create Create tracing session\n");
+ fprintf(ofp, " destroy Teardown tracing session\n");
+ fprintf(ofp, " enable-channel Enable tracing channel\n");
+ fprintf(ofp, " enable-event Enable tracing event\n");
+ fprintf(ofp, " disable-channel Disable tracing channel\n");
+ fprintf(ofp, " disable-event Disable tracing event\n");
+ fprintf(ofp, " list List possible tracing options\n");
+ fprintf(ofp, " set-session Set current session name\n");
+ fprintf(ofp, " start Start tracing\n");
+ fprintf(ofp, " stop Stop tracing\n");
+ fprintf(ofp, " version Show version information\n");
+ fprintf(ofp, "\n");
+ fprintf(ofp, "Please see the lttng(1) man page for full documentation.\n");
+ fprintf(ofp, "See http://lttng.org for updates, bug reports and news.\n");