[lttng-tools,v2,1/4] Save registration time for app
diff mbox series

Message ID 20190813202519.31043-1-jonathan.rajotte-julien@efficios.com
State Accepted, archived
Headers show
Series
  • [lttng-tools,v2,1/4] Save registration time for app
Related show

Commit Message

Jonathan Rajotte-Julien Aug. 13, 2019, 8:25 p.m. UTC
Reuse the registration time for path generation.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien at efficios.com>
---
 src/bin/lttng-sessiond/ust-app.c | 7 +++----
 src/bin/lttng-sessiond/ust-app.h | 5 +++++
 2 files changed, 8 insertions(+), 4 deletions(-)

Comments

Mathieu Desnoyers Aug. 13, 2019, 8:28 p.m. UTC | #1
Merged this patch as well in my dev branch, thanks,

Mathieu

----- On Aug 13, 2019, at 4:25 PM, Jonathan Rajotte jonathan.rajotte-julien at efficios.com wrote:

> Reuse the registration time for path generation.
> 
> Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien at efficios.com>
> ---
> src/bin/lttng-sessiond/ust-app.c | 7 +++----
> src/bin/lttng-sessiond/ust-app.h | 5 +++++
> 2 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c
> index 4bee50496..443232e79 100644
> --- a/src/bin/lttng-sessiond/ust-app.c
> +++ b/src/bin/lttng-sessiond/ust-app.c
> @@ -1831,15 +1831,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)
> {
> -	time_t rawtime;
> 	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);
> @@ -3376,6 +3373,8 @@ void ust_app_add(struct ust_app *app)
> 	assert(app);
> 	assert(app->notify_sock >= 0);
> 
> +	app->registration_time = time(NULL);
> +
> 	rcu_read_lock();
> 
> 	/*
> diff --git a/src/bin/lttng-sessiond/ust-app.h b/src/bin/lttng-sessiond/ust-app.h
> index b90ff4bce..d9279f0e4 100644
> --- a/src/bin/lttng-sessiond/ust-app.h
> +++ b/src/bin/lttng-sessiond/ust-app.h
> @@ -298,6 +298,11 @@ struct ust_app {
> 	 * 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
> --
> 2.17.1
> 
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Jérémie Galarneau Sept. 6, 2019, 3:37 p.m. UTC | #2
Merged in master and stable-2.11. Thanks!

J?r?mie

On Tue, 13 Aug 2019 at 16:25, Jonathan Rajotte
<jonathan.rajotte-julien at efficios.com> wrote:
>
> Reuse the registration time for path generation.
>
> Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien at efficios.com>
> ---
>  src/bin/lttng-sessiond/ust-app.c | 7 +++----
>  src/bin/lttng-sessiond/ust-app.h | 5 +++++
>  2 files changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c
> index 4bee50496..443232e79 100644
> --- a/src/bin/lttng-sessiond/ust-app.c
> +++ b/src/bin/lttng-sessiond/ust-app.c
> @@ -1831,15 +1831,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)
>  {
> -       time_t rawtime;
>         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);
> @@ -3376,6 +3373,8 @@ void ust_app_add(struct ust_app *app)
>         assert(app);
>         assert(app->notify_sock >= 0);
>
> +       app->registration_time = time(NULL);
> +
>         rcu_read_lock();
>
>         /*
> diff --git a/src/bin/lttng-sessiond/ust-app.h b/src/bin/lttng-sessiond/ust-app.h
> index b90ff4bce..d9279f0e4 100644
> --- a/src/bin/lttng-sessiond/ust-app.h
> +++ b/src/bin/lttng-sessiond/ust-app.h
> @@ -298,6 +298,11 @@ struct ust_app {
>          * 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
> --
> 2.17.1
>

Patch
diff mbox series

diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c
index 4bee50496..443232e79 100644
--- a/src/bin/lttng-sessiond/ust-app.c
+++ b/src/bin/lttng-sessiond/ust-app.c
@@ -1831,15 +1831,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)
 {
-	time_t rawtime;
 	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);
@@ -3376,6 +3373,8 @@  void ust_app_add(struct ust_app *app)
 	assert(app);
 	assert(app->notify_sock >= 0);
 
+	app->registration_time = time(NULL);
+
 	rcu_read_lock();
 
 	/*
diff --git a/src/bin/lttng-sessiond/ust-app.h b/src/bin/lttng-sessiond/ust-app.h
index b90ff4bce..d9279f0e4 100644
--- a/src/bin/lttng-sessiond/ust-app.h
+++ b/src/bin/lttng-sessiond/ust-app.h
@@ -298,6 +298,11 @@  struct ust_app {
 	 * 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