- int ret;
- uuid_t uuid;
-
- /* Connect to the session daemon */
- ret = lttng_connect_sessiond();
- if (ret < 0) {
- goto end;
- }
-
- if (opt_list_apps) {
- ret = process_opt_list_apps();
- if (ret < 0) {
- goto end;
- }
- }
-
- if (opt_list_session) {
- ret = process_opt_list_sessions();
- if (ret < 0) {
- goto end;
- }
- }
-
- if (opt_list_traces) {
- ret = process_opt_list_traces();
- if (ret < 0) {
- goto end;
- }
- }
-
- if (opt_create_session != NULL) {
- ret = process_opt_create_session();
- if (ret < 0) {
- goto end;
- }
- }
-
- if (opt_destroy_session != NULL) {
- uuid_parse(opt_destroy_session, uuid);
- ret = lttng_destroy_session(&uuid);
- if (ret < 0) {
- goto end;
- }
- }
-
- if (opt_session_uuid != NULL) {
- DBG("Set session uuid to %s", opt_session_uuid);
- lttng_set_current_session_uuid(opt_session_uuid);
- }
-
- if (opt_trace_kernel) {
- ERR("Not implemented yet");
- goto end;
- }
-
- if (opt_trace_pid != 0) {
- if (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!\nUse --start to start tracing.");
- }
-
- if (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));
- 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, " --no-sessiond Don't spawn a session daemon\n");
+ fprintf(ofp, " --sessiond-path Session daemon full path\n");
+ fprintf(ofp, "\n");
+ fprintf(ofp, "Commands:\n");
+ fprintf(ofp, " add-channel Add channel to tracer\n");
+ fprintf(ofp, " create Create tracing session\n");
+ fprintf(ofp, " destroy Teardown tracing session\n");
+ fprintf(ofp, " enable-event Enable tracing event\n");
+ fprintf(ofp, " disable-event Disable tracing event\n");
+ fprintf(ofp, " list List possible tracing options\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");