lttng-dev.lists.lttng.org archive mirror
 help / color / mirror / Atom feed
* [PATCH lttng-tools v2 1/4] Save registration time for app
@ 2019-08-13 20:25 Jonathan Rajotte
  0 siblings, 0 replies; 6+ messages in thread
From: Jonathan Rajotte @ 2019-08-13 20:25 UTC (permalink / raw)
  To: lttng-dev; +Cc: jgalar

Reuse the registration time for path generation.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-09-06 15:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20190813202519.31043-1-jonathan.rajotte-julien@efficios.com>
2019-08-13 20:25 ` [PATCH lttng-tools v2 2/4] Metadata: add env fields to ease lttng path hierarchy creation for viewer Jonathan Rajotte
2019-08-13 20:25 ` [PATCH lttng-tools v2 3/4] Support LTTNG_KERNEL_SESSION_SET_NAME of lttng-modules Jonathan Rajotte
2019-08-13 20:25 ` [PATCH lttng-tools v2 4/4] Support LTTNG_KERNEL_SESSION_SET_CREATION_DATETIME " Jonathan Rajotte
2019-08-13 20:28 ` [PATCH lttng-tools v2 1/4] Save registration time for app Mathieu Desnoyers
2019-09-06 15:37 ` Jérémie Galarneau
2019-08-13 20:25 Jonathan Rajotte

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).