Fix: only synchronize application configuration on tracing start
[lttng-tools.git] / src / bin / lttng-sessiond / trace-ust.c
index 45dbec74e174feac9a7aba9932666b87f18e5628..8d63e2525192ad3ef2f473c99f9245b955f86eb0 100644 (file)
@@ -827,13 +827,14 @@ int trace_ust_pid_tracker_lookup(struct ltt_ust_session *session, int pid)
 int trace_ust_track_pid(struct ltt_ust_session *session, int pid)
 {
        int retval = LTTNG_OK;
+       bool should_update_apps = false;
 
        if (pid == -1) {
                /* Track all pids: destroy tracker if exists. */
                if (session->pid_tracker.ht) {
                        fini_pid_tracker(&session->pid_tracker);
                        /* Ensure all apps have session. */
-                       ust_app_global_update_all(session);
+                       should_update_apps = true;
                }
        } else {
                int ret;
@@ -852,7 +853,7 @@ int trace_ust_track_pid(struct ltt_ust_session *session, int pid)
                                goto end;
                        }
                        /* Remove all apps from session except pid. */
-                       ust_app_global_update_all(session);
+                       should_update_apps = true;
                } else {
                        struct ust_app *app;
 
@@ -864,10 +865,13 @@ int trace_ust_track_pid(struct ltt_ust_session *session, int pid)
                        /* Add session to application */
                        app = ust_app_find_by_pid(pid);
                        if (app) {
-                               ust_app_global_update(session, app);
+                               should_update_apps = true;
                        }
                }
        }
+       if (should_update_apps && session->active) {
+               ust_app_global_update_all(session);
+       }
 end:
        return retval;
 }
This page took 0.023744 seconds and 4 git commands to generate.