Save registration time for app
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Tue, 13 Aug 2019 20:25:16 +0000 (16:25 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 30 Aug 2019 21:48:13 +0000 (17:48 -0400)
Reuse the registration time for path generation.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/ust-app.c
src/bin/lttng-sessiond/ust-app.h

index e01d43caf024ec61f3311ad323c4d3f7254afade..8c9277cae225ea80e9df7bf106d304a529e71769 100644 (file)
@@ -1832,15 +1832,12 @@ static void shadow_copy_channel(struct ust_app_channel *ua_chan,
 static void shadow_copy_session(struct ust_app_session *ua_sess,
                struct ltt_ust_session *usess, struct ust_app *app)
 {
 static void shadow_copy_session(struct ust_app_session *ua_sess,
                struct ltt_ust_session *usess, struct ust_app *app)
 {
-       time_t rawtime;
        struct tm *timeinfo;
        char datetime[16];
        int ret;
        char tmp_shm_path[PATH_MAX];
 
        struct tm *timeinfo;
        char datetime[16];
        int ret;
        char tmp_shm_path[PATH_MAX];
 
-       /* Get date and time for unique app path */
-       time(&rawtime);
-       timeinfo = localtime(&rawtime);
+       timeinfo = localtime(&app->registration_time);
        strftime(datetime, sizeof(datetime), "%Y%m%d-%H%M%S", timeinfo);
 
        DBG2("Shadow copy of session handle %d", ua_sess->handle);
        strftime(datetime, sizeof(datetime), "%Y%m%d-%H%M%S", timeinfo);
 
        DBG2("Shadow copy of session handle %d", ua_sess->handle);
@@ -3377,6 +3374,8 @@ void ust_app_add(struct ust_app *app)
        assert(app);
        assert(app->notify_sock >= 0);
 
        assert(app);
        assert(app->notify_sock >= 0);
 
+       app->registration_time = time(NULL);
+
        rcu_read_lock();
 
        /*
        rcu_read_lock();
 
        /*
index 59db98e6ec6911e7233e3fbab746adf4586d4fa6..89d97309f7590b882587b6ddeaa6c9fc99478f46 100644 (file)
@@ -297,6 +297,11 @@ struct ust_app {
         * to a negative value indicating that the agent application is gone.
         */
        int agent_app_sock;
         * to a negative value indicating that the agent application is gone.
         */
        int agent_app_sock;
+       /*
+        * Time at which the app is registred.
+        * Used for path creation
+        */
+       time_t registration_time;
 };
 
 #ifdef HAVE_LIBLTTNG_UST_CTL
 };
 
 #ifdef HAVE_LIBLTTNG_UST_CTL
This page took 0.039206 seconds and 4 git commands to generate.