Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
* [lttng-dev] [PATCH lttng-tools 0/4] Allow discard buffers in snapshot sessions
@ 2016-04-20 15:19 Mathieu Desnoyers
  2016-04-20 15:19 ` [lttng-dev] [PATCH lttng-tools 1/4] Fix: validate number of subbuffers after tweaking properties Mathieu Desnoyers
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Mathieu Desnoyers @ 2016-04-20 15:19 UTC (permalink / raw)


This patchset allows users to override the channel mode
(discard/overwrite) for snapshot sessions for both lttng-ust and lttng
kernel tracing. Previously, snapshot sessions were enforcing overwrite
buffer types.

Thanks,

Mathieu

Mathieu Desnoyers (4):
  Fix: validate number of subbuffers after tweaking properties
  Allow channel mode override in snapshot sessions
  tests: test kernel snapshot with discard buffers
  tests: test ust snapshot with discard buffers

 include/lttng/channel.h                      |   2 +-
 src/bin/lttng-sessiond/channel.c             |  55 +++++++++-
 src/bin/lttng-sessiond/cmd.c                 |  10 --
 src/bin/lttng/commands/create.c              |   2 +-
 src/common/defaults.h                        |   2 +-
 tests/regression/tools/snapshots/test_kernel |  94 ++++++++++++++++-
 tests/regression/tools/snapshots/ust_test    | 150 ++++++++++++++++++++++++++-
 tests/utils/utils.sh                         |  30 ++++++
 8 files changed, 321 insertions(+), 24 deletions(-)

-- 
2.1.4



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

* [lttng-dev] [PATCH lttng-tools 1/4] Fix: validate number of subbuffers after tweaking properties
  2016-04-20 15:19 [lttng-dev] [PATCH lttng-tools 0/4] Allow discard buffers in snapshot sessions Mathieu Desnoyers
@ 2016-04-20 15:19 ` Mathieu Desnoyers
  2016-04-20 15:19 ` [lttng-dev] [PATCH lttng-tools 2/4] Allow channel mode override in snapshot sessions Mathieu Desnoyers
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Mathieu Desnoyers @ 2016-04-20 15:19 UTC (permalink / raw)


There are properties that are tweaked by each of ust and kernel channel
create functions after a validation on the number of subbuffers for
overwrite channels. Move validation after those properties
modifications.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
---
 src/bin/lttng-sessiond/channel.c | 25 +++++++++++++++++++++++++
 src/bin/lttng-sessiond/cmd.c     | 10 ----------
 2 files changed, 25 insertions(+), 10 deletions(-)

diff --git a/src/bin/lttng-sessiond/channel.c b/src/bin/lttng-sessiond/channel.c
index 8ceb4e8..0119abf 100644
--- a/src/bin/lttng-sessiond/channel.c
+++ b/src/bin/lttng-sessiond/channel.c
@@ -179,6 +179,19 @@ error:
 	return ret;
 }
 
+static int channel_validate(struct lttng_channel *attr)
+{
+	/*
+	 * The ringbuffer (both in user space and kernel) behave badly
+	 * in overwrite mode and with less than 2 subbuf so block it
+	 * right away and send back an invalid attribute error.
+	 */
+	if (attr->attr.overwrite && attr->attr.num_subbuf < 2) {
+		return -1;
+	}
+	return 0;
+}
+
 /*
  * Create kernel channel of the kernel session and notify kernel thread.
  */
@@ -207,6 +220,12 @@ int channel_kernel_create(struct ltt_kernel_session *ksession,
 		attr->attr.output = LTTNG_EVENT_MMAP;
 	}
 
+	/* Validate common channel properties. */
+	if (channel_validate(attr) < 0) {
+		ret = LTTNG_ERR_INVALID;
+		goto error;
+	}
+
 	/* Channel not found, creating it */
 	ret = kernel_create_channel(ksession, attr);
 	if (ret < 0) {
@@ -305,6 +324,12 @@ int channel_ust_create(struct ltt_ust_session *usess,
 		attr->attr.output = LTTNG_EVENT_MMAP;
 	}
 
+	/* Validate common channel properties. */
+	if (channel_validate(attr) < 0) {
+		ret = LTTNG_ERR_INVALID;
+		goto error;
+	}
+
 	/*
 	 * Validate UST buffer size and number of buffers: must both be power of 2
 	 * and nonzero. We validate right here for UST, because applications will
diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c
index ba963ff..73942a6 100644
--- a/src/bin/lttng-sessiond/cmd.c
+++ b/src/bin/lttng-sessiond/cmd.c
@@ -1322,16 +1322,6 @@ int cmd_enable_channel(struct ltt_session *session,
 		attr->attr.switch_timer_interval = 0;
 	}
 
-	/*
-	 * The ringbuffer (both in user space and kernel) behave badly in overwrite
-	 * mode and with less than 2 subbuf so block it right away and send back an
-	 * invalid attribute error.
-	 */
-	if (attr->attr.overwrite && attr->attr.num_subbuf < 2) {
-		ret = LTTNG_ERR_INVALID;
-		goto error;
-	}
-
 	switch (domain->type) {
 	case LTTNG_DOMAIN_KERNEL:
 	{
-- 
2.1.4



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

* [lttng-dev] [PATCH lttng-tools 2/4] Allow channel mode override in snapshot sessions
  2016-04-20 15:19 [lttng-dev] [PATCH lttng-tools 0/4] Allow discard buffers in snapshot sessions Mathieu Desnoyers
  2016-04-20 15:19 ` [lttng-dev] [PATCH lttng-tools 1/4] Fix: validate number of subbuffers after tweaking properties Mathieu Desnoyers
@ 2016-04-20 15:19 ` Mathieu Desnoyers
  2016-04-20 15:19 ` [lttng-dev] [PATCH lttng-tools 3/4] tests: test kernel snapshot with discard buffers Mathieu Desnoyers
  2016-04-20 15:20 ` [lttng-dev] [PATCH lttng-tools 4/4] tests: test ust " Mathieu Desnoyers
  3 siblings, 0 replies; 5+ messages in thread
From: Mathieu Desnoyers @ 2016-04-20 15:19 UTC (permalink / raw)


Allow the lttng cmd line and liblttng-ctl users to override the channel
mode in snapshot sessions.

Note that liblttng-ctl users expecting that an "overwrite" mode
explicitly set at the value "0" (discard) for a snapshot session will
now create a channel in discard mode.

The DEFAULT_CHANNEL_OVERWRITE used by liblttng-ctl
lttng_channel_set_default_attr() is changed to "-1".

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
---
 include/lttng/channel.h          |  2 +-
 src/bin/lttng-sessiond/channel.c | 30 ++++++++++++++++++++++++++----
 src/bin/lttng/commands/create.c  |  2 +-
 src/common/defaults.h            |  2 +-
 4 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/include/lttng/channel.h b/include/lttng/channel.h
index 622ce85..732074c 100644
--- a/include/lttng/channel.h
+++ b/include/lttng/channel.h
@@ -33,7 +33,7 @@ extern "C" {
  */
 #define LTTNG_CHANNEL_ATTR_PADDING1        LTTNG_SYMBOL_NAME_LEN + 12
 struct lttng_channel_attr {
-	int overwrite;                      /* 1: overwrite, 0: discard */
+	int overwrite;                      /* -1: session default, 1: overwrite, 0: discard */
 	uint64_t subbuf_size;               /* bytes, power of 2 */
 	uint64_t num_subbuf;                /* power of 2 */
 	unsigned int switch_timer_interval; /* usec */
diff --git a/src/bin/lttng-sessiond/channel.c b/src/bin/lttng-sessiond/channel.c
index 0119abf..7bb0ff7 100644
--- a/src/bin/lttng-sessiond/channel.c
+++ b/src/bin/lttng-sessiond/channel.c
@@ -214,9 +214,20 @@ int channel_kernel_create(struct ltt_kernel_session *ksession,
 		attr = defattr;
 	}
 
+	/*
+	 * Set the overwrite mode for this channel based on the session
+	 * type unless the client explicitly overrides the channel mode.
+	 */
+	if (attr->attr.overwrite == DEFAULT_CHANNEL_OVERWRITE) {
+		if (ksession->snapshot_mode) {
+			attr->attr.overwrite = 1;
+		} else {
+			attr->attr.overwrite = 0;
+		}
+	}
+
+	/* Enforce mmap output for snapshot sessions. */
 	if (ksession->snapshot_mode) {
-		/* Force channel attribute for snapshot mode. */
-		attr->attr.overwrite = 1;
 		attr->attr.output = LTTNG_EVENT_MMAP;
 	}
 
@@ -318,9 +329,20 @@ int channel_ust_create(struct ltt_ust_session *usess,
 		}
 	}
 
+	/*
+	 * Set the overwrite mode for this channel based on the session
+	 * type unless the client explicitly overrides the channel mode.
+	 */
+	if (attr->attr.overwrite == DEFAULT_CHANNEL_OVERWRITE) {
+		if (usess->snapshot_mode) {
+			attr->attr.overwrite = 1;
+		} else {
+			attr->attr.overwrite = 0;
+		}
+	}
+
+	/* Enforce mmap output for snapshot sessions. */
 	if (usess->snapshot_mode) {
-		/* Force channel attribute for snapshot mode. */
-		attr->attr.overwrite = 1;
 		attr->attr.output = LTTNG_EVENT_MMAP;
 	}
 
diff --git a/src/bin/lttng/commands/create.c b/src/bin/lttng/commands/create.c
index 525464a..d8e4da4 100644
--- a/src/bin/lttng/commands/create.c
+++ b/src/bin/lttng/commands/create.c
@@ -442,7 +442,7 @@ static int create_session(void)
 			MSG("Default snapshot output set to: %s", print_str_url);
 		}
 		MSG("Snapshot mode set. Every channel enabled for that session will "
-				"be set in overwrite mode and mmap output.");
+				"be set to mmap output, and default to overwrite mode.");
 	}
 	if (opt_shm_path) {
 		MSG("Session %s set to shm_path: %s.", session_name,
diff --git a/src/common/defaults.h b/src/common/defaults.h
index 6e343b5..fc48ff9 100644
--- a/src/common/defaults.h
+++ b/src/common/defaults.h
@@ -188,7 +188,7 @@
 #define DEFAULT_PYTHON_EVENT_COMPONENT    "lttng_python"
 #define DEFAULT_PYTHON_EVENT_NAME         DEFAULT_PYTHON_EVENT_COMPONENT ":*"
 
-#define DEFAULT_CHANNEL_OVERWRITE       0
+#define DEFAULT_CHANNEL_OVERWRITE       -1
 #define DEFAULT_CHANNEL_TRACEFILE_SIZE  0
 #define DEFAULT_CHANNEL_TRACEFILE_COUNT 0
 
-- 
2.1.4



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

* [lttng-dev] [PATCH lttng-tools 3/4] tests: test kernel snapshot with discard buffers
  2016-04-20 15:19 [lttng-dev] [PATCH lttng-tools 0/4] Allow discard buffers in snapshot sessions Mathieu Desnoyers
  2016-04-20 15:19 ` [lttng-dev] [PATCH lttng-tools 1/4] Fix: validate number of subbuffers after tweaking properties Mathieu Desnoyers
  2016-04-20 15:19 ` [lttng-dev] [PATCH lttng-tools 2/4] Allow channel mode override in snapshot sessions Mathieu Desnoyers
@ 2016-04-20 15:19 ` Mathieu Desnoyers
  2016-04-20 15:20 ` [lttng-dev] [PATCH lttng-tools 4/4] tests: test ust " Mathieu Desnoyers
  3 siblings, 0 replies; 5+ messages in thread
From: Mathieu Desnoyers @ 2016-04-20 15:19 UTC (permalink / raw)


Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
---
 tests/regression/tools/snapshots/test_kernel | 94 +++++++++++++++++++++++++++-
 tests/utils/utils.sh                         | 30 +++++++++
 2 files changed, 122 insertions(+), 2 deletions(-)

diff --git a/tests/regression/tools/snapshots/test_kernel b/tests/regression/tools/snapshots/test_kernel
index a590fb4..886c455 100755
--- a/tests/regression/tools/snapshots/test_kernel
+++ b/tests/regression/tools/snapshots/test_kernel
@@ -25,7 +25,7 @@ CHANNEL_NAME="snapchan"
 
 TRACE_PATH=$(mktemp -d)
 
-NUM_TESTS=2040
+NUM_TESTS=2060
 
 source $TESTDIR/utils/utils.sh
 
@@ -118,6 +118,90 @@ function test_kernel_local_snapshot_append_to_metadata ()
 	destroy_lttng_session_ok $SESSION_NAME
 }
 
+function true_loop_cpu0()
+{
+	# Generate many system call events (fill buffers) on CPU 0
+	for a in $(seq 1 $1); do
+		taskset 0x00000001 /bin/true;
+	done
+}
+
+function test_kernel_local_snapshot_discard ()
+{
+	diag "Test local kernel snapshots with small discard buffers"
+	create_lttng_session_no_output $SESSION_NAME
+	enable_lttng_mmap_discard_small_kernel_channel $SESSION_NAME \
+			$CHANNEL_NAME
+	lttng_enable_kernel_syscall_ok $SESSION_NAME -a $CHANNEL_NAME
+	start_lttng_tracing_ok $SESSION_NAME
+	lttng_snapshot_add_output_ok $SESSION_NAME $TRACE_PATH
+
+	true_loop_cpu0 10000
+
+	# Take first snapshot, remember first line.
+	lttng_snapshot_record $SESSION_NAME
+	FIRST_LINE="$(trace_first_line $TRACE_PATH/)"
+	diag "First line (1st snapshot): $FIRST_LINE"
+
+	rm -rf $TRACE_PATH
+
+	true_loop_cpu0 10000
+
+	# Take 2nd snapshot, compare first line. In discard mode, they
+	# should still be the same.
+	lttng_snapshot_record $SESSION_NAME
+	FIRST_LINE_2="$(trace_first_line $TRACE_PATH/)"
+	diag "First line (2nd snapshot): $FIRST_LINE"
+	rm -rf $TRACE_PATH
+
+	if [ x"$FIRST_LINE" != x"$FIRST_LINE_2" ]; then
+		fail "First snapshot event do not match."
+	else
+		pass "First snapshot event match."
+	fi
+
+	stop_lttng_tracing_ok $SESSION_NAME
+	destroy_lttng_session_ok $SESSION_NAME
+}
+
+function test_kernel_local_snapshot_overwrite_small_buffers ()
+{
+	diag "Test local kernel snapshot with small overwrite buffers"
+	create_lttng_session_no_output $SESSION_NAME
+	enable_lttng_mmap_overwrite_small_kernel_channel $SESSION_NAME \
+			$CHANNEL_NAME
+	lttng_enable_kernel_syscall_ok $SESSION_NAME -a $CHANNEL_NAME
+	start_lttng_tracing_ok $SESSION_NAME
+	lttng_snapshot_add_output_ok $SESSION_NAME $TRACE_PATH
+
+	true_loop_cpu0 10000
+
+	# Take first snapshot, remember first line.
+	lttng_snapshot_record $SESSION_NAME
+	FIRST_LINE="$(trace_first_line $TRACE_PATH/)"
+	diag "First line (1st snapshot): $FIRST_LINE"
+
+	rm -rf $TRACE_PATH
+
+	true_loop_cpu0 10000
+
+	# Take 2nd snapshot, compare first line. In overwrite mode, they
+	# WILL be different.
+	lttng_snapshot_record $SESSION_NAME
+	FIRST_LINE_2="$(trace_first_line $TRACE_PATH/)"
+	diag "First line (2nd snapshot): $FIRST_LINE_2"
+	rm -rf $TRACE_PATH
+
+	if [ x"$FIRST_LINE" != x"$FIRST_LINE_2" ]; then
+		pass "First snapshot event do not match."
+	else
+		fail "First snapshot event match."
+	fi
+
+	stop_lttng_tracing_ok $SESSION_NAME
+	destroy_lttng_session_ok $SESSION_NAME
+}
+
 function test_kernel_1000_local_snapshots ()
 {
 	NB_SNAP=1000
@@ -160,7 +244,13 @@ skip $isroot "Root access is needed. Skipping all kernel snapshot tests." $NUM_T
 	start_lttng_sessiond
 
 	#tests=( test_kernel_1000_local_snapshots )
-	tests=( test_kernel_local_snapshot test_kernel_local_snapshot_after_stop test_kernel_local_snapshot_append_to_metadata test_kernel_1000_local_snapshots )
+	tests=( test_kernel_local_snapshot
+		test_kernel_local_snapshot_after_stop
+		test_kernel_local_snapshot_append_to_metadata
+		test_kernel_local_snapshot_discard
+		test_kernel_local_snapshot_overwrite_small_buffers
+		test_kernel_1000_local_snapshots
+	)
 
 	for fct_test in ${tests[@]};
 	do
diff --git a/tests/utils/utils.sh b/tests/utils/utils.sh
index 52c2f6b..094d5f6 100644
--- a/tests/utils/utils.sh
+++ b/tests/utils/utils.sh
@@ -709,6 +709,24 @@ function enable_lttng_mmap_overwrite_kernel_channel()
 	ok $? "Enable channel $channel_name for session $sess_name"
 }
 
+function enable_lttng_mmap_discard_small_kernel_channel()
+{
+	local sess_name=$1
+	local channel_name=$2
+
+	$TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-channel -s $sess_name $channel_name -k --output mmap --discard --subbuf-size=$(getconf PAGE_SIZE) --num-subbuf=2 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
+	ok $? "Enable small discard channel $channel_name for session $sess_name"
+}
+
+function enable_lttng_mmap_overwrite_small_kernel_channel()
+{
+	local sess_name=$1
+	local channel_name=$2
+
+	$TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-channel -s $sess_name $channel_name -k --output mmap --overwrite --subbuf-size=$(getconf PAGE_SIZE) --num-subbuf=2 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
+	ok $? "Enable small discard channel $channel_name for session $sess_name"
+}
+
 function enable_lttng_mmap_overwrite_ust_channel()
 {
 	local sess_name=$1
@@ -1250,6 +1268,18 @@ function validate_trace
 	return $ret
 }
 
+function trace_first_line
+{
+	local trace_path=$1
+
+	which $BABELTRACE_BIN >/dev/null
+	if [ $? -ne 0 ]; then
+	    skip 0 "Babeltrace binary not found. Skipping trace validation"
+	fi
+
+	$BABELTRACE_BIN $trace_path 2>/dev/null | head -n 1
+}
+
 function validate_trace_exp()
 {
 	local event_exp=$1
-- 
2.1.4



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

* [lttng-dev] [PATCH lttng-tools 4/4] tests: test ust snapshot with discard buffers
  2016-04-20 15:19 [lttng-dev] [PATCH lttng-tools 0/4] Allow discard buffers in snapshot sessions Mathieu Desnoyers
                   ` (2 preceding siblings ...)
  2016-04-20 15:19 ` [lttng-dev] [PATCH lttng-tools 3/4] tests: test kernel snapshot with discard buffers Mathieu Desnoyers
@ 2016-04-20 15:20 ` Mathieu Desnoyers
  3 siblings, 0 replies; 5+ messages in thread
From: Mathieu Desnoyers @ 2016-04-20 15:20 UTC (permalink / raw)


Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
---
 tests/regression/tools/snapshots/ust_test | 150 +++++++++++++++++++++++++++++-
 1 file changed, 145 insertions(+), 5 deletions(-)

diff --git a/tests/regression/tools/snapshots/ust_test b/tests/regression/tools/snapshots/ust_test
index f65906f..287ee24 100755
--- a/tests/regression/tools/snapshots/ust_test
+++ b/tests/regression/tools/snapshots/ust_test
@@ -25,11 +25,9 @@ CHANNEL_NAME="snapchan"
 TESTAPP_PATH="$TESTDIR/utils/testapp"
 TESTAPP_NAME="gen-ust-events"
 TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
-NR_ITER=2000000
-NR_USEC_WAIT=100
 APPS_PID=
 
-NUM_TESTS=76
+NUM_TESTS=100
 
 TRACE_PATH=$(mktemp -d)
 
@@ -66,6 +64,14 @@ function start_test_app()
 	rm -f $tmp_file
 }
 
+function wait_test_apps()
+{
+	diag "Waiting for $TESTAPP_NAME"
+	for p in ${APPS_PID}; do
+		wait ${p} 2>/dev/null
+	done
+}
+
 function stop_test_apps()
 {
 	diag "Stopping $TESTAPP_NAME"
@@ -122,10 +128,37 @@ function enable_mmap_overwrite_subbuf_ust_channel ()
 	ok $? "Enable channel $channel_name for session $sess_name with subbuf size $subbuf_size"
 }
 
+function enable_mmap_small_discard_ust_channel ()
+{
+	local sess_name=$1
+	local chan_name=$2
+
+	$TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-channel -s $sess_name \
+		$chan_name -u --output mmap --discard \
+		--subbuf-size $(getconf PAGE_SIZE) --num-subbuf 2 \
+		> /dev/null 2>&1
+
+	ok $? "Enable channel $channel_name for session $sess_name with small discard buffers"
+}
+
+function enable_mmap_small_overwrite_ust_channel ()
+{
+	local sess_name=$1
+	local chan_name=$2
+
+	$TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-channel -s $sess_name \
+		$chan_name -u --output mmap --overwrite \
+		--subbuf-size $(getconf PAGE_SIZE) --num-subbuf 2 \
+		> /dev/null 2>&1
+
+	ok $? "Enable channel $channel_name for session $sess_name with small discard buffers"
+}
 
 function test_ust_list_output ()
 {
 	output_names=("randomname" "somesnapshot")
+	NR_ITER=2000000
+	NR_USEC_WAIT=100
 
 	diag "Test UST snapshot output listing"
 	create_lttng_session_no_output $SESSION_NAME
@@ -155,6 +188,9 @@ function test_ust_list_output ()
 
 function test_ust_local_snapshot ()
 {
+	NR_ITER=2000000
+	NR_USEC_WAIT=100
+
 	diag "Test local UST snapshots"
 	create_lttng_session_no_output $SESSION_NAME
 	enable_lttng_mmap_overwrite_ust_channel $SESSION_NAME $CHANNEL_NAME
@@ -179,8 +215,100 @@ function test_ust_local_snapshot ()
 	stop_test_apps
 }
 
+function test_ust_local_snapshot_small_discard_buffers ()
+{
+	NR_ITER=10000
+	NR_USEC_WAIT=0
+	OLDCPUSET=$(taskset -p $$)
+
+	diag "Test local UST snapshots with small discard buffers"
+	taskset -p 0x1 $$ 1>/dev/null 2>&1 	# CPU 0 only
+	create_lttng_session_no_output $SESSION_NAME
+	enable_mmap_small_discard_ust_channel $SESSION_NAME $CHANNEL_NAME
+	enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME $CHANNEL_NAME
+	start_lttng_tracing_ok $SESSION_NAME
+	lttng_snapshot_add_output_ok $SESSION_NAME $TRACE_PATH
+
+	# Run test apps, wait for them to complete.
+	start_test_app
+	wait_test_apps
+
+	# Take first snapshot, remember first line.
+	lttng_snapshot_record $SESSION_NAME
+	FIRST_LINE="$(trace_first_line $TRACE_PATH/)"
+	diag "First line (1st snapshot): $FIRST_LINE"
+	rm -rf $TRACE_PATH/
+
+	# Run test apps, wait for them to complete.
+	start_test_app
+	wait_test_apps
+
+	# Take second snapshot, remember first line.
+	lttng_snapshot_record $SESSION_NAME
+	FIRST_LINE_2="$(trace_first_line $TRACE_PATH/)"
+	diag "First line (2nd snapshot): $FIRST_LINE_2"
+	rm -rf $TRACE_PATH/
+
+	if [ x"$FIRST_LINE" != x"$FIRST_LINE_2" ]; then
+		fail "First snapshot event do not match."
+	else
+		pass "First snapshot event match."
+	fi
+
+	stop_lttng_tracing_ok $SESSION_NAME
+	destroy_lttng_session_ok $SESSION_NAME
+	taskset -p $OLDCPUSET $$ 1>/dev/null 2>&1
+}
+
+function test_ust_local_snapshot_small_overwrite_buffers ()
+{
+	NR_ITER=10000
+	NR_USEC_WAIT=0
+	OLDCPUSET=$(taskset -p $$)
+
+	diag "Test local UST snapshots with small overwrite buffers"
+	taskset -p 0x1 $$ 1>/dev/null 2>&1 	# CPU 0 only
+	create_lttng_session_no_output $SESSION_NAME
+	enable_mmap_small_overwrite_ust_channel $SESSION_NAME $CHANNEL_NAME
+	enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME $CHANNEL_NAME
+	start_lttng_tracing_ok $SESSION_NAME
+	lttng_snapshot_add_output_ok $SESSION_NAME $TRACE_PATH
+
+	# Run test apps, wait for them to complete.
+	start_test_app
+	wait_test_apps
+
+	# Take first snapshot, remember first line.
+	lttng_snapshot_record $SESSION_NAME
+	FIRST_LINE="$(trace_first_line $TRACE_PATH/)"
+	diag "First line (1st snapshot): $FIRST_LINE"
+	rm -rf $TRACE_PATH/
+
+	# Run test apps, wait for them to complete.
+	start_test_app
+	wait_test_apps
+
+	# Take second snapshot, remember first line.
+	lttng_snapshot_record $SESSION_NAME
+	FIRST_LINE_2="$(trace_first_line $TRACE_PATH/)"
+	diag "First line (2nd snapshot): $FIRST_LINE_2"
+	rm -rf $TRACE_PATH/
+
+	if [ x"$FIRST_LINE" != x"$FIRST_LINE_2" ]; then
+		pass "First snapshot event do not match."
+	else
+		fail "First snapshot event match."
+	fi
+
+	stop_lttng_tracing_ok $SESSION_NAME
+	destroy_lttng_session_ok $SESSION_NAME
+	taskset -p $OLDCPUSET $$ 1>/dev/null 2>&1
+}
+
 function test_ust_local_snapshot_max_size ()
 {
+	NR_ITER=2000000
+	NR_USEC_WAIT=100
 	page_size=`getconf PAGE_SIZE`
 	num_cpus=$(conf_proc_count)
 
@@ -232,6 +360,8 @@ function test_ust_local_snapshot_max_size ()
 
 function test_ust_local_snapshot_large_metadata ()
 {
+	NR_ITER=2000000
+	NR_USEC_WAIT=100
 	LM_EVENT="tp:tptest1,tp:tptest2,tp:tptest3,tp:tptest4,tp:tptest5"
 	LM_PATH="$TESTDIR/utils/testapp"
 	LM_NAME="gen-ust-nevents"
@@ -259,6 +389,8 @@ function test_ust_local_snapshot_large_metadata ()
 
 function enable_channel_per_uid_mmap_overwrite()
 {
+	NR_ITER=2000000
+	NR_USEC_WAIT=100
 	sess_name=$1
 	channel_name=$2
 
@@ -294,6 +426,9 @@ function test_ust_per_uid_local_snapshot ()
 
 function test_ust_per_uid_local_snapshot_post_mortem ()
 {
+	NR_ITER=2000000
+	NR_USEC_WAIT=100
+
 	diag "Test local UST snapshots post-mortem"
 	create_lttng_session_no_output $SESSION_NAME
 	enable_channel_per_uid_mmap_overwrite $SESSION_NAME $CHANNEL_NAME
@@ -319,6 +454,9 @@ function test_ust_per_uid_local_snapshot_post_mortem ()
 
 function test_ust_local_snapshots ()
 {
+	NR_ITER=2000000
+	NR_USEC_WAIT=100
+
 	diag "Test $NR_SNAPSHOT local UST snapshots"
 	create_lttng_session_no_output $SESSION_NAME
 	enable_lttng_mmap_overwrite_ust_channel $SESSION_NAME $CHANNEL_NAME
@@ -351,14 +489,16 @@ plan_tests $NUM_TESTS
 print_test_banner "$TEST_DESC"
 
 start_lttng_sessiond
-
 tests=( test_ust_list_output
 	test_ust_local_snapshot
 	test_ust_local_snapshot_max_size
 	test_ust_per_uid_local_snapshot
 	test_ust_per_uid_local_snapshot_post_mortem
 	test_ust_local_snapshot_large_metadata
-	test_ust_local_snapshots)
+	test_ust_local_snapshots
+	test_ust_local_snapshot_small_discard_buffers
+	test_ust_local_snapshot_small_overwrite_buffers
+)
 
 for fct_test in ${tests[@]};
 do
-- 
2.1.4



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

end of thread, other threads:[~2016-04-20 15:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-20 15:19 [lttng-dev] [PATCH lttng-tools 0/4] Allow discard buffers in snapshot sessions Mathieu Desnoyers
2016-04-20 15:19 ` [lttng-dev] [PATCH lttng-tools 1/4] Fix: validate number of subbuffers after tweaking properties Mathieu Desnoyers
2016-04-20 15:19 ` [lttng-dev] [PATCH lttng-tools 2/4] Allow channel mode override in snapshot sessions Mathieu Desnoyers
2016-04-20 15:19 ` [lttng-dev] [PATCH lttng-tools 3/4] tests: test kernel snapshot with discard buffers Mathieu Desnoyers
2016-04-20 15:20 ` [lttng-dev] [PATCH lttng-tools 4/4] tests: test ust " Mathieu Desnoyers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox