Skip to contentSkip to conversation

UST command to regenerate the statedump

PATCH Superseded Julien Desfossez 2 participants 11 messages Jun 30, 2016 6 messages not in the archive

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 2/6 UST command to regenerate the statedump

From: Mathieu Desnoyers <[email protected]>

---
 src/bin/lttng-sessiond/lttng-ust-abi.h | 1 +
 1 file changed, 1 insertion(+)
src/bin/lttng-sessiond/lttng-ust-abi.h +1 -0
index 7bec0c9..9ef7b9a 100644
@@ -275,6 +275,7 @@ struct lttng_ust_event_exclusion {
 	_UST_CMDW(0x51, struct lttng_ust_channel)
 #define LTTNG_UST_SESSION_START			_UST_CMD(0x52)
 #define LTTNG_UST_SESSION_STOP			_UST_CMD(0x53)
+#define LTTNG_UST_SESSION_STATEDUMP		_UST_CMD(0x54)
 
 /* Channel FD commands */
 #define LTTNG_UST_STREAM			_UST_CMD(0x60)
Signature · 6 lines
1.9.1

_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
#2 lore raw

PATCH 3/6 Kernel ioctl to regenerate the statedump

In reply to a message not in the archive

From: Mathieu Desnoyers <[email protected]>

---
 src/common/kernel-ctl/kernel-ioctl.h | 2 ++
 1 file changed, 2 insertions(+)
src/common/kernel-ctl/kernel-ioctl.h +2 -0
index 68056dc..805de02 100644
@@ -134,6 +134,8 @@
  */
 #define LTTNG_KERNEL_SESSION_LIST_TRACKER_PIDS	_IO(0xF6, 0x58)
 #define LTTNG_KERNEL_SESSION_METADATA_REGEN	_IO(0xF6, 0x59)
+/* 0x5A and 0x5B are reserved for a future ABI-breaking cleanup. */
+#define LTTNG_KERNEL_SESSION_STATEDUMP		_IO(0xF6, 0x5C)
 
 /* Channel FD ioctl */
 #define LTTNG_KERNEL_STREAM			_IO(0xF6, 0x62)
Signature · 6 lines
1.9.1

_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
#3 lore raw

PATCH 4/6 Allow regenerating the statedump of a running session

In reply to a message not in the archive

The "lttng regenerate statedump" command can be used to regenerate the statedump of a running session whenever needed. This is particularly useful in snapshot and trace-file rotation modes where the original statedump may be lost.

---
 include/lttng/lttng-error.h              |  1 +
 include/lttng/lttng.h                    |  9 +++++
 src/bin/lttng-sessiond/cmd.c             | 44 +++++++++++++++++++++++
 src/bin/lttng-sessiond/cmd.h             |  1 +
 src/bin/lttng-sessiond/main.c            |  6 ++++
 src/bin/lttng-sessiond/ust-app.c         | 62 ++++++++++++++++++++++++++++++++
 src/bin/lttng-sessiond/ust-app.h         |  6 ++++
 src/bin/lttng/commands/regenerate.c      | 19 ++++++++++
 src/common/error.c                       |  1 +
 src/common/kernel-ctl/kernel-ctl.c       |  5 +++
 src/common/kernel-ctl/kernel-ctl.h       |  1 +
 src/common/sessiond-comm/sessiond-comm.h |  1 +
 src/lib/lttng-ctl/lttng-ctl.c            | 31 ++++++++++++++++
 13 files changed, 187 insertions(+)
include/lttng/lttng-error.h +1 -0
index 72194ef..52ce333 100644
@@ -142,6 +142,7 @@ enum lttng_error_code {
 	LTTNG_ERR_LIVE_SESSION           = 119, /* Live session unsupported */
 	LTTNG_ERR_PER_PID_SESSION        = 120, /* Per-PID sessions unsupported */
 	LTTNG_ERR_KERN_CONTEXT_UNAVAILABLE = 121, /* Context unavailable on this kernel */
+	LTTNG_ERR_REGEN_STATEDUMP_FAIL   = 122, /* Failed to regenerate the statdump */
 
 	/* MUST be last element */
 	LTTNG_ERR_NR,                           /* Last element */
include/lttng/lttng.h +9 -0
index ed03bdb..7f9fa9d 100644
@@ -172,6 +172,15 @@ extern int lttng_metadata_regenerate(const char *session_name);
  */
 extern int lttng_regenerate_metadata(const char *session_name);
 
+/*
+ * Trigger the regeneration of the statedump for a session. The new statedump
+ * information is appended to the currently active trace, the session needs to
+ * be started.
+ *
+ * Return 0 on success, a negative LTTng error code on error.
+ */
+extern int lttng_regenerate_statedump(const char *session_name);
+
 #ifdef __cplusplus
 }
 #endif
src/bin/lttng-sessiond/cmd.c +44 -0

50 lines not on this page · raw message

src/bin/lttng-sessiond/cmd.h +1 -0
index 320d717..975a7f1 100644
@@ -111,5 +111,6 @@ int cmd_snapshot_record(struct ltt_session *session,
 int cmd_set_session_shm_path(struct ltt_session *session,
 		const char *shm_path);
 int cmd_regenerate_metadata(struct ltt_session *session);
+int cmd_regenerate_statedump(struct ltt_session *session);
 
 #endif /* CMD_H */
src/bin/lttng-sessiond/main.c +6 -0
index 3623e5d..8309c3f 100644
@@ -3004,6 +3004,7 @@ static int process_client_msg(struct command_ctx *cmd_ctx, int sock,
 	case LTTNG_SAVE_SESSION:
 	case LTTNG_SET_SESSION_SHM_PATH:
 	case LTTNG_REGENERATE_METADATA:
+	case LTTNG_REGENERATE_STATEDUMP:
 		need_domain = 0;
 		break;
 	default:
@@ -4119,6 +4120,11 @@ error_add_context:
 		ret = cmd_regenerate_metadata(cmd_ctx->session);
 		break;
 	}
+	case LTTNG_REGENERATE_STATEDUMP:
+	{
+		ret = cmd_regenerate_statedump(cmd_ctx->session);
+		break;
+	}
 	default:
 		ret = LTTNG_ERR_UND;
 		break;
src/bin/lttng-sessiond/ust-app.c +62 -0

65 lines not on this page · raw message

src/bin/lttng-sessiond/ust-app.h +6 -0
index d02f353..8369d14 100644
@@ -352,6 +352,7 @@ int ust_app_pid_get_channel_runtime_stats(struct ltt_ust_session *usess,
 		struct ltt_ust_channel *uchan,
 		struct consumer_output *consumer,
 		int overwrite, uint64_t *discarded, uint64_t *lost);
+int ust_app_regenerate_statedump_all(struct ltt_ust_session *usess);
 
 static inline
 int ust_app_supported(void)
@@ -583,6 +584,11 @@ int ust_app_pid_get_channel_runtime_stats(struct ltt_ust_session *usess,
 {
 	return 0;
 }
+static inline
+int ust_app_regenerate_metadata_all(struct ltt_ust_session *usess)
+{
+	return 0;
+}
 
 #endif /* HAVE_LIBLTTNG_UST_CTL */
 
src/bin/lttng/commands/regenerate.c +19 -0
index c64d8fe..f111d06 100644
@@ -32,6 +32,7 @@ static char *opt_session_name;
 static char *session_name = NULL;
 
 static int regenerate_metadata(int argc, const char **argv);
+static int regenerate_statedump(int argc, const char **argv);
 
 enum {
 	OPT_HELP = 1,
@@ -52,6 +53,7 @@ static struct poptOption long_options[] = {
 
 static struct cmd_struct actions[] = {
 	{ "metadata", regenerate_metadata },
+	{ "statedump", regenerate_statedump },
 	{ NULL, NULL }	/* Array closure */
 };
 
@@ -88,6 +90,23 @@ end:
 	return ret;
 }
 
+static int regenerate_statedump(int argc, const char **argv)
+{
+	int ret;
+
+	if (argc > 1) {
+		ret = -LTTNG_ERR_INVALID;
+		goto end;
+	}
+	ret = lttng_regenerate_statedump(session_name);
+	if (ret == 0) {
+		MSG("Statedump successfully regenerated for session %s", session_name);
+	}
+
+end:
+	return ret;
+}
+
 static int handle_command(const char **argv)
 {
 	struct cmd_struct *cmd;
src/common/error.c +1 -0
index bc42577..6730e14 100644
@@ -183,6 +183,7 @@ static const char *error_string_array[] = {
 	[ ERROR_INDEX(LTTNG_ERR_LIVE_SESSION) ] = "Live sessions are not supported",
 	[ ERROR_INDEX(LTTNG_ERR_PER_PID_SESSION) ] = "Per-PID tracing sessions are not supported",
 	[ ERROR_INDEX(LTTNG_ERR_KERN_CONTEXT_UNAVAILABLE) ] = "Context unavailable on this kernel",
+	[ ERROR_INDEX(LTTNG_ERR_REGEN_STATEDUMP_FAIL) ] = "Statedump regeneration failed",
 
 	/* Last element */
 	[ ERROR_INDEX(LTTNG_ERR_NR) ] = "Unknown error code"
src/common/kernel-ctl/kernel-ctl.c +5 -0
index e1de0e7..1c2ab61 100644
@@ -230,6 +230,11 @@ int kernctl_session_regenerate_metadata(int fd)
 	return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_SESSION_METADATA_REGEN);
 }
 
+int kernctl_session_regenerate_statedump(int fd)
+{
+	return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_SESSION_STATEDUMP);
+}
+
 int kernctl_create_stream(int fd)
 {
 	return compat_ioctl_no_arg(fd, LTTNG_KERNEL_OLD_STREAM,
src/common/kernel-ctl/kernel-ctl.h +1 -0
index f30e6f3..7c25a17 100644
@@ -66,6 +66,7 @@ int kernctl_untrack_pid(int fd, int pid);
 int kernctl_list_tracker_pids(int fd);
 
 int kernctl_session_regenerate_metadata(int fd);
+int kernctl_session_regenerate_statedump(int fd);
 
 /* Buffer operations */
 
src/common/sessiond-comm/sessiond-comm.h +1 -0
index 29740c1..628b1ea 100644
@@ -95,6 +95,7 @@ enum lttcomm_sessiond_command {
 	LTTNG_LIST_TRACKER_PIDS             = 34,
 	LTTNG_SET_SESSION_SHM_PATH          = 40,
 	LTTNG_REGENERATE_METADATA           = 41,
+	LTTNG_REGENERATE_STATEDUMP          = 42,
 };
 
 enum lttcomm_relayd_command {
src/lib/lttng-ctl/lttng-ctl.c +31 -0
index 8c78e1c..9e35d5f 100644
@@ -2419,6 +2419,37 @@ int lttng_metadata_regenerate(const char *session_name)
 }
 
 /*
+ * Regenerate the statedump of a session.
+ * Return 0 on success, a negative error code on error.
+ */
+int lttng_regenerate_statedump(const char *session_name)
+{
+	int ret;
+	struct lttcomm_session_msg lsm;
+
+	if (!session_name) {
+		ret = -LTTNG_ERR_INVALID;
+		goto end;
+	}
+
+	memset(&lsm, 0, sizeof(lsm));
+	lsm.cmd_type = LTTNG_REGENERATE_STATEDUMP;
+
+	lttng_ctl_copy_string(lsm.session.name, session_name,
+			sizeof(lsm.session.name));
+
+	ret = lttng_ctl_ask_sessiond(&lsm, NULL);
+	if (ret < 0) {
+		goto end;
+	}
+
+	ret = 0;
+end:
+	return ret;
+}
+
+
+/*
  * lib constructor.
  */
 static void __attribute__((constructor)) init(void)
Signature · 6 lines
1.9.1

_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
#4 lore raw

PATCH 5/6 Tests for the regenerate statedump command

In reply to a message not in the archive
---
 configure.ac                                       |  1 +
 tests/fast_regression                              |  1 +
 tests/regression/tools/Makefile.am                 |  2 +-
 tests/regression/tools/regen-statedump/Makefile.am | 16 ++++
 tests/regression/tools/regen-statedump/test_kernel | 80 +++++++++++++++++++
 tests/regression/tools/regen-statedump/test_ust    | 89 ++++++++++++++++++++++
 tests/root_regression                              |  1 +
 tests/utils/utils.sh                               | 54 +++++++++++++
 8 files changed, 243 insertions(+), 1 deletion(-)
 create mode 100644 tests/regression/tools/regen-statedump/Makefile.am
 create mode 100755 tests/regression/tools/regen-statedump/test_kernel
 create mode 100755 tests/regression/tools/regen-statedump/test_ust
configure.ac +1 -0
index 89a7858..6222e2b 100644
@@ -981,6 +981,7 @@ AC_CONFIG_FILES([
 	tests/regression/tools/wildcard/Makefile
 	tests/regression/tools/crash/Makefile
 	tests/regression/tools/regen-metadata/Makefile
+	tests/regression/tools/regen-statedump/Makefile
 	tests/regression/ust/Makefile
 	tests/regression/ust/nprocesses/Makefile
 	tests/regression/ust/high-throughput/Makefile
tests/fast_regression +1 -0
index 262c846..8edbeca 100644
@@ -17,6 +17,7 @@ regression/tools/mi/test_mi
 regression/tools/wildcard/test_event_wildcard
 regression/tools/crash/test_crash
 regression/tools/regen-metadata/test_ust
+regression/tools/regen-statedump/test_ust
 regression/ust/before-after/test_before_after
 regression/ust/buffers-pid/test_buffers_pid
 regression/ust/multi-session/test_multi_session
tests/regression/tools/Makefile.am +1 -1
index 91820ad..76374c7 100644
@@ -1,2 +1,2 @@
 SUBDIRS = streaming filtering health tracefile-limits snapshots live exclusion save-load mi \
-		wildcard crash regen-metadata
+		wildcard crash regen-metadata regen-statedump
tests/regression/tools/regen-statedump/Makefile.am new file +16 -0
new file mode 100644
index 0000000..d4a92eb
@@ -0,0 +1,16 @@
+noinst_SCRIPTS = test_ust test_kernel
+EXTRA_DIST = test_ust test_kernel
+
+all-local:
+	@if [ x"$(srcdir)" != x"$(builddir)" ]; then \
+		for script in $(EXTRA_DIST); do \
+			cp -f $(srcdir)/$$script $(builddir); \
+		done; \
+	fi
+
+clean-local:
+	@if [ x"$(srcdir)" != x"$(builddir)" ]; then \
+		for script in $(EXTRA_DIST); do \
+			rm -f $(builddir)/$$script; \
+		done; \
+	fi
tests/regression/tools/regen-statedump/test_kernel new file +80 -0

80 lines not on this page · raw message

tests/regression/tools/regen-statedump/test_ust new file +89 -0

89 lines not on this page · raw message

tests/root_regression +1 -0
index d0fad04..d3eaf23 100644
@@ -15,4 +15,5 @@ regression/tools/filtering/test_unsupported_op
 regression/tools/filtering/test_valid_filter
 regression/tools/wildcard/test_event_wildcard
 regression/tools/regen-metadata/test_kernel
+regression/tools/regen-statedump/test_kernel
 regression/ust/test_event_perf
tests/utils/utils.sh +54 -0

66 lines not on this page · raw message

Signature · 6 lines
1.9.1

_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
#5 lore raw

PATCH 6/6 Manpage for the regenerate statedump command

In reply to a message not in the archive
---
 doc/man/lttng-regenerate.1.txt | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
doc/man/lttng-regenerate.1.txt +13 -2
index dbbfa4d..80bae20 100644
@@ -14,12 +14,19 @@ Regenerate the metadata of a session
 [verse]
 *lttng* ['linkgenoptions:(GENERAL OPTIONS)'] *regenerate metadata* [option:--session='SESSION']
 
+Regenerate the statedump of a session
+
+[verse]
+*lttng* ['linkgenoptions:(GENERAL OPTIONS)'] *regenerate statedump* [option:--session='SESSION']
+
 DESCRIPTION
 -----------
 The `lttng regenerate` command manages a tracing session's data regeneration
 options.
 
-As of this version, only the `metadata` command's action is available.
+As of this version, the `metadata` and `statedump` command's action are
+available.
+
 Regenerating a tracing session's metadata can be used to
 resample the offset between the system's monotonic clock and
 the wall-clock time.
@@ -32,12 +39,16 @@ traced before its wall time is NTP-corrected. Regenerating the tracing
 session's metadata ensures that trace viewers can accurately determine
 the events time relative to Unix Epoch.
 
+Regenerating a tracing session's statedump can be used to collect up-to-date
+statedump informations during the trace session. This is particularly useful in
+snapshot or trace-file rotation modes where the statedump information may be
+lost.
 
 include::common-cmd-options-head.txt[]
 
 
 option:-s, option:--session='SESSION'::
-    Manage the metadata generation of the tracing session named 'SESSION'
+    Manage the data regeneration of the tracing session named 'SESSION'
     instead of the current tracing session.
 
 
Signature · 6 lines
1.9.1

_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
#6 lore raw

Re: [PATCH lttng-tools 1/6] Rename the "metadata regenerate" command to "regenerate metadata"

In reply to a message not in the archive
Quoted 190 lines · ----- On Jun 30, 2016, at 12:36 PM, Julien Desfossez [email protected]…

Prepare the deprecation of the "metadata regenerate" command since we need to regenerate the statedump as well, so it is more convenient to have one command to regenerate various session's attributes.

---

configure.ac                                      |   2 +-
doc/man/Makefile.am                               |   3 +-
doc/man/lttng-metadata.1.txt                      |  28 +--
doc/man/lttng-regenerate.1.txt                    |  63 +++++
include/lttng/lttng.h                             |   7 +-
src/bin/lttng-sessiond/cmd.c                      |  15 +-
src/bin/lttng-sessiond/cmd.h                      |   2 +-
src/bin/lttng-sessiond/main.c                     |   6 +-
src/bin/lttng/Makefile.am                         |   1 +
src/bin/lttng/command.h                           |   1 +
src/bin/lttng/commands/metadata.c                 |   2 +-
src/bin/lttng/commands/regenerate.c               | 266 ++++++++++++++++++++++
src/bin/lttng/lttng.c                             |   1 +
src/common/kernel-ctl/kernel-ctl.c                |   2 +-
src/common/kernel-ctl/kernel-ctl.h                |   2 +-
src/common/mi-lttng.c                             |   2 +
src/common/mi-lttng.h                             |   2 +
src/common/sessiond-comm/sessiond-comm.h          |   4 +-
src/lib/lttng-ctl/lttng-ctl.c                     |  12 +-
tests/destructive/metadata-regeneration           |   8 +-
tests/fast_regression                             |   2 +-
tests/regression/Makefile.am                      |   2 +-
tests/regression/tools/Makefile.am                |   2 +-
tests/regression/tools/metadata-regen/Makefile.am |  16 --
tests/regression/tools/metadata-regen/test_kernel | 109 ---------
tests/regression/tools/metadata-regen/test_ust    | 208 -----------------
tests/regression/tools/mi/test_mi                 |   4 +-
tests/regression/tools/regen-metadata/Makefile.am |  16 ++
tests/regression/tools/regen-metadata/test_kernel | 109 +++++++++
tests/regression/tools/regen-metadata/test_ust    | 208 +++++++++++++++++
tests/root_regression                             |   2 +-
tests/utils/utils.sh                              |  14 +-
32 files changed, 723 insertions(+), 398 deletions(-)

create mode 100644 doc/man/lttng-regenerate.1.txt
create mode 100644 src/bin/lttng/commands/regenerate.c delete mode 100644 tests/regression/tools/metadata-regen/Makefile.am delete mode 100755 tests/regression/tools/metadata-regen/test_kernel delete mode 100755 tests/regression/tools/metadata-regen/test_ust create mode 100644 tests/regression/tools/regen-metadata/Makefile.am create mode 100755 tests/regression/tools/regen-metadata/test_kernel create mode 100755 tests/regression/tools/regen-metadata/test_ust

configure.ac +1 -1
index fb2b013..89a7858 100644
@@ -980,7 +980,7 @@ AC_CONFIG_FILES([
 	tests/regression/tools/mi/Makefile
 	tests/regression/tools/wildcard/Makefile
 	tests/regression/tools/crash/Makefile
-	tests/regression/tools/metadata-regen/Makefile
+	tests/regression/tools/regen-metadata/Makefile
 	tests/regression/ust/Makefile
 	tests/regression/ust/nprocesses/Makefile
 	tests/regression/ust/high-throughput/Makefile
doc/man/Makefile.am +2 -1
index 1090f1a..f75db6e 100644
@@ -30,7 +30,8 @@ MAN1_NAMES = \
 	lttng-enable-event \
 	lttng-disable-event \
 	lttng-crash \
-	lttng-metadata
+	lttng-metadata \
+	lttng-regenerate

MAN3_NAMES =
MAN8_NAMES = lttng-sessiond lttng-relayd
MAN1_NO_ASCIIDOC_NAMES =

doc/man/lttng-metadata.1.txt +0 -0
index 0fa240e..3410183 100644
@@ -15,33 +15,9 @@ SYNOPSIS
 

DESCRIPTION
-----------

doc/man/lttng-metadata.1.txt +2 -26
-The `lttng metadata` command manages a tracing session's metadata
-generation options.
-
-As of this version, only the `regenerate` command's action is available.
-Regenerating a tracing session's metadata can be used to
-resample the offset between the system's monotonic clock and
-the wall-clock time.
-
-This command is meant to be used to resample the wall-clock time
-following a major
-link:https://en.wikipedia.org/wiki/Network_Time_Protocol[NTP]
-correction. As such, a system booting with an incorrect wall time can be
-traced before its wall time is NTP-corrected. Regenerating the tracing
-session's metadata ensures that trace viewers can accurately determine
-the events time relative to Unix Epoch.
-
-
-include::common-cmd-options-head.txt[]
-
-
-option:-s, option:--session='SESSION'::
-    Manage the metadata generation of the tracing session named 'SESSION'
-    instead of the current tracing session.
-
-
-include::common-cmd-help-options.txt[]
 
+Deprecated, replaced by the *regenerate metadata* command, see
+man:lttng-regenerate(1).

LIMITATIONS
-----------

doc/man/lttng-regenerate.1.txt new file +15 -0
new file mode 100644
index 0000000..dbbfa4d
@@ -0,0 +1,63 @@
+lttng-regenerate(1)
+=================
+
+
+NAME
+----
+lttng-regenerate - Manage an LTTng tracing session's data regeneration
+
+
+SYNOPSIS
+--------
+Regenerate the metadata of a session
+
+[verse]
+*lttng* ['linkgenoptions:(GENERAL OPTIONS)'] *regenerate metadata*

[option:--session='SESSION']

doc/man/lttng-regenerate.1.txt new file +48 -0
+
+DESCRIPTION
+-----------
+The `lttng regenerate` command manages a tracing session's data regeneration
+options.
+
+As of this version, only the `metadata` command's action is available.
+Regenerating a tracing session's metadata can be used to
+resample the offset between the system's monotonic clock and
+the wall-clock time.
+
+This command is meant to be used to resample the wall-clock time
+following a major
+link:https://en.wikipedia.org/wiki/Network_Time_Protocol[NTP]
+correction. As such, a system booting with an incorrect wall time can be
+traced before its wall time is NTP-corrected. Regenerating the tracing
+session's metadata ensures that trace viewers can accurately determine
+the events time relative to Unix Epoch.
+
+
+include::common-cmd-options-head.txt[]
+
+
+option:-s, option:--session='SESSION'::
+    Manage the metadata generation of the tracing session named 'SESSION'
+    instead of the current tracing session.
+
+
+include::common-cmd-help-options.txt[]
+
+
+LIMITATIONS
+-----------
+The `lttng regenerate metadata` command can only be used on kernel and
+user space tracing sessions (using per-user buffering), in non-live
+mode.
+
+See man:lttng-enable-channel(1) for more information about
+buffering schemes and man:lttng-create(1) for more information
+about the different tracing session modes.
+
+
+include::common-cmd-footer.txt[]
+
+
+SEE ALSO
+--------
+man:lttng(1)
include/lttng/lttng.h +0 -0
index 2088864..ed03bdb 100644

include/lttng/lttng.h extern int lttng_set_consumer_url(struct lttng_handle · line 166

Quoted 7 lines
include/lttng/lttng.h +3 -0
@@ -160,12 +160,17 @@ extern int lttng_set_consumer_url(struct lttng_handle
 *handle,
 extern int lttng_data_pending(const char *session_name);
 
 /*
+ * Deprecated, replaced by lttng_regenerate_metadata.
+ */
+extern int lttng_metadata_regenerate(const char *session_name);

Should we use the LTTNG_DEPRECATED() macro ?

Thanks,

Mathieu

Quoted 1,437 lines
include/lttng/lttng.h +3 -1
+
+/*
 * Trigger the regeneration of the metadata for a session.
 * The new metadata overwrite the previous one locally or remotely (through
 * the lttng-relayd). Only kernel, per-uid and non-live sessions are supported.
 * Return 0 on success, a negative LTTng error code on error.
 */
-extern int lttng_metadata_regenerate(const char *session_name);
+extern int lttng_regenerate_metadata(const char *session_name);
 
 #ifdef __cplusplus

}

src/bin/lttng-sessiond/cmd.c +0 -0
index c74da94..bd63389 100644
@@ -3397,7 +3397,7 @@ error:
 * Return 0 if the metadata can be generated, a LTTNG_ERR code otherwise.
 */

static

src/bin/lttng-sessiond/cmd.c +1 -1
-int check_metadata_regenerate_support(struct ltt_session *session)
+int check_regenerate_metadata_support(struct ltt_session *session)
{
	int ret;
src/bin/lttng-sessiond/cmd.c +0 -0
@@ -3436,7 +3436,7 @@ end:
 }
 

static

src/bin/lttng-sessiond/cmd.c +1 -1
-int ust_metadata_regenerate(struct ltt_ust_session *usess)
+int ust_regenerate_metadata(struct ltt_ust_session *usess)
{
	int ret = 0;
	struct buffer_reg_uid *uid_reg = NULL;
src/bin/lttng-sessiond/cmd.c +5 -6
@@ -3497,7 +3497,7 @@ end:
 }
 
 /*
- * Command LTTNG_METADATA_REGENERATE from the lttng-ctl library.
+ * Command LTTNG_REGENERATE_METADATA from the lttng-ctl library.
 *
 * Ask the consumer to truncate the existing metadata file(s) and
 * then regenerate the metadata. Live and per-pid sessions are not
@@ -3505,19 +3505,19 @@ end:
 *
 * Return 0 on success or else a LTTNG_ERR code.
 */
-int cmd_metadata_regenerate(struct ltt_session *session)
+int cmd_regenerate_metadata(struct ltt_session *session)
 {
 	int ret;
 
 	assert(session);
 
-	ret = check_metadata_regenerate_support(session);
+	ret = check_regenerate_metadata_support(session);
 	if (ret) {
 		goto end;
 	}
 
 	if (session->kernel_session) {
-		ret = kernctl_session_metadata_regenerate(
+		ret = kernctl_session_regenerate_metadata(
 				session->kernel_session->fd);
 		if (ret < 0) {
 			ERR("Failed to regenerate the kernel metadata");
@@ -3526,7 +3526,7 @@ int cmd_metadata_regenerate(struct ltt_session *session)
 	}
 
 	if (session->ust_session) {
-		ret = ust_metadata_regenerate(session->ust_session);
+		ret = ust_regenerate_metadata(session->ust_session);
 		if (ret < 0) {
 			ERR("Failed to regenerate the UST metadata");
 			goto end;
@@ -3539,7 +3539,6 @@ end:
 	return ret;
 }
 
-
 /*
 * Send relayd sockets from snapshot output to consumer. Ignore request if the
 * snapshot output is *not* set with a remote destination.
src/bin/lttng-sessiond/cmd.h +1 -1
index a220e3a..320d717 100644
@@ -110,6 +110,6 @@ int cmd_snapshot_record(struct ltt_session *session,
 
 int cmd_set_session_shm_path(struct ltt_session *session,
 		const char *shm_path);
-int cmd_metadata_regenerate(struct ltt_session *session);
+int cmd_regenerate_metadata(struct ltt_session *session);
 
 #endif /* CMD_H */
src/bin/lttng-sessiond/main.c +1 -1
index 497f4ee..3623e5d 100644
@@ -3003,7 +3003,7 @@ static int process_client_msg(struct command_ctx *cmd_ctx,
 int sock,
 	case LTTNG_SNAPSHOT_RECORD:
 	case LTTNG_SAVE_SESSION:
 	case LTTNG_SET_SESSION_SHM_PATH:
-	case LTTNG_METADATA_REGENERATE:
+	case LTTNG_REGENERATE_METADATA:
 		need_domain = 0;
 		break;

default:

src/bin/lttng-sessiond/main.c +2 -2
@@ -4114,9 +4114,9 @@ error_add_context:
 				cmd_ctx->lsm->u.set_shm_path.shm_path);
 		break;
 	}
-	case LTTNG_METADATA_REGENERATE:
+	case LTTNG_REGENERATE_METADATA:
 	{
-		ret = cmd_metadata_regenerate(cmd_ctx->session);
+		ret = cmd_regenerate_metadata(cmd_ctx->session);
 		break;
 	}
 	default:
src/bin/lttng/Makefile.am +1 -0
index b911f33..acd973b 100644
@@ -18,6 +18,7 @@ lttng_SOURCES = command.h conf.c conf.h commands/start.c \
 				commands/track-untrack.c \
 				commands/status.c \
 				commands/metadata.c \
+				commands/regenerate.c \
 				commands/help.c \
 				utils.c utils.h lttng.c
 
src/bin/lttng/command.h +1 -0
index 72cf4e0..3ac61e1 100644
@@ -76,6 +76,7 @@ DECL_COMMAND(load);
 DECL_COMMAND(track);
 DECL_COMMAND(untrack);
 DECL_COMMAND(metadata);
+DECL_COMMAND(regenerate);
 
 extern int cmd_help(int argc, const char **argv,
 		const struct cmd_struct commands[]);
src/bin/lttng/commands/metadata.c +1 -1
index f6a821a..08d6e58 100644
@@ -79,7 +79,7 @@ static int metadata_regenerate(int argc, const char **argv)
 		ret = -LTTNG_ERR_INVALID;
 		goto end;
 	}
-	ret = lttng_metadata_regenerate(session_name);
+	ret = lttng_regenerate_metadata(session_name);
 	if (ret == 0) {
 		MSG("Metadata successfully regenerated for session %s", session_name);
 	}
src/bin/lttng/commands/regenerate.c new file +266 -0
new file mode 100644
index 0000000..c64d8fe
@@ -0,0 +1,266 @@
+/*
+ * Copyright (C) 2015 - Julien Desfossez <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2 only,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#define _LGPL_SOURCE
+#include <assert.h>
+#include <ctype.h>
+#include <popt.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <common/mi-lttng.h>
+
+#include "../command.h"
+
+static char *opt_session_name;
+static char *session_name = NULL;
+
+static int regenerate_metadata(int argc, const char **argv);
+
+enum {
+	OPT_HELP = 1,
+	OPT_LIST_OPTIONS,
+	OPT_LIST_COMMANDS,
+};
+
+static struct mi_writer *writer;
+
+static struct poptOption long_options[] = {
+	/* { longName, shortName, argInfo, argPtr, value, descrip, argDesc, } */
+	{ "help",		'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0, },
+	{ "session",		's', POPT_ARG_STRING, &opt_session_name, 0, 0, 0},
+	{ "list-options",	0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, 0, 0, },
+	{ "list-commands",  	0, POPT_ARG_NONE, NULL, OPT_LIST_COMMANDS},
+	{ 0, 0, 0, 0, 0, 0, 0, },
+};
+
+static struct cmd_struct actions[] = {
+	{ "metadata", regenerate_metadata },
+	{ NULL, NULL }	/* Array closure */
+};
+
+/*
+ * Count and return the number of arguments in argv.
+ */
+static int count_arguments(const char **argv)
+{
+	int i = 0;
+
+	assert(argv);
+
+	while (argv[i] != NULL) {
+		i++;
+	}
+
+	return i;
+}
+
+static int regenerate_metadata(int argc, const char **argv)
+{
+	int ret;
+
+	if (argc > 1) {
+		ret = -LTTNG_ERR_INVALID;
+		goto end;
+	}
+	ret = lttng_regenerate_metadata(session_name);
+	if (ret == 0) {
+		MSG("Metadata successfully regenerated for session %s", session_name);
+	}
+
+end:
+	return ret;
+}
+
+static int handle_command(const char **argv)
+{
+	struct cmd_struct *cmd;
+	int ret = CMD_SUCCESS, i = 0, argc, command_ret = CMD_SUCCESS;
+
+	if (argv == NULL) {
+		ERR("argv is null");
+		command_ret = CMD_ERROR;
+		goto end;
+	}
+
+	argc = count_arguments(argv);
+
+	cmd = &actions[i];
+	while (cmd->func != NULL) {
+		/* Find command */
+		if (strcmp(argv[0], cmd->name) == 0) {
+			if (lttng_opt_mi) {
+				/* Action element */
+				ret = mi_lttng_writer_open_element(writer,
+						mi_lttng_element_command_regenerate_action);
+				if (ret) {
+					ret = CMD_ERROR;
+					goto end;
+				}
+
+				/* Name of the action */
+				ret = mi_lttng_writer_write_element_string(writer,
+						config_element_name, argv[0]);
+				if (ret) {
+					ret = CMD_ERROR;
+					goto end;
+				}
+			}
+			command_ret = cmd->func(argc, argv);
+			if (lttng_opt_mi) {
+				/* Close output and action element */
+				ret = mi_lttng_writer_close_element(writer);
+				if (ret) {
+					ret = CMD_ERROR;
+					goto end;
+				}
+			}
+			goto end;
+		}
+
+		cmd = &actions[i++];
+	}
+
+	ret = CMD_UNDEFINED;
+
+end:
+	/* Overwrite ret if an error occurred in cmd->func() */
+	ret = command_ret ? command_ret : ret;
+	return ret;
+}
+
+/*
+ * regenerate command handling.
+ */
+int cmd_regenerate(int argc, const char **argv)
+{
+	int opt, ret = CMD_SUCCESS, command_ret = CMD_SUCCESS, success = 1;
+	static poptContext pc;
+
+	if (argc < 1) {
+		SHOW_HELP();
+		ret = CMD_ERROR;
+		goto end;
+	}
+
+	pc = poptGetContext(NULL, argc, argv, long_options, 0);
+	poptReadDefaultConfig(pc, 0);
+
+	if (lttng_opt_mi) {
+		writer = mi_lttng_writer_create(fileno(stdout), lttng_opt_mi);
+		if (!writer) {
+			ret = -LTTNG_ERR_NOMEM;
+			goto end;
+		}
+		/* Open command element */
+		ret = mi_lttng_writer_command_open(writer,
+				mi_lttng_element_command_regenerate);
+		if (ret) {
+			ret = CMD_ERROR;
+			goto end;
+		}
+
+		/* Open output element */
+		ret = mi_lttng_writer_open_element(writer,
+				mi_lttng_element_command_output);
+		if (ret) {
+			ret = CMD_ERROR;
+			goto end;
+		}
+	}
+
+	while ((opt = poptGetNextOpt(pc)) != -1) {
+		switch (opt) {
+		case OPT_HELP:
+			SHOW_HELP();
+			goto end;
+		case OPT_LIST_OPTIONS:
+			list_cmd_options(stdout, long_options);
+			goto end;
+		case OPT_LIST_COMMANDS:
+			list_commands(actions, stdout);
+			goto end;
+		default:
+			SHOW_HELP();
+			ret = CMD_UNDEFINED;
+			goto end;
+		}
+	}
+
+	if (!opt_session_name) {
+		session_name = get_session_name();
+		if (session_name == NULL) {
+			ret = CMD_ERROR;
+			goto end;
+		}
+	} else {
+		session_name = opt_session_name;
+	}
+
+	command_ret = handle_command(poptGetArgs(pc));
+	if (command_ret) {
+		switch (-command_ret) {
+		default:
+			ERR("%s", lttng_strerror(command_ret));
+			success = 0;
+			break;
+		}
+	}
+
+	if (lttng_opt_mi) {
+		/* Close output element */
+		ret = mi_lttng_writer_close_element(writer);
+		if (ret) {
+			ret = CMD_ERROR;
+			goto end;
+		}
+
+		/* Success ? */
+		ret = mi_lttng_writer_write_element_bool(writer,
+				mi_lttng_element_command_success, success);
+		if (ret) {
+			ret = CMD_ERROR;
+			goto end;
+		}
+
+		/* Command element close */
+		ret = mi_lttng_writer_command_close(writer);
+		if (ret) {
+			ret = CMD_ERROR;
+			goto end;
+		}
+	}
+
+end:
+	/* Mi clean-up */
+	if (writer && mi_lttng_writer_destroy(writer)) {
+		/* Preserve original error code */
+		ret = ret ? ret : -LTTNG_ERR_MI_IO_FAIL;
+	}
+
+	if (!opt_session_name) {
+		free(session_name);
+	}
+
+	/* Overwrite ret if an error occurred during handle_command() */
+	ret = command_ret ? command_ret : ret;
+
+	poptFreeContext(pc);
+	return ret;
+}
src/bin/lttng/lttng.c +1 -0
index 987a9dd..34816be 100644
@@ -88,6 +88,7 @@ static struct cmd_struct commands[] =  {
 	{ "help", NULL},
 	{ "version", cmd_version},
 	{ "view", cmd_view},
+	{ "regenerate", cmd_regenerate},
 	{ NULL, NULL}	/* Array closure */
 };
 
src/common/kernel-ctl/kernel-ctl.c +1 -1
index 3d12df4..e1de0e7 100644
@@ -225,7 +225,7 @@ int kernctl_list_tracker_pids(int fd)
 	return LTTNG_IOCTL_NO_CHECK(fd, LTTNG_KERNEL_SESSION_LIST_TRACKER_PIDS);
 }
 
-int kernctl_session_metadata_regenerate(int fd)
+int kernctl_session_regenerate_metadata(int fd)
 {
 	return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_SESSION_METADATA_REGEN);
 }
src/common/kernel-ctl/kernel-ctl.h +1 -1
index 6736937..f30e6f3 100644
@@ -65,7 +65,7 @@ int kernctl_track_pid(int fd, int pid);
 int kernctl_untrack_pid(int fd, int pid);
 int kernctl_list_tracker_pids(int fd);
 
-int kernctl_session_metadata_regenerate(int fd);
+int kernctl_session_regenerate_metadata(int fd);
 
 /* Buffer operations */
 
src/common/mi-lttng.c +0 -0
index 109fb41..57678c1 100644
@@ -58,6 +58,8 @@ const char * const mi_lttng_element_command_list = "list";
 const char * const mi_lttng_element_command_load = "load";
 LTTNG_HIDDEN const char * const mi_lttng_element_command_metadata = "metadata";

LTTNG_HIDDEN const char * const mi_lttng_element_command_metadata_action = "metadata_action";
+LTTNG_HIDDEN const char * const mi_lttng_element_command_regenerate = "regenerate";
+LTTNG_HIDDEN const char * const mi_lttng_element_command_regenerate_action = "regenerate_action";
const char * const mi_lttng_element_command_name = "name";
const char * const mi_lttng_element_command_output = "output"; const char * const mi_lttng_element_command_save = "save";

src/common/mi-lttng.h +2 -0
index 585818d..cf5f468 100644
@@ -64,6 +64,8 @@ extern const char * const mi_lttng_element_command_list;
 extern const char * const mi_lttng_element_command_load;
 extern const char * const mi_lttng_element_command_metadata;
 extern const char * const mi_lttng_element_command_metadata_action;
+extern const char * const mi_lttng_element_command_regenerate;
+extern const char * const mi_lttng_element_command_regenerate_action;
 extern const char * const mi_lttng_element_command_name;
 extern const char * const mi_lttng_element_command_output;
 extern const char * const mi_lttng_element_command_save;
src/common/sessiond-comm/sessiond-comm.h +2 -2
index 0983865..29740c1 100644
@@ -94,7 +94,7 @@ enum lttcomm_sessiond_command {
 	LTTNG_UNTRACK_PID                   = 33,
 	LTTNG_LIST_TRACKER_PIDS             = 34,
 	LTTNG_SET_SESSION_SHM_PATH          = 40,
-	LTTNG_METADATA_REGENERATE           = 41,
+	LTTNG_REGENERATE_METADATA           = 41,
 };
 
 enum lttcomm_relayd_command {
@@ -526,7 +526,7 @@ struct lttcomm_consumer_msg {
 		} LTTNG_PACKED lost_packets;
 		struct {
 			uint64_t session_id;
-		} LTTNG_PACKED metadata_regenerate;
+		} LTTNG_PACKED regenerate_metadata;
 	} u;
 } LTTNG_PACKED;
 
src/lib/lttng-ctl/lttng-ctl.c +10 -2
index 0ae6b0b..8c78e1c 100644
@@ -2384,7 +2384,7 @@ int lttng_list_tracker_pids(struct lttng_handle *handle,
 * Regenerate the metadata for a session.
 * Return 0 on success, a negative error code on error.
 */
-int lttng_metadata_regenerate(const char *session_name)
+int lttng_regenerate_metadata(const char *session_name)
 {
 	int ret;
 	struct lttcomm_session_msg lsm;
@@ -2395,7 +2395,7 @@ int lttng_metadata_regenerate(const char *session_name)
 	}
 
 	memset(&lsm, 0, sizeof(lsm));
-	lsm.cmd_type = LTTNG_METADATA_REGENERATE;
+	lsm.cmd_type = LTTNG_REGENERATE_METADATA;
 
 	lttng_ctl_copy_string(lsm.session.name, session_name,
 			sizeof(lsm.session.name));
@@ -2411,6 +2411,14 @@ end:
 }
 
 /*
+ * Deprecated, replaced by lttng_regenerate_metadata.
+ */
+int lttng_metadata_regenerate(const char *session_name)
+{
+	return lttng_regenerate_metadata(session_name);
+}
+
+/*
 * lib constructor.
 */
 static void __attribute__((constructor)) init(void)
tests/destructive/metadata-regeneration +4 -4
index 32469b5..d4e632a 100755
@@ -89,7 +89,7 @@ function test_kernel_local ()
 	validate_trace_date $DATE1 $TRACE_PATH
 	start_lttng_tracing_ok $SESSION_NAME
 	date "+%Y-%m-%d %H:%M" -s "$DATE2 $HOUR" >/dev/null
-	metadata_regenerate_ok $SESSION_NAME
+	regenerate_metadata_ok $SESSION_NAME
 	stop_lttng_tracing_ok $SESSION_NAME
 	validate_trace_date $DATE2 $TRACE_PATH
 	if [ $? -eq 0 ]; then
@@ -111,7 +111,7 @@ function test_kernel_streaming ()
 	validate_trace_date $DATE1 $TRACE_PATH/$HOSTNAME/$SESSION_NAME*
 	start_lttng_tracing_ok $SESSION_NAME
 	date "+%Y-%m-%d %H:%M" -s "$DATE2 $HOUR" >/dev/null
-	metadata_regenerate_ok $SESSION_NAME
+	regenerate_metadata_ok $SESSION_NAME
 	stop_lttng_tracing_ok $SESSION_NAME
 	# Validate test
 	validate_trace_date $DATE2 $TRACE_PATH/$HOSTNAME/$SESSION_NAME*
@@ -147,7 +147,7 @@ function test_ust_local ()
 
 	start_lttng_tracing_ok $SESSION_NAME
 	date "+%Y-%m-%d %H:%M" -s "$DATE2 $HOUR" >/dev/null
-	metadata_regenerate_ok $SESSION_NAME
+	regenerate_metadata_ok $SESSION_NAME
 
 	stop_lttng_tracing_ok $SESSION_NAME
 	destroy_lttng_session_ok $SESSION_NAME
@@ -184,7 +184,7 @@ function test_ust_streaming ()
 	start_lttng_tracing_ok $SESSION_NAME
 	date "+%Y-%m-%d %H:%M" -s "$DATE2 $HOUR" >/dev/null
 
-	metadata_regenerate_ok $SESSION_NAME
+	regenerate_metadata_ok $SESSION_NAME
 
 	stop_lttng_tracing_ok $SESSION_NAME
 	destroy_lttng_session_ok $SESSION_NAME
tests/fast_regression +0 -0
index 0c4f079..262c846 100644
@@ -16,7 +16,7 @@ regression/tools/save-load/test_load

regression/tools/mi/test_mi
regression/tools/wildcard/test_event_wildcard
regression/tools/crash/test_crash

tests/fast_regression +1 -1
-regression/tools/metadata-regen/test_ust
+regression/tools/regen-metadata/test_ust

regression/ust/before-after/test_before_after
regression/ust/buffers-pid/test_buffers_pid
regression/ust/multi-session/test_multi_session

tests/regression/Makefile.am +1 -1
index 6a2d24c..2297ea1 100644
@@ -22,7 +22,7 @@ TESTS = tools/filtering/test_invalid_filter \
 	tools/mi/test_mi \
 	tools/wildcard/test_event_wildcard \
 	tools/crash/test_crash \
-	tools/metadata-regen/test_ust
+	tools/regen-metadata/test_ust
 

if HAVE_LIBLTTNG_UST_CTL
SUBDIRS += ust

tests/regression/tools/Makefile.am +0 -0
index 6c39c9f..91820ad 100644
@@ -1,2 +1,2 @@

SUBDIRS = streaming filtering health tracefile-limits snapshots live exclusion save-load mi \

tests/regression/tools/Makefile.am +1 -1
-		wildcard crash metadata-regen
+		wildcard crash regen-metadata
tests/regression/tools/metadata-regen/Makefile.am deleted +0 -16
deleted file mode 100644
index d4a92eb..0000000
@@ -1,16 +0,0 @@
-noinst_SCRIPTS = test_ust test_kernel
-EXTRA_DIST = test_ust test_kernel
-
-all-local:
-	@if [ x"$(srcdir)" != x"$(builddir)" ]; then \
-		for script in $(EXTRA_DIST); do \
-			cp -f $(srcdir)/$$script $(builddir); \
-		done; \
-	fi
-
-clean-local:
-	@if [ x"$(srcdir)" != x"$(builddir)" ]; then \
-		for script in $(EXTRA_DIST); do \
-			rm -f $(builddir)/$$script; \
-		done; \
-	fi
tests/regression/tools/metadata-regen/test_kernel deleted +0 -40
deleted file mode 100755
index fb9940a..0000000
@@ -1,109 +0,0 @@
-#!/bin/bash
-#
-# Copyright (C) - 2015 Julien Desfossez <[email protected]>
-#
-# This library is free software; you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation; version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this library; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
-TEST_DESC="Streaming - Kernel tracing"
-
-CURDIR=$(dirname $0)/
-TESTDIR=$CURDIR/../../..
-EVENT_NAME="lttng_test_filter_event"
-PID_RELAYD=0
-SESSION_NAME=""
-
-TRACE_PATH=$(mktemp -d)
-
-NUM_TESTS=18
-
-source $TESTDIR/utils/utils.sh
-
-# LTTng kernel modules check
-out=`ls /lib/modules/$(uname -r)/extra | grep lttng`
-if [ -z "$out" ]; then
-	BAIL_OUT "LTTng modules not detected."
-fi
-
-function lttng_create_session_uri
-{
-	# Create session with default path
-	$TESTDIR/../src/bin/lttng/$LTTNG_BIN create $SESSION_NAME -U net://localhost
Quoted 1 line

/dev/null 2>&1

tests/regression/tools/metadata-regen/test_kernel deleted +0 -52
-
-	ok $? "Create session $SESSION_NAME"
-}
-
-function test_kernel_streaming ()
-{
-	diag "Test kernel streaming with metadata regeneration"
-	lttng_create_session_uri
-	lttng_enable_kernel_event $SESSION_NAME $EVENT_NAME
-	start_lttng_tracing_ok $SESSION_NAME
-	echo -n "100" > /proc/lttng-test-filter-event
-	metadata_regenerate_ok $SESSION_NAME
-	stop_lttng_tracing_ok $SESSION_NAME
-	# Validate test
-	validate_trace $EVENT_NAME $TRACE_PATH/$HOSTNAME/$SESSION_NAME*
-	if [ $? -eq 0 ]; then
-		# Only delete if successful
-		rm -rf $TRACE_PATH
-	else
-		break
-	fi
-	destroy_lttng_session_ok $SESSION_NAME
-}
-
-function test_kernel_local ()
-{
-	diag "Test kernel local with metadata regeneration"
-	create_lttng_session_ok $SESSION_NAME $TRACE_PATH
-	lttng_enable_kernel_event $SESSION_NAME $EVENT_NAME
-	start_lttng_tracing_ok $SESSION_NAME
-	echo -n "100" > /proc/lttng-test-filter-event
-	metadata_regenerate_ok $SESSION_NAME
-	stop_lttng_tracing_ok $SESSION_NAME
-	validate_trace $EVENT_NAME $TRACE_PATH
-	if [ $? -eq 0 ]; then
-		# Only delete if successful
-		rm -rf $TRACE_PATH
-	fi
-	destroy_lttng_session_ok $SESSION_NAME
-}
-
-plan_tests $NUM_TESTS
-
-print_test_banner "$TEST_DESC"
-
-if [ "$(id -u)" == "0" ]; then
-	isroot=1
-else
-	isroot=0
-fi
-
-skip $isroot "Root access is needed. Skipping all kernel streaming tests."

$NUM_TESTS ||

tests/regression/tools/metadata-regen/test_kernel deleted +0 -17
-{
-	start_lttng_relayd "-o $TRACE_PATH"
-	start_lttng_sessiond
-	modprobe lttng-test
-
-	tests=( test_kernel_streaming test_kernel_local )
-
-	for fct_test in ${tests[@]};
-	do
-		SESSION_NAME=$(randstring 16 0)
-		${fct_test}
-	done
-
-	rmmod lttng-test
-	stop_lttng_sessiond
-	stop_lttng_relayd
-}
tests/regression/tools/metadata-regen/test_ust deleted +0 -43
deleted file mode 100755
index fe6ffd8..0000000
@@ -1,208 +0,0 @@
-#!/bin/bash
-#
-# Copyright (C) - 2015 Julien Desfossez <[email protected]>
-#
-# This library is free software; you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation; version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this library; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
-TEST_DESC="Streaming - User space tracing"
-
-CURDIR=$(dirname $0)/
-TESTDIR=$CURDIR/../../..
-NR_ITER=1
-NR_USEC_WAIT=0
-TESTAPP_PATH="$TESTDIR/utils/testapp"
-TESTAPP_NAME="gen-ust-events"
-TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
-SESSION_NAME="stream"
-EVENT_NAME="tp:tptest"
-PID_RELAYD=0
-
-TRACE_PATH=$(mktemp -d)
-
-NUM_TESTS=33
-
-source $TESTDIR/utils/utils.sh
-
-if [ ! -x "$TESTAPP_BIN" ]; then
-	BAIL_OUT "No UST events binary detected."
-fi
-
-function lttng_create_session_uri
-{
-	# Create session with default path
-	$TESTDIR/../src/bin/lttng/$LTTNG_BIN create $SESSION_NAME -U net://localhost
Quoted 1 line

/dev/null 2>&1

tests/regression/tools/metadata-regen/test_ust deleted +0 -7
-	ok $? "Create session with default path"
-}
-
-function lttng_create_session_uri_live
-{
-	# Create session with default path
-	$TESTDIR/../src/bin/lttng/$LTTNG_BIN create $SESSION_NAME --live -U

net://localhost >/dev/null 2>&1

tests/regression/tools/metadata-regen/test_ust deleted +0 -9
-	ok $? "Create live session"
-}
-
-function enable_channel_per_pid()
-{
-	sess_name=$1
-	channel_name=$2
-
-	$TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-channel --buffers-pid -u

$channel_name -s $sess_name >/dev/null 2>&1

tests/regression/tools/metadata-regen/test_ust deleted +0 -15
-	ok $? "Enable channel $channel_name per PID for session $sess_name"
-}
-
-# MUST set TESTDIR before calling those functions
-
-function test_ust_streaming ()
-{
-	local file_sync_after_first=$(mktemp -u)
-	local file_sync_before_last=$(mktemp -u)
-
-	diag "Test UST streaming with metadata regeneration"
-	lttng_create_session_uri
-	enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME
-
-	$TESTAPP_BIN $NR_ITER $NR_USEC_WAIT ${file_sync_after_first}

${file_sync_before_last} /dev/null 2>&1 &

tests/regression/tools/metadata-regen/test_ust deleted +0 -31
-
-	start_lttng_tracing_ok $SESSION_NAME
-
-	touch ${file_sync_before_last}
-
-	# Wait for the applications started in background
-	wait
-	metadata_regenerate_ok $SESSION_NAME
-
-	stop_lttng_tracing_ok $SESSION_NAME
-	destroy_lttng_session_ok $SESSION_NAME
-	# Validate test
-	validate_trace $EVENT_NAME $TRACE_PATH/$HOSTNAME/$SESSION_NAME*
-	if [ $? -eq 0 ]; then
-		# Only delete if successful
-		rm -rf $TRACE_PATH
-	fi
-	rm -f ${file_sync_after_first}
-	rm -f ${file_sync_before_last}
-}
-
-function test_ust_local ()
-{
-	local file_sync_after_first=$(mktemp -u)
-	local file_sync_before_last=$(mktemp -u)
-
-	diag "Test UST local with metadata regeneration"
-	create_lttng_session_ok $SESSION_NAME $TRACE_PATH
-	enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME
-
-	$TESTAPP_BIN $NR_ITER $NR_USEC_WAIT ${file_sync_after_first}

${file_sync_before_last} /dev/null 2>&1 &

tests/regression/tools/metadata-regen/test_ust deleted +0 -32
-
-	start_lttng_tracing_ok $SESSION_NAME
-
-	touch ${file_sync_before_last}
-
-	# Wait for the applications started in background
-	wait
-	metadata_regenerate_ok $SESSION_NAME
-
-	stop_lttng_tracing_ok $SESSION_NAME
-	destroy_lttng_session_ok $SESSION_NAME
-	# Validate test
-	validate_trace $EVENT_NAME $TRACE_PATH
-	if [ $? -eq 0 ]; then
-		# Only delete if successful
-		rm -rf $TRACE_PATH
-	fi
-	rm -f ${file_sync_after_first}
-	rm -f ${file_sync_before_last}
-}
-
-function test_ust_pid ()
-{
-	local file_sync_after_first=$(mktemp -u)
-	local file_sync_before_last=$(mktemp -u)
-
-	diag "Test UST per-pid with metadata regeneration (expect failure)"
-	create_lttng_session_ok $SESSION_NAME $TRACE_PATH
-	enable_channel_per_pid $SESSION_NAME "channel0"
-	enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME "channel0"
-
-	$TESTAPP_BIN $NR_ITER $NR_USEC_WAIT ${file_sync_after_first}

${file_sync_before_last} /dev/null 2>&1 &

tests/regression/tools/metadata-regen/test_ust deleted +0 -31
-
-	start_lttng_tracing_ok $SESSION_NAME
-
-	touch ${file_sync_before_last}
-
-	# Wait for the applications started in background
-	wait
-	metadata_regenerate_fail $SESSION_NAME
-
-	stop_lttng_tracing_ok $SESSION_NAME
-	destroy_lttng_session_ok $SESSION_NAME
-	# Validate test
-	validate_trace $EVENT_NAME $TRACE_PATH
-	if [ $? -eq 0 ]; then
-		# Only delete if successful
-		rm -rf $TRACE_PATH
-	fi
-	rm -f ${file_sync_after_first}
-	rm -f ${file_sync_before_last}
-}
-
-function test_ust_live ()
-{
-	local file_sync_after_first=$(mktemp -u)
-	local file_sync_before_last=$(mktemp -u)
-
-	diag "Test UST live with metadata regeneration (expect failure)"
-	lttng_create_session_uri_live $SESSION_NAME $TRACE_PATH
-	enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME
-
-	$TESTAPP_BIN $NR_ITER $NR_USEC_WAIT ${file_sync_after_first}

${file_sync_before_last} /dev/null 2>&1 &

tests/regression/tools/metadata-regen/test_ust deleted +0 -40
-
-	start_lttng_tracing_ok $SESSION_NAME
-
-	touch ${file_sync_before_last}
-
-	# Wait for the applications started in background
-	wait
-	metadata_regenerate_fail $SESSION_NAME
-
-	stop_lttng_tracing_ok $SESSION_NAME
-	destroy_lttng_session_ok $SESSION_NAME
-	# Validate test
-	validate_trace $EVENT_NAME $TRACE_PATH
-	if [ $? -eq 0 ]; then
-		# Only delete if successful
-		rm -rf $TRACE_PATH
-	fi
-	rm -f ${file_sync_after_first}
-	rm -f ${file_sync_before_last}
-}
-
-plan_tests $NUM_TESTS
-
-print_test_banner "$TEST_DESC"
-
-start_lttng_relayd "-o $TRACE_PATH"
-start_lttng_sessiond
-
-tests=( test_ust_streaming test_ust_local test_ust_pid test_ust_live )
-
-for fct_test in ${tests[@]};
-do
-	SESSION_NAME=$(randstring 16 0)
-	${fct_test}
-done
-
-stop_lttng_sessiond
-stop_lttng_relayd
-
-exit $out
tests/regression/tools/mi/test_mi +2 -2
index 0e8fa67..380385f 100755
@@ -631,9 +631,9 @@ function test_start_stop () {
 	ok $? "Mi test: enabled element : $result expected: true"
 
 	#Test metadata regenerate command
-	metadata_regenerate_ok $session_name
+	regenerate_metadata_ok $session_name
 	$XML_VALIDATE $OUTPUT_DEST
-	ok $? "Mi test: metadata regenerate"
+	ok $? "Mi test: regenerate metadata"
 
 	#Test stop command
 	stop_lttng_tracing_ok $session_name
tests/regression/tools/regen-metadata/Makefile.am new file +16 -0
new file mode 100644
index 0000000..d4a92eb
@@ -0,0 +1,16 @@
+noinst_SCRIPTS = test_ust test_kernel
+EXTRA_DIST = test_ust test_kernel
+
+all-local:
+	@if [ x"$(srcdir)" != x"$(builddir)" ]; then \
+		for script in $(EXTRA_DIST); do \
+			cp -f $(srcdir)/$$script $(builddir); \
+		done; \
+	fi
+
+clean-local:
+	@if [ x"$(srcdir)" != x"$(builddir)" ]; then \
+		for script in $(EXTRA_DIST); do \
+			rm -f $(builddir)/$$script; \
+		done; \
+	fi
tests/regression/tools/regen-metadata/test_kernel new file +40 -0
new file mode 100755
index 0000000..fd139ae
@@ -0,0 +1,109 @@
+#!/bin/bash
+#
+# Copyright (C) - 2015 Julien Desfossez <[email protected]>
+#
+# This library is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this library; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
+TEST_DESC="Streaming - Kernel tracing"
+
+CURDIR=$(dirname $0)/
+TESTDIR=$CURDIR/../../..
+EVENT_NAME="lttng_test_filter_event"
+PID_RELAYD=0
+SESSION_NAME=""
+
+TRACE_PATH=$(mktemp -d)
+
+NUM_TESTS=18
+
+source $TESTDIR/utils/utils.sh
+
+# LTTng kernel modules check
+out=`ls /lib/modules/$(uname -r)/extra | grep lttng`
+if [ -z "$out" ]; then
+	BAIL_OUT "LTTng modules not detected."
+fi
+
+function lttng_create_session_uri
+{
+	# Create session with default path
+	$TESTDIR/../src/bin/lttng/$LTTNG_BIN create $SESSION_NAME -U net://localhost
Quoted 1 line

/dev/null 2>&1

tests/regression/tools/regen-metadata/test_kernel new file +52 -0
+
+	ok $? "Create session $SESSION_NAME"
+}
+
+function test_kernel_streaming ()
+{
+	diag "Test kernel streaming with metadata regeneration"
+	lttng_create_session_uri
+	lttng_enable_kernel_event $SESSION_NAME $EVENT_NAME
+	start_lttng_tracing_ok $SESSION_NAME
+	echo -n "100" > /proc/lttng-test-filter-event
+	regenerate_metadata_ok $SESSION_NAME
+	stop_lttng_tracing_ok $SESSION_NAME
+	# Validate test
+	validate_trace $EVENT_NAME $TRACE_PATH/$HOSTNAME/$SESSION_NAME*
+	if [ $? -eq 0 ]; then
+		# Only delete if successful
+		rm -rf $TRACE_PATH
+	else
+		break
+	fi
+	destroy_lttng_session_ok $SESSION_NAME
+}
+
+function test_kernel_local ()
+{
+	diag "Test kernel local with metadata regeneration"
+	create_lttng_session_ok $SESSION_NAME $TRACE_PATH
+	lttng_enable_kernel_event $SESSION_NAME $EVENT_NAME
+	start_lttng_tracing_ok $SESSION_NAME
+	echo -n "100" > /proc/lttng-test-filter-event
+	regenerate_metadata_ok $SESSION_NAME
+	stop_lttng_tracing_ok $SESSION_NAME
+	validate_trace $EVENT_NAME $TRACE_PATH
+	if [ $? -eq 0 ]; then
+		# Only delete if successful
+		rm -rf $TRACE_PATH
+	fi
+	destroy_lttng_session_ok $SESSION_NAME
+}
+
+plan_tests $NUM_TESTS
+
+print_test_banner "$TEST_DESC"
+
+if [ "$(id -u)" == "0" ]; then
+	isroot=1
+else
+	isroot=0
+fi
+
+skip $isroot "Root access is needed. Skipping all kernel streaming tests."

$NUM_TESTS ||

tests/regression/tools/regen-metadata/test_kernel new file +17 -0
+{
+	start_lttng_relayd "-o $TRACE_PATH"
+	start_lttng_sessiond
+	modprobe lttng-test
+
+	tests=( test_kernel_streaming test_kernel_local )
+
+	for fct_test in ${tests[@]};
+	do
+		SESSION_NAME=$(randstring 16 0)
+		${fct_test}
+	done
+
+	rmmod lttng-test
+	stop_lttng_sessiond
+	stop_lttng_relayd
+}
tests/regression/tools/regen-metadata/test_ust new file +43 -0
new file mode 100755
index 0000000..b7f1af1
@@ -0,0 +1,208 @@
+#!/bin/bash
+#
+# Copyright (C) - 2015 Julien Desfossez <[email protected]>
+#
+# This library is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this library; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
+TEST_DESC="Streaming - User space tracing"
+
+CURDIR=$(dirname $0)/
+TESTDIR=$CURDIR/../../..
+NR_ITER=1
+NR_USEC_WAIT=0
+TESTAPP_PATH="$TESTDIR/utils/testapp"
+TESTAPP_NAME="gen-ust-events"
+TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
+SESSION_NAME="stream"
+EVENT_NAME="tp:tptest"
+PID_RELAYD=0
+
+TRACE_PATH=$(mktemp -d)
+
+NUM_TESTS=33
+
+source $TESTDIR/utils/utils.sh
+
+if [ ! -x "$TESTAPP_BIN" ]; then
+	BAIL_OUT "No UST events binary detected."
+fi
+
+function lttng_create_session_uri
+{
+	# Create session with default path
+	$TESTDIR/../src/bin/lttng/$LTTNG_BIN create $SESSION_NAME -U net://localhost
Quoted 1 line

/dev/null 2>&1

tests/regression/tools/regen-metadata/test_ust new file +7 -0
+	ok $? "Create session with default path"
+}
+
+function lttng_create_session_uri_live
+{
+	# Create session with default path
+	$TESTDIR/../src/bin/lttng/$LTTNG_BIN create $SESSION_NAME --live -U

net://localhost >/dev/null 2>&1

tests/regression/tools/regen-metadata/test_ust new file +9 -0
+	ok $? "Create live session"
+}
+
+function enable_channel_per_pid()
+{
+	sess_name=$1
+	channel_name=$2
+
+	$TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-channel --buffers-pid -u

$channel_name -s $sess_name >/dev/null 2>&1

tests/regression/tools/regen-metadata/test_ust new file +15 -0
+	ok $? "Enable channel $channel_name per PID for session $sess_name"
+}
+
+# MUST set TESTDIR before calling those functions
+
+function test_ust_streaming ()
+{
+	local file_sync_after_first=$(mktemp -u)
+	local file_sync_before_last=$(mktemp -u)
+
+	diag "Test UST streaming with metadata regeneration"
+	lttng_create_session_uri
+	enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME
+
+	$TESTAPP_BIN $NR_ITER $NR_USEC_WAIT ${file_sync_after_first}

${file_sync_before_last} /dev/null 2>&1 &

tests/regression/tools/regen-metadata/test_ust new file +31 -0
+
+	start_lttng_tracing_ok $SESSION_NAME
+
+	touch ${file_sync_before_last}
+
+	# Wait for the applications started in background
+	wait
+	regenerate_metadata_ok $SESSION_NAME
+
+	stop_lttng_tracing_ok $SESSION_NAME
+	destroy_lttng_session_ok $SESSION_NAME
+	# Validate test
+	validate_trace $EVENT_NAME $TRACE_PATH/$HOSTNAME/$SESSION_NAME*
+	if [ $? -eq 0 ]; then
+		# Only delete if successful
+		rm -rf $TRACE_PATH
+	fi
+	rm -f ${file_sync_after_first}
+	rm -f ${file_sync_before_last}
+}
+
+function test_ust_local ()
+{
+	local file_sync_after_first=$(mktemp -u)
+	local file_sync_before_last=$(mktemp -u)
+
+	diag "Test UST local with metadata regeneration"
+	create_lttng_session_ok $SESSION_NAME $TRACE_PATH
+	enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME
+
+	$TESTAPP_BIN $NR_ITER $NR_USEC_WAIT ${file_sync_after_first}

${file_sync_before_last} /dev/null 2>&1 &

tests/regression/tools/regen-metadata/test_ust new file +32 -0
+
+	start_lttng_tracing_ok $SESSION_NAME
+
+	touch ${file_sync_before_last}
+
+	# Wait for the applications started in background
+	wait
+	regenerate_metadata_ok $SESSION_NAME
+
+	stop_lttng_tracing_ok $SESSION_NAME
+	destroy_lttng_session_ok $SESSION_NAME
+	# Validate test
+	validate_trace $EVENT_NAME $TRACE_PATH
+	if [ $? -eq 0 ]; then
+		# Only delete if successful
+		rm -rf $TRACE_PATH
+	fi
+	rm -f ${file_sync_after_first}
+	rm -f ${file_sync_before_last}
+}
+
+function test_ust_pid ()
+{
+	local file_sync_after_first=$(mktemp -u)
+	local file_sync_before_last=$(mktemp -u)
+
+	diag "Test UST per-pid with metadata regeneration (expect failure)"
+	create_lttng_session_ok $SESSION_NAME $TRACE_PATH
+	enable_channel_per_pid $SESSION_NAME "channel0"
+	enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME "channel0"
+
+	$TESTAPP_BIN $NR_ITER $NR_USEC_WAIT ${file_sync_after_first}

${file_sync_before_last} /dev/null 2>&1 &

tests/regression/tools/regen-metadata/test_ust new file +31 -0
+
+	start_lttng_tracing_ok $SESSION_NAME
+
+	touch ${file_sync_before_last}
+
+	# Wait for the applications started in background
+	wait
+	regenerate_metadata_fail $SESSION_NAME
+
+	stop_lttng_tracing_ok $SESSION_NAME
+	destroy_lttng_session_ok $SESSION_NAME
+	# Validate test
+	validate_trace $EVENT_NAME $TRACE_PATH
+	if [ $? -eq 0 ]; then
+		# Only delete if successful
+		rm -rf $TRACE_PATH
+	fi
+	rm -f ${file_sync_after_first}
+	rm -f ${file_sync_before_last}
+}
+
+function test_ust_live ()
+{
+	local file_sync_after_first=$(mktemp -u)
+	local file_sync_before_last=$(mktemp -u)
+
+	diag "Test UST live with metadata regeneration (expect failure)"
+	lttng_create_session_uri_live $SESSION_NAME $TRACE_PATH
+	enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME
+
+	$TESTAPP_BIN $NR_ITER $NR_USEC_WAIT ${file_sync_after_first}

${file_sync_before_last} /dev/null 2>&1 &

tests/regression/tools/regen-metadata/test_ust new file +40 -0
+
+	start_lttng_tracing_ok $SESSION_NAME
+
+	touch ${file_sync_before_last}
+
+	# Wait for the applications started in background
+	wait
+	regenerate_metadata_fail $SESSION_NAME
+
+	stop_lttng_tracing_ok $SESSION_NAME
+	destroy_lttng_session_ok $SESSION_NAME
+	# Validate test
+	validate_trace $EVENT_NAME $TRACE_PATH
+	if [ $? -eq 0 ]; then
+		# Only delete if successful
+		rm -rf $TRACE_PATH
+	fi
+	rm -f ${file_sync_after_first}
+	rm -f ${file_sync_before_last}
+}
+
+plan_tests $NUM_TESTS
+
+print_test_banner "$TEST_DESC"
+
+start_lttng_relayd "-o $TRACE_PATH"
+start_lttng_sessiond
+
+tests=( test_ust_streaming test_ust_local test_ust_pid test_ust_live )
+
+for fct_test in ${tests[@]};
+do
+	SESSION_NAME=$(randstring 16 0)
+	${fct_test}
+done
+
+stop_lttng_sessiond
+stop_lttng_relayd
+
+exit $out
tests/root_regression +0 -0
index 2981dc6..d0fad04 100644
@@ -14,5 +14,5 @@ regression/tools/filtering/test_invalid_filter

regression/tools/filtering/test_unsupported_op
regression/tools/filtering/test_valid_filter
regression/tools/wildcard/test_event_wildcard

tests/root_regression +1 -1
-regression/tools/metadata-regen/test_kernel
+regression/tools/regen-metadata/test_kernel

regression/ust/test_event_perf

tests/utils/utils.sh +1 -2
index da2efe9..3d744e2 100644
@@ -1366,29 +1366,29 @@ function validate_trace_empty()
 	return $ret
 }
 
-function metadata_regenerate ()
+function regenerate_metadata ()
 {
 	local expected_to_fail=$1
 	local sess_name=$2
 
-	$TESTDIR/../src/bin/lttng/$LTTNG_BIN metadata regenerate -s $sess_name 1>

$OUTPUT_DEST 2> $ERROR_OUTPUT_DEST

tests/utils/utils.sh +1 -0
+	$TESTDIR/../src/bin/lttng/$LTTNG_BIN regenerate metadata -s $sess_name 1>

$OUTPUT_DEST 2> $ERROR_OUTPUT_DEST

	ret=$?
	if [[ $expected_to_fail -eq "1" ]]; then
		test "$ret" -ne "0"
tests/utils/utils.sh +1 -1
-		ok $? "Expected fail on regenerate $sess_name"
+		ok $? "Expected fail on regenerate metadata $sess_name"

else
ok $ret "Metadata regenerate $sess_name"
fi
}

tests/utils/utils.sh +1 -1
-function metadata_regenerate_ok ()
+function regenerate_metadata_ok ()

{

tests/utils/utils.sh +1 -1
-	metadata_regenerate 0 "$@"
+	regenerate_metadata 0 "$@"

}

tests/utils/utils.sh +1 -1
-function metadata_regenerate_fail ()
+function regenerate_metadata_fail ()

{

tests/utils/utils.sh +1 -1
-	metadata_regenerate 1 "$@"
+	regenerate_metadata 1 "$@"

}

function destructive_tests_enabled ()
--
1.9.1

Signature · 8 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

A message that is not in the archive (sent off-list or not yet received): [email protected]

#8 lore raw

Re: [PATCH lttng-tools 4/6] Allow regenerating the statedump of a running session

Quoted 158 lines · ----- On Jun 30, 2016, at 12:36 PM, Julien Desfossez [email protected]…

The "lttng regenerate statedump" command can be used to regenerate the statedump of a running session whenever needed. This is particularly useful in snapshot and trace-file rotation modes where the original statedump may be lost.

---

include/lttng/lttng-error.h              |  1 +
include/lttng/lttng.h                    |  9 +++++
src/bin/lttng-sessiond/cmd.c             | 44 +++++++++++++++++++++++
src/bin/lttng-sessiond/cmd.h             |  1 +
src/bin/lttng-sessiond/main.c            |  6 ++++
src/bin/lttng-sessiond/ust-app.c         | 62 ++++++++++++++++++++++++++++++++
src/bin/lttng-sessiond/ust-app.h         |  6 ++++
src/bin/lttng/commands/regenerate.c      | 19 ++++++++++
src/common/error.c                       |  1 +
src/common/kernel-ctl/kernel-ctl.c       |  5 +++
src/common/kernel-ctl/kernel-ctl.h       |  1 +
src/common/sessiond-comm/sessiond-comm.h |  1 +
src/lib/lttng-ctl/lttng-ctl.c            | 31 ++++++++++++++++
13 files changed, 187 insertions(+)
include/lttng/lttng-error.h +1 -0
index 72194ef..52ce333 100644
@@ -142,6 +142,7 @@ enum lttng_error_code {
 	LTTNG_ERR_LIVE_SESSION           = 119, /* Live session unsupported */
 	LTTNG_ERR_PER_PID_SESSION        = 120, /* Per-PID sessions unsupported */
 	LTTNG_ERR_KERN_CONTEXT_UNAVAILABLE = 121, /* Context unavailable on this kernel
 	*/
+	LTTNG_ERR_REGEN_STATEDUMP_FAIL   = 122, /* Failed to regenerate the statdump
 */
 
	/* MUST be last element */
	LTTNG_ERR_NR,                           /* Last element */
include/lttng/lttng.h +9 -0
index ed03bdb..7f9fa9d 100644
@@ -172,6 +172,15 @@ extern int lttng_metadata_regenerate(const char
 *session_name);
 */
 extern int lttng_regenerate_metadata(const char *session_name);
 
+/*
+ * Trigger the regeneration of the statedump for a session. The new statedump
+ * information is appended to the currently active trace, the session needs to
+ * be started.
+ *
+ * Return 0 on success, a negative LTTng error code on error.
+ */
+extern int lttng_regenerate_statedump(const char *session_name);
+
 #ifdef __cplusplus
 }

#endif

src/bin/lttng-sessiond/cmd.c +44 -0
index bd63389..480333d 100644
@@ -3540,6 +3540,50 @@ end:
 }
 
 /*
+ * Command LTTNG_REGENERATE_STATEDUMP from the lttng-ctl library.
+ *
+ * Ask the tracer to regenerate a new statedump.
+ *
+ * Return 0 on success or else a LTTNG_ERR code.
+ */
+int cmd_regenerate_statedump(struct ltt_session *session)
+{
+	int ret;
+
+	assert(session);
+
+	if (!session->active) {
+		ret = LTTNG_ERR_SESSION_NOT_STARTED;
+		goto end;
+	}
+	ret = 0;
+
+	if (session->kernel_session) {
+		ret = kernctl_session_regenerate_statedump(
+				session->kernel_session->fd);
+		if (ret < 0) {
+			ret = LTTNG_ERR_REGEN_STATEDUMP_FAIL;
+			ERR("Failed to regenerate the kernel statedump");
+			goto end;
+		}
+	}
+
+	if (session->ust_session) {
+		ret = ust_app_regenerate_statedump_all(session->ust_session);
+		if (ret < 0) {
+			ret = LTTNG_ERR_REGEN_STATEDUMP_FAIL;
+			ERR("Failed to regenerate the UST statedump");
+			goto end;
+		}
+	}
+	DBG("Cmd regenerate statedump for session %s", session->name);
+	ret = LTTNG_OK;
+
+end:
+	return ret;
+}
+
+/*
 * Send relayd sockets from snapshot output to consumer. Ignore request if the
 * snapshot output is *not* set with a remote destination.
 *
src/bin/lttng-sessiond/cmd.h +1 -0
index 320d717..975a7f1 100644
@@ -111,5 +111,6 @@ int cmd_snapshot_record(struct ltt_session *session,
 int cmd_set_session_shm_path(struct ltt_session *session,
 		const char *shm_path);
 int cmd_regenerate_metadata(struct ltt_session *session);
+int cmd_regenerate_statedump(struct ltt_session *session);
 
 #endif /* CMD_H */
src/bin/lttng-sessiond/main.c +1 -0
index 3623e5d..8309c3f 100644
@@ -3004,6 +3004,7 @@ static int process_client_msg(struct command_ctx *cmd_ctx,
 int sock,
 	case LTTNG_SAVE_SESSION:
 	case LTTNG_SET_SESSION_SHM_PATH:
 	case LTTNG_REGENERATE_METADATA:
+	case LTTNG_REGENERATE_STATEDUMP:
 		need_domain = 0;
 		break;

default:

src/bin/lttng-sessiond/main.c +5 -0
@@ -4119,6 +4120,11 @@ error_add_context:
 		ret = cmd_regenerate_metadata(cmd_ctx->session);
 		break;
 	}
+	case LTTNG_REGENERATE_STATEDUMP:
+	{
+		ret = cmd_regenerate_statedump(cmd_ctx->session);
+		break;
+	}
 	default:
 		ret = LTTNG_ERR_UND;
 		break;
src/bin/lttng-sessiond/ust-app.c +2 -0
index f30df20..37263e6 100644
@@ -6148,3 +6148,65 @@ end:
 	rcu_read_unlock();
 	return ret;
 }
+
+static

src/bin/lttng-sessiond/ust-app.c end: · line 6162

Quoted 10 lines
src/bin/lttng-sessiond/ust-app.c +10 -0
+int ust_app_regenerate_statedump(struct ltt_ust_session *usess,
+		struct ust_app *app)
+{
+	int ret = 0;
+	struct ust_app_session *ua_sess;
+
+	DBG("Regenerating the metadata for ust app pid %d", app->pid);
+
+	rcu_read_lock();
+

missing:

        if (!app->compatible) {
                goto end_not_compatible;
        }
Quoted 24 lines
src/bin/lttng-sessiond/ust-app.c +24 -0
+	ua_sess = lookup_session_by_app(usess, app);
+	if (ua_sess == NULL) {
+		/* The session is in teardown process. Ignore and continue. */
+		goto end;
+	}
+
+	pthread_mutex_lock(&ua_sess->lock);
+
+	if (ua_sess->deleted) {
+		pthread_mutex_unlock(&ua_sess->lock);
+		goto end;
+	}
+
+	pthread_mutex_lock(&app->sock_lock);
+	ret = ustctl_regenerate_statedump(app->sock, ua_sess->handle);
+	pthread_mutex_unlock(&app->sock_lock);
+	pthread_mutex_unlock(&ua_sess->lock);
+
+end:
+	rcu_read_unlock();
+	health_code_update();
+	return ret;
+}
+

[...]

Quoted 20 lines

/*
+ * Regenerate the statedump of a session.
+ * Return 0 on success, a negative error code on error.
+ */

src/bin/lttng-sessiond/ust-app.c +16 -0
+int lttng_regenerate_statedump(const char *session_name)
+{
+	int ret;
+	struct lttcomm_session_msg lsm;
+
+	if (!session_name) {
+		ret = -LTTNG_ERR_INVALID;
+		goto end;
+	}
+
+	memset(&lsm, 0, sizeof(lsm));
+	lsm.cmd_type = LTTNG_REGENERATE_STATEDUMP;
+
+	lttng_ctl_copy_string(lsm.session.name, session_name,
+			sizeof(lsm.session.name));
+

src/bin/lttng-sessiond/ust-app.c

Quoted 10 lines
src/bin/lttng-sessiond/ust-app.c +10 -0
+	ret = lttng_ctl_ask_sessiond(&lsm, NULL);
+	if (ret < 0) {
+		goto end;
+	}
+
+	ret = 0;
+end:
+	return ret;
+}
+

Remove extra whiteline.

Thanks,

Mathieu

Quoted 7 lines
src/bin/lttng-sessiond/ust-app.c +2 -0
+
+/*
 * lib constructor.
 */

static void __attribute__((constructor)) init(void) --
1.9.1

Signature · 7 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

A message that is not in the archive (sent off-list or not yet received): [email protected]

Reviewed-by
#10 lore raw

Re: [PATCH lttng-tools 5/6] Tests for the regenerate statedump command

----- On Jun 30, 2016, at 12:36 PM, Julien Desfossez [email protected] wrote:

Quoted 342 lines

---

configure.ac                                       |  1 +
tests/fast_regression                              |  1 +
tests/regression/tools/Makefile.am                 |  2 +-
tests/regression/tools/regen-statedump/Makefile.am | 16 ++++
tests/regression/tools/regen-statedump/test_kernel | 80 +++++++++++++++++++
tests/regression/tools/regen-statedump/test_ust    | 89 ++++++++++++++++++++++
tests/root_regression                              |  1 +
tests/utils/utils.sh                               | 54 +++++++++++++
8 files changed, 243 insertions(+), 1 deletion(-)

create mode 100644 tests/regression/tools/regen-statedump/Makefile.am create mode 100755 tests/regression/tools/regen-statedump/test_kernel create mode 100755 tests/regression/tools/regen-statedump/test_ust

configure.ac +1 -0
index 89a7858..6222e2b 100644
@@ -981,6 +981,7 @@ AC_CONFIG_FILES([
 	tests/regression/tools/wildcard/Makefile
 	tests/regression/tools/crash/Makefile
 	tests/regression/tools/regen-metadata/Makefile
+	tests/regression/tools/regen-statedump/Makefile
 	tests/regression/ust/Makefile
 	tests/regression/ust/nprocesses/Makefile
 	tests/regression/ust/high-throughput/Makefile
tests/fast_regression +0 -0
index 262c846..8edbeca 100644
@@ -17,6 +17,7 @@ regression/tools/mi/test_mi

regression/tools/wildcard/test_event_wildcard
regression/tools/crash/test_crash
regression/tools/regen-metadata/test_ust
+regression/tools/regen-statedump/test_ust
regression/ust/before-after/test_before_after
regression/ust/buffers-pid/test_buffers_pid
regression/ust/multi-session/test_multi_session

tests/regression/tools/Makefile.am +0 -0
index 91820ad..76374c7 100644
@@ -1,2 +1,2 @@

SUBDIRS = streaming filtering health tracefile-limits snapshots live exclusion save-load mi \

tests/regression/tools/Makefile.am +1 -1
-		wildcard crash regen-metadata
+		wildcard crash regen-metadata regen-statedump
tests/regression/tools/regen-statedump/Makefile.am new file +16 -0
new file mode 100644
index 0000000..d4a92eb
@@ -0,0 +1,16 @@
+noinst_SCRIPTS = test_ust test_kernel
+EXTRA_DIST = test_ust test_kernel
+
+all-local:
+	@if [ x"$(srcdir)" != x"$(builddir)" ]; then \
+		for script in $(EXTRA_DIST); do \
+			cp -f $(srcdir)/$$script $(builddir); \
+		done; \
+	fi
+
+clean-local:
+	@if [ x"$(srcdir)" != x"$(builddir)" ]; then \
+		for script in $(EXTRA_DIST); do \
+			rm -f $(builddir)/$$script; \
+		done; \
+	fi
tests/regression/tools/regen-statedump/test_kernel new file +65 -0
new file mode 100755
index 0000000..85afe76
@@ -0,0 +1,80 @@
+#!/bin/bash
+#
+# Copyright (C) - 2016 Julien Desfossez <[email protected]>
+#
+# This library is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this library; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
+TEST_DESC="Regenerate the statedump - Kernel tracing"
+
+CURDIR=$(dirname $0)/
+TESTDIR=$CURDIR/../../..
+EVENT_NAME="lttng_test_filter_event"
+PID_RELAYD=0
+SESSION_NAME=""
+EVENT_NAME="lttng_statedump_start,lttng_statedump_end"
+
+TRACE_PATH=$(mktemp -d)
+
+NUM_TESTS=11
+
+source $TESTDIR/utils/utils.sh
+
+# LTTng kernel modules check
+out=`ls /lib/modules/$(uname -r)/extra | grep lttng`
+if [ -z "$out" ]; then
+	BAIL_OUT "LTTng modules not detected."
+fi
+
+function test_kernel_local ()
+{
+	diag "Test kernel local with statedump regeneration"
+	create_lttng_session_ok $SESSION_NAME $TRACE_PATH
+	lttng_enable_kernel_event $SESSION_NAME $EVENT_NAME
+	start_lttng_tracing_ok $SESSION_NAME
+	echo -n "100" > /proc/lttng-test-filter-event
+	regenerate_statedump_ok $SESSION_NAME
+	stop_lttng_tracing_ok $SESSION_NAME
+	validate_trace_count $EVENT_NAME $TRACE_PATH 4
+	if [ $? -eq 0 ]; then
+		# Only delete if successful
+		rm -rf $TRACE_PATH
+	fi
+	destroy_lttng_session_ok $SESSION_NAME
+}
+
+plan_tests $NUM_TESTS
+
+print_test_banner "$TEST_DESC"
+
+if [ "$(id -u)" == "0" ]; then
+	isroot=1
+else
+	isroot=0
+fi
+
+skip $isroot "Root access is needed. Skipping all kernel streaming tests."

$NUM_TESTS ||

tests/regression/tools/regen-statedump/test_kernel new file +15 -0
+{
+	start_lttng_sessiond
+	modprobe lttng-test
+
+	tests=( test_kernel_local )
+
+	for fct_test in ${tests[@]};
+	do
+		SESSION_NAME=$(randstring 16 0)
+		${fct_test}
+	done
+
+	rmmod lttng-test
+	stop_lttng_sessiond
+}
tests/regression/tools/regen-statedump/test_ust new file +49 -0
new file mode 100755
index 0000000..486b9a5
@@ -0,0 +1,89 @@
+#!/bin/bash
+#
+# Copyright (C) - 2016 Julien Desfossez <[email protected]>
+#
+# This library is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this library; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
+TEST_DESC="Regenerate the statedump - User-space tracing"
+
+CURDIR=$(dirname $0)/
+TESTDIR=$CURDIR/../../..
+NR_ITER=10
+NR_USEC_WAIT=0
+TESTAPP_PATH="$TESTDIR/utils/testapp"
+TESTAPP_NAME="gen-ust-events"
+TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
+SESSION_NAME="stream"
+EVENT_NAME="lttng_ust_statedump:start,lttng_ust_statedump:end"
+PID_RELAYD=0
+
+TRACE_PATH=$(mktemp -d)
+
+NUM_TESTS=11
+
+source $TESTDIR/utils/utils.sh
+
+if [ ! -x "$TESTAPP_BIN" ]; then
+	BAIL_OUT "No UST events binary detected."
+fi
+
+function test_ust_local ()
+{
+	local file_sync_after_first=$(mktemp -u)
+	local file_sync_before_last=$(mktemp -u)
+
+	diag "Test UST local with statedump regeneration"
+	create_lttng_session_ok $SESSION_NAME $TRACE_PATH
+	enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME
+
+	$TESTAPP_BIN $NR_ITER $NR_USEC_WAIT ${file_sync_after_first}

${file_sync_before_last} /dev/null 2>&1 &

tests/regression/tools/regen-statedump/test_ust new file +40 -0
+
+	start_lttng_tracing_ok $SESSION_NAME
+
+	while [ ! -f "${file_sync_after_first}" ]; do
+		sleep 0.5
+	done
+
+	regenerate_statedump_ok $SESSION_NAME
+
+	touch ${file_sync_before_last}
+
+	stop_lttng_tracing_ok $SESSION_NAME
+	destroy_lttng_session_ok $SESSION_NAME
+	# Validate test
+	validate_trace_count $EVENT_NAME $TRACE_PATH 4
+	if [ $? -eq 0 ]; then
+		# Only delete if successful
+		rm -rf $TRACE_PATH
+	fi
+	rm -f ${file_sync_after_first}
+	rm -f ${file_sync_before_last}
+}
+
+plan_tests $NUM_TESTS
+
+print_test_banner "$TEST_DESC"
+
+start_lttng_sessiond
+
+tests=( test_ust_local )
+
+for fct_test in ${tests[@]};
+do
+	SESSION_NAME=$(randstring 16 0)
+	${fct_test}
+done
+
+stop_lttng_sessiond
+
+exit $out
tests/root_regression +0 -0
index d0fad04..d3eaf23 100644
@@ -15,4 +15,5 @@ regression/tools/filtering/test_unsupported_op

regression/tools/filtering/test_valid_filter
regression/tools/wildcard/test_event_wildcard
regression/tools/regen-metadata/test_kernel
+regression/tools/regen-statedump/test_kernel
regression/ust/test_event_perf

tests/utils/utils.sh +29 -0
index 3d744e2..c56a8aa 100644
@@ -1294,6 +1294,35 @@ function validate_trace
 	return $ret
 }
 
+function validate_trace_count
+{
+	local event_name=$1
+	local trace_path=$2
+	local expected_count=$3
+
+	which $BABELTRACE_BIN >/dev/null
+	if [ $? -ne 0 ]; then
+	    skip 0 "Babeltrace binary not found. Skipping trace validation"
+	fi
+
+	cnt=0
+	OLDIFS=$IFS
+	IFS=","
+	for i in $event_name; do
+		traced=$($BABELTRACE_BIN $trace_path 2>/dev/null | grep $i | wc -l)
+		if [ "$traced" -ne 0 ]; then
+			pass "Validate trace for event $i, $traced events"
+		else
+			fail "Validate trace for event $i"
+			diag "Found $traced occurences of $i"
+		fi
+		cnt=$(($cnt + $traced))
+	done
+	IFS=$OLDIFS
+	test $cnt -eq $expected_count
+	ok $? "Read a total of $cnt events, expected $expected_count"
+}
+

function trace_first_line
{
local trace_path=$1

tests/utils/utils.sh +6 -0
@@ -1391,6 +1420,31 @@ function regenerate_metadata_fail ()
 	regenerate_metadata 1 "$@"
 }
 
+function regenerate_statedump ()
+{
+	local expected_to_fail=$1
+	local sess_name=$2
+
+	$TESTDIR/../src/bin/lttng/$LTTNG_BIN regenerate statedump -s $sess_name 1>

$OUTPUT_DEST 2> $ERROR_OUTPUT_DEST

tests/utils/utils.sh +19 -0
+	ret=$?
+	if [[ $expected_to_fail -eq "1" ]]; then
+		test "$ret" -ne "0"
+		ok $? "Expected fail on regenerate statedump $sess_name"
+	else
+		ok $ret "Metadata regenerate $sess_name"
+	fi
+}
+
+function regenerate_statedump_ok ()
+{
+	regenerate_statedump 0 "$@"
+}
+
+function regenerate_statedump_fail ()
+{
+	regenerate_statedump 1 "$@"
+}
+

function destructive_tests_enabled ()

{
	if [ ${LTTNG_ENABLE_DESTRUCTIVE_TESTS} = "will-break-my-system" ]; then

--
1.9.1

Signature · 7 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

A message that is not in the archive (sent off-list or not yet received): [email protected]

Reviewed-by
#12 lore raw

Re: [PATCH lttng-tools 6/6] Manpage for the regenerate statedump command

----- On Jun 30, 2016, at 12:36 PM, Julien Desfossez [email protected] wrote:

Quoted 53 lines

---
doc/man/lttng-regenerate.1.txt | 15 +++++++++++++--

1 file changed, 13 insertions(+), 2 deletions(-)
doc/man/lttng-regenerate.1.txt +0 -0
index dbbfa4d..80bae20 100644
@@ -14,12 +14,19 @@ Regenerate the metadata of a session

[verse]
*lttng* ['linkgenoptions:(GENERAL OPTIONS)'] *regenerate metadata* [option:--session='SESSION']

doc/man/lttng-regenerate.1.txt +4 -0
+Regenerate the statedump of a session
+
+[verse]
+*lttng* ['linkgenoptions:(GENERAL OPTIONS)'] *regenerate statedump*

[option:--session='SESSION']
+
DESCRIPTION
-----------
The lttng regenerate command manages a tracing session's data regeneration options.

doc/man/lttng-regenerate.1.txt +3 -1
-As of this version, only the `metadata` command's action is available.
+As of this version, the `metadata` and `statedump` command's action are
+available.
+

Regenerating a tracing session's metadata can be used to resample the offset between the system's monotonic clock and the wall-clock time.

doc/man/lttng-regenerate.1.txt +0 -0
@@ -32,12 +39,16 @@ traced before its wall time is NTP-corrected. Regenerating

the tracing
session's metadata ensures that trace viewers can accurately determine the events time relative to Unix Epoch.

doc/man/lttng-regenerate.1.txt +4 -0
+Regenerating a tracing session's statedump can be used to collect up-to-date
+statedump informations during the trace session. This is particularly useful in
+snapshot or trace-file rotation modes where the statedump information may be
+lost.

include::common-cmd-options-head.txt[]

option:-s, option:--session='SESSION'::

doc/man/lttng-regenerate.1.txt +1 -2
-    Manage the metadata generation of the tracing session named 'SESSION'
+    Manage the data regeneration of the tracing session named 'SESSION'
    instead of the current tracing session.
 
 
--

1.9.1

Signature · 7 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

A message that is not in the archive (sent off-list or not yet received): [email protected]

#14 lore raw
Quoted 1 line · ----- On Jun 30, 2016, at 12:36 PM, Julien Desfossez [email protected]…

From: Mathieu Desnoyers <[email protected]>

Quoted 20 lines

---
src/bin/lttng-sessiond/lttng-ust-abi.h | 1 +

1 file changed, 1 insertion(+)
src/bin/lttng-sessiond/lttng-ust-abi.h +1 -1
index 7bec0c9..9ef7b9a 100644
@@ -275,6 +275,7 @@ struct lttng_ust_event_exclusion {
 	_UST_CMDW(0x51, struct lttng_ust_channel)
 #define LTTNG_UST_SESSION_START			_UST_CMD(0x52)
 #define LTTNG_UST_SESSION_STOP			_UST_CMD(0x53)
+#define LTTNG_UST_SESSION_STATEDUMP		_UST_CMD(0x54)
 
 /* Channel FD commands */
 #define LTTNG_UST_STREAM			_UST_CMD(0x60)
--

1.9.1

Signature · 7 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

A message that is not in the archive (sent off-list or not yet received): [email protected]

#16 lore raw

Re: [PATCH lttng-tools 3/6] Kernel ioctl to regenerate the statedump

Quoted 2 lines · ----- On Jun 30, 2016, at 12:36 PM, Julien Desfossez [email protected]…

From: Mathieu Desnoyers <[email protected]>

Quoted 20 lines

---
src/common/kernel-ctl/kernel-ioctl.h | 2 ++

1 file changed, 2 insertions(+)
src/common/kernel-ctl/kernel-ioctl.h +2 -1
index 68056dc..805de02 100644
@@ -134,6 +134,8 @@
 */
 #define LTTNG_KERNEL_SESSION_LIST_TRACKER_PIDS	_IO(0xF6, 0x58)
 #define LTTNG_KERNEL_SESSION_METADATA_REGEN	_IO(0xF6, 0x59)
+/* 0x5A and 0x5B are reserved for a future ABI-breaking cleanup. */
+#define LTTNG_KERNEL_SESSION_STATEDUMP		_IO(0xF6, 0x5C)
 
 /* Channel FD ioctl */
 #define LTTNG_KERNEL_STREAM			_IO(0xF6, 0x62)
--

1.9.1

Signature · 7 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev