Fix ust app session started state on start trace
authorDavid Goulet <dgoulet@efficios.com>
Wed, 15 Feb 2012 16:29:16 +0000 (11:29 -0500)
committerDavid Goulet <dgoulet@efficios.com>
Wed, 15 Feb 2012 16:29:16 +0000 (11:29 -0500)
The started flag must be set as soon as possible in the start trace
function since if the start fails, it is still consider started for the
code logic.

Added one test to validate the restart tracing in UST.

Signed-off-by: David Goulet <dgoulet@efficios.com>
src/bin/lttng-sessiond/ust-app.c
tests/lttng/ust_global_event_basic.c

index 335c20ff18556f6df3705be8be6440ff14b1f00e..030358241f663548265493bd2459c00977be0013 100644 (file)
@@ -1935,6 +1935,9 @@ int ust_app_start_trace(struct ltt_ust_session *usess, struct ust_app *app)
                goto skip_setup;
        }
 
+       /* Indicate that the session has been started once */
+       ua_sess->started = 1;
+
        ret = create_ust_app_metadata(ua_sess, usess->pathname, app);
        if (ret < 0) {
                goto error_rcu_unlock;
@@ -1991,7 +1994,6 @@ int ust_app_start_trace(struct ltt_ust_session *usess, struct ust_app *app)
        if (ret < 0) {
                goto error_rcu_unlock;
        }
-       ua_sess->started = 1;
 
 skip_setup:
        /* This start the UST tracing */
index c56c39bd279cb0c03e0e5e252fa9a0129ec69561..867e4391b811b208b425f37d78d15d52430e455b 100644 (file)
@@ -159,6 +159,22 @@ int main(int argc, char **argv)
        }
        PRINT_OK();
 
+       printf("Restart tracing: ");
+       if ((ret = lttng_start_tracing(session_name)) < 0) {
+               printf("error starting tracing: %s\n", lttng_strerror(ret));
+               goto start_fail;
+       }
+       PRINT_OK();
+
+       sleep(2);
+
+       printf("Stop tracing: ");
+       if ((ret = lttng_stop_tracing(session_name)) < 0) {
+               printf("error stopping tracing: %s\n", lttng_strerror(ret));
+               goto stop_fail;
+       }
+       PRINT_OK();
+
        printf("Destroy tracing session: ");
        if ((ret = lttng_destroy_session(session_name)) < 0) {
                printf("error destroying session: %s\n", lttng_strerror(ret));
This page took 0.027106 seconds and 4 git commands to generate.