Test during 20 minutes events at each minute, 10 minutes and 20 minutes.
It validates the event order with an incremental counter.
Signed-off-by: David Goulet <dgoulet@efficios.com>
tests/ust/nevents/Makefile
tests/ust/nprocesses/Makefile
tests/ust/high-throughput/Makefile
+ tests/ust/low-throughput/Makefile
])
AC_OUTPUT
'desc': "Test multiple large number of events with concurrent application",
'success': 0, 'enabled': True
},
+ {
+ 'bin': "ust/low-throughput/run", 'daemon': True, 'kern': False,
+ 'name': "UST tracer - Testing high events throughput",
+ 'desc': "Test low throughput of events",
+ 'success': 0, 'enabled': False
+ # Deactivated. This test last 20 minutes...
+ },
]
--- /dev/null
+AM_CFLAGS = -I. -O2
+AM_LDFLAGS = -llttng-ust
+
+if LTTNG_TOOLS_BUILD_WITH_LIBDL
+AM_LDFLAGS += -ldl
+endif
+if LTTNG_TOOLS_BUILD_WITH_LIBC_DL
+AM_LDFLAGS += -lc
+endif
+
+noinst_PROGRAMS = gen-events
+gen_events_SOURCES = main.c tp.c tp.h
+gen_events_LDADD = -llttng-ust -lurcu
+
+noinst_SCRIPTS = run
+EXTRA_DIST = run
--- /dev/null
+/*
+ * Copyright (C) 2012 - David Goulet <dgoulet@efficios.com>
+ *
+ * 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
+ */
+
+#include <poll.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#define TRACEPOINT_DEFINE
+#include "tp.h"
+
+/*
+ * Thread recording a tracepoint every minute for 20 minutes.
+ */
+static void *th_event_minute(void *data)
+{
+ int i;
+
+ /* Loop for 20 minutes */
+ for (i = 1; i < 21; i++) {
+ /* Sleep 60 seconds */
+ poll(NULL, 0, 60000);
+
+ /* 20 minutes tracepoint */
+ if ((i % 20) == 0) {
+ tracepoint(tp, slow, i, "twenty");
+ printf("Twenty: %d\n", i);
+ }
+
+ /* 10 minutes tracepoint */
+ if ((i % 10) == 0) {
+ tracepoint(tp, slow, i, "ten");
+ printf("Ten: %d\n", i);
+ }
+
+ /* 1 minute tracepoint */
+ tracepoint(tp, slow, i, "one");
+ printf("One: %d\n", i);
+ }
+
+ return NULL;
+}
+
+/*
+ * main
+ */
+int main(int argc, char **argv)
+{
+ int ret;
+ void *status;
+ pthread_t thread;
+
+ ret = pthread_create(&thread, NULL, th_event_minute, NULL);
+ if (ret != 0) {
+ perror("pthread_create event minute");
+ goto error;
+ }
+
+ ret = pthread_join(thread, &status);
+ if (ret != 0) {
+ perror("pthread_join");
+ goto error;
+ }
+
+ return 0;
+
+error:
+ return 1;
+}
--- /dev/null
+#!/bin/bash
+#
+# Copyright (C) - 2012 David Goulet <dgoulet@efficios.com>
+#
+# 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
+
+CURDIR=$(dirname $0)/
+TESTDIR=$CURDIR/../..
+BIN_NAME="gen-events"
+SESSION_NAME="low-throughput"
+EVENT_NAME="tp:slow"
+
+source $TESTDIR/utils.sh
+
+echo -e "\n-------------------------------------------"
+echo -e "UST tracer - Testing low events throughput"
+echo -e "-------------------------------------------"
+
+if [ ! -e "$CURDIR/$BIN_NAME" ]; then
+ echo -e "No UST nevents binary detected. Passing."
+ exit 0
+fi
+
+TRACE_PATH=$(mktemp -d)
+
+# MUST set TESTDIR before calling those functions
+
+start_sessiond
+
+create_lttng_session $SESSION_NAME $TRACE_PATH
+
+enable_ust_lttng_event $SESSION_NAME $EVENT_NAME
+start_tracing $SESSION_NAME
+
+# This is going to take 20 minutes
+./$CURDIR/$BIN_NAME >/dev/null 2>&1
+
+stop_tracing $SESSION_NAME
+destroy_lttng_session $SESSION_NAME
+
+stop_sessiond
+
+# Validate test
+
+last_val=0
+out=0
+
+babeltrace $TRACE_PATH | while read event;
+do
+ val=$(echo $event | cut -f10 -d" ")
+ val=${val%?}
+ th=$(echo $event | cut -f13 -d " ")
+
+ if [ $th = '"one"' ]; then
+ ((last_val++))
+ # We expect here a continous value from 1 to 20
+ if [ $last_val -ne $val ]; then
+ echo -n "[-] One minute event failed ($val) "
+ out=1
+ break
+ fi
+ elif [ $th = '"ten"' ]; then
+ # Test 10 minutes counter
+ if [ $val -ne 10 ]; then
+ # Test 20 minutes counter
+ if [ $val -ne 20 ]; then
+ echo -n "[-] Ten minutes event failed ($val) "
+ out=1
+ break
+ fi
+ fi
+ elif [ $th = '"twenty"' ]; then
+ # Test 20 minutes counter
+ if [ $val -ne 20 ]; then
+ echo -n "[-] Twenty minutes event failed ($val) "
+ out=1
+ break
+ fi
+ fi
+done
+
+if [ $out -eq 0 ]; then
+ echo -n "Trace is coherent... "
+ echo -e "\e[1;32mOK\e[0m"
+else
+ echo -e "\e[1;31mFAILED\e[0m"
+fi
+
+rm -rf $TRACE_PATH
+
+exit $out
--- /dev/null
+/*
+ * tp.c
+ *
+ * Copyright (c) 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ */
+
+#define TRACEPOINT_CREATE_PROBES
+#include "tp.h"
--- /dev/null
+#undef TRACEPOINT_PROVIDER
+#define TRACEPOINT_PROVIDER tp
+
+#if !defined(_TRACEPOINT_TP_H) || defined(TRACEPOINT_HEADER_MULTI_READ)
+#define _TRACEPOINT_TP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Copyright (C) 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ */
+
+#include <lttng/tracepoint.h>
+
+TRACEPOINT_EVENT(tp, slow,
+ TP_ARGS(unsigned int, c, char *, thread_name),
+ TP_FIELDS(
+ ctf_integer(unsigned int, counter, c)
+ ctf_string(th_name, thread_name)
+ )
+)
+
+#endif /* _TRACEPOINT_TP_H */
+
+#undef TRACEPOINT_INCLUDE_FILE
+#define TRACEPOINT_INCLUDE_FILE ./tp.h
+
+/* This part must be outside ifdef protection */
+#include <lttng/tracepoint-event.h>
+
+#ifdef __cplusplus
+}
+#endif
tests=( $DIR/run-ust-global-tests.sh $DIR/nevents/run $DIR/nprocesses/run \
$DIR/high-throughput/run )
+
+# $DIR/low-throughput/run --> DEACTIVATED.
+# Use only for release. This test last 20 minutes
+
exit_code=0
function start_tests ()