Add comment on manual registration of "ust" channel
[ust.git] / libust / tracectl.c
index 80d09ae093045fa88b6c1fcac8923ced5ef2402b..f9312b4340238e79e3e2dd6abf51d82bd962cca1 100644 (file)
@@ -370,6 +370,29 @@ void *listener_main(void *p)
                                return (void *)1;
                        }
                }
+               else if(!strcmp(recvbuf, "trace_create")) {
+                       DBG("trace create");
+
+                       result = ltt_trace_setup(trace_name);
+                       if(result < 0) {
+                               ERR("ltt_trace_setup failed");
+                               return (void *)1;
+                       }
+
+                       result = ltt_trace_set_type(trace_name, trace_type);
+                       if(result < 0) {
+                               ERR("ltt_trace_set_type failed");
+                               return (void *)1;
+                       }
+
+                       result = ltt_trace_alloc(trace_name);
+                       if(result < 0) {
+                               ERR("ltt_trace_alloc failed");
+                               return (void *)1;
+                       }
+
+                       inform_consumer_daemon(trace_name);
+               }
                else if(!strcmp(recvbuf, "trace_start")) {
                        DBG("trace start");
 
@@ -926,7 +949,24 @@ static void __attribute__((constructor)) init()
                /* Ensure markers are initialized */
                init_markers();
 
-               /* In case. */
+               /* FIXME: When starting early tracing (here), depending on the
+                * order of constructors, it is very well possible some marker
+                * sections are not yet registered. Because of this, some
+                * channels may not be registered. Yet, we are about to ask the
+                * daemon to collect the channels. Channels which are not yet
+                * registered will not be collected.
+                *
+                * Currently, in LTTng, there is no way to add a channel after
+                * trace start. The reason for this is that it induces complex
+                * concurrency issues on the trace structures, which can only
+                * be resolved using RCU. This has not been done yet. As a
+                * workaround, we are forcing the registration of the "ust"
+                * channel here. This is the only channel (apart from metadata)
+                * that can be reliably used in early tracing.
+                *
+                * Non-early tracing does not have this problem and can use
+                * arbitrary channel names.
+                */
                ltt_channels_register("ust");
 
                result = ltt_trace_setup(trace_name);
This page took 0.038464 seconds and 4 git commands to generate.