separate -m mode and -c
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Wed, 14 Sep 2005 23:59:38 +0000 (23:59 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Wed, 14 Sep 2005 23:59:38 +0000 (23:59 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@1192 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/lttctl/lttctl.c

index 0e6cefd718230b9320a11375889779993122a9b7..fe4be9b1f77c4424f7880f56ed93a5c8e276b453 100644 (file)
 #define BUF_SIZE 4194304
 
 enum trace_ctl_op {
+  CTL_OP_CREATE_START,
        CTL_OP_CREATE,
        CTL_OP_DESTROY,
+  CTL_OP_STOP_DESTROY,
        CTL_OP_START,
        CTL_OP_STOP,
        CTL_OP_DAEMON,
@@ -62,10 +64,12 @@ void show_arguments(void)
        printf("Please use the following arguments :\n");
        printf("\n");
        printf("-n name       Name of the trace.\n");
+       printf("-b            Create trace channels and start tracing (no daemon).\n");
        printf("-c            Create trace channels.\n");
        printf("-m mode       Normal or flight recorder mode.\n");
        printf("              Mode values : normal (default) or flight.\n");
        printf("-r            Destroy trace channels.\n");
+       printf("-R            Stop tracing and destroy trace channels.\n");
        printf("-s            Start tracing.\n");
        //printf("              Note : will automatically create a normal trace if "
        //                                                                                      "none exists.\n");
@@ -116,6 +120,8 @@ int parse_arguments(int argc, char **argv)
                                                }
 
                                                break;
+          case 'b':
+            op = CTL_OP_CREATE_START;
                                        case 'c':
                                                op = CTL_OP_CREATE;
             break;
@@ -141,6 +147,9 @@ int parse_arguments(int argc, char **argv)
                                        case 'r':
                                                op = CTL_OP_DESTROY;
                                                break;
+                                       case 'R':
+                                               op = CTL_OP_STOP_DESTROY;
+                                               break;
                                        case 's':
                                                op = CTL_OP_START;
                                                break;
@@ -420,6 +429,12 @@ int main(int argc, char ** argv)
        if(handle == NULL) return -1;
        
        switch(op) {
+    case CTL_OP_CREATE_START:
+                       ret = lttctl_create_trace(handle, trace_name, mode, subbuf_size,
+                                                                                                                               n_subbufs);
+      if(!ret)
+        ret = lttctl_start(handle, trace_name);
+      break;
        case CTL_OP_CREATE:
                        ret = lttctl_create_trace(handle, trace_name, mode, subbuf_size,
                                                                                                                                n_subbufs);
@@ -427,6 +442,11 @@ int main(int argc, char ** argv)
                case CTL_OP_DESTROY:
                        ret = lttctl_destroy_trace(handle, trace_name);
                        break;
+               case CTL_OP_STOP_DESTROY:
+                       ret = lttctl_stop(handle, trace_name);
+      if(!ret)
+                       ret = lttctl_destroy_trace(handle, trace_name);
+                       break;
                case CTL_OP_START:
                        ret = lttctl_start(handle, trace_name);
                        break;
This page took 0.025963 seconds and 4 git commands to generate.