disable ustctl --version until it is saner
[ust.git] / ustctl / ustctl.c
index 789dfe0feeb7c8d44da14ebc97ae23cef75969c3..501a20eaba3845e8e36ad4991e73c0d5991845a7 100644 (file)
@@ -27,6 +27,7 @@
 #include "usterr.h"
 
 enum command {
+       CREATE_TRACE,
        START_TRACE,
        STOP_TRACE,
        START,
@@ -35,6 +36,9 @@ enum command {
        ENABLE_MARKER,
        DISABLE_MARKER,
        GET_ONLINE_PIDS,
+       SET_SUBBUF_SIZE,
+       SET_SUBBUF_NUM,
+       ALLOC_TRACE,
        UNKNOWN
 };
 
@@ -52,9 +56,12 @@ void usage(void)
        fprintf(stderr, "\nControl the tracing of a process that supports LTTng Userspace Tracing.\n\
 \n\
 Commands:\n\
+    --create-trace\t\t\tCreate trace\n\
     --start-trace\t\t\tStart tracing\n\
     --stop-trace\t\t\tStop tracing\n\
     --destroy-trace\t\t\tDestroy the trace\n\
+    --set-subbuf-size \"CHANNEL/bytes\"\tSet the size of subbuffers per channel\n\
+    --set-subbuf-num \"CHANNEL/n\"\tSet the number of subbuffers per channel\n\
     --enable-marker \"CHANNEL/MARKER\"\tEnable a marker\n\
     --disable-marker \"CHANNEL/MARKER\"\tDisable a marker\n\
     --list-markers\t\t\tList the markers of the process, their\n\t\t\t\t\t  state and format string\n\
@@ -72,6 +79,8 @@ int parse_opts_long(int argc, char **argv, struct ust_opts *opts)
        while (1) {
                int option_index = 0;
                static struct option long_options[] = {
+                       {"create-trace", 0, 0, 1012},
+                       {"alloc-trace", 0, 0, 1015},
                        {"start-trace", 0, 0, 1000},
                        {"stop-trace", 0, 0, 1001},
                        {"destroy-trace", 0, 0, 1002},
@@ -82,8 +91,10 @@ int parse_opts_long(int argc, char **argv, struct ust_opts *opts)
                        {"disable-marker", 1, 0, 1008},
                        {"start", 0, 0, 1009},
                        {"help", 0, 0, 'h'},
-                       {"version", 0, 0, 1010},
+                       /*{"version", 0, 0, 1010},*/
                        {"online-pids", 0, 0, 1011},
+                       {"set-subbuf-size", 1, 0, 1013},
+                       {"set-subbuf-num", 1, 0, 1014},
                        {0, 0, 0, 0}
                };
 
@@ -128,9 +139,25 @@ int parse_opts_long(int argc, char **argv, struct ust_opts *opts)
                case 'h':
                        usage();
                        exit(0);
+/*
                case 1010:
                        printf("Version 0.1\n");
-
+                       break;
+*/
+               case 1012:
+                       opts->cmd = CREATE_TRACE;
+                       break;
+               case 1013:
+                       opts->cmd = SET_SUBBUF_SIZE;
+                       opts->regex = strdup(optarg);
+                       break;
+               case 1014:
+                       opts->cmd = SET_SUBBUF_NUM;
+                       opts->regex = strdup(optarg);
+                       break;
+               case 1015:
+                       opts->cmd = ALLOC_TRACE;
+                       break;
                default:
                        /* unknown option or other error; error is
                        printed by getopt, just return */
@@ -212,6 +239,14 @@ int main(int argc, char *argv[])
 
        while(*pidit != -1) {
                switch (opts.cmd) {
+                       case CREATE_TRACE:
+                               result = ustcmd_create_trace(*pidit);
+                               if (result) {
+                                       ERR("error while trying to create trace with PID %u\n", (unsigned int) *pidit);
+                                       break;
+                               }
+                               break;
+
                        case START_TRACE:
                                result = ustcmd_start_trace(*pidit);
                                if (result) {
@@ -279,6 +314,22 @@ int main(int argc, char *argv[])
                                        ustcmd_set_marker_state(opts.regex, 0, *pidit);
                                break;
 
+                       case SET_SUBBUF_SIZE:
+                               ustcmd_set_subbuf_size(opts.regex, *pidit);
+                               break;
+
+                       case SET_SUBBUF_NUM:
+                               ustcmd_set_subbuf_num(opts.regex, *pidit);
+                               break;
+
+                       case ALLOC_TRACE:
+                               result = ustcmd_alloc_trace(*pidit);
+                               if (result) {
+                                       ERR("error while trying to alloc trace with PID %u\n", (unsigned int) *pidit);
+                                       break;
+                               }
+                               break;
+
                        default:
                                ERR("unknown command\n");
                        break;
This page took 0.031405 seconds and 4 git commands to generate.