ust_global_event_basic
gen-nevents
gen-events-time
+gen-events
benchmark/
tests/ust/Makefile
tests/ust/nevents/Makefile
tests/ust/nprocesses/Makefile
+ tests/ust/high-throughput/Makefile
])
AC_OUTPUT
'desc': "Test multiple events during tracing",
'success': 0, 'enabled': True
},
+ {
+ 'bin': "ust/high-throughput/run", 'daemon': True, 'kern': False,
+ 'name': "UST tracer - Testing high events throughput",
+ 'desc': "Test multiple large number of events with concurrent application",
+ 'success': 0, 'enabled': True
+ },
]
-SUBDIRS = nevents nprocesses
+SUBDIRS = nevents nprocesses high-throughput
AM_CFLAGS = -g -Wall -I../
AM_LDFLAGS = -lurcu -lurcu-cds
--- /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
+
+noinst_SCRIPTS = run
+EXTRA_DIST = run
--- /dev/null
+/*
+ * Copyright (C) 2009 Pierre-Marc Fournier
+ * Copyright (C) 2011 Mathieu Desnoyers <mathieu.desnoyers@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 <stdio.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <stdarg.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <string.h>
+#include <arpa/inet.h>
+#include <stdlib.h>
+
+#define TRACEPOINT_DEFINE
+#include "tp.h"
+
+void inthandler(int sig)
+{
+}
+
+int init_int_handler(void)
+{
+ int result;
+ struct sigaction act;
+
+ memset(&act, 0, sizeof(act));
+ result = sigemptyset(&act.sa_mask);
+ if (result == -1) {
+ perror("sigemptyset");
+ return -1;
+ }
+
+ act.sa_handler = inthandler;
+ act.sa_flags = SA_RESTART;
+
+ /* Only defer ourselves. Also, try to restart interrupted
+ * syscalls to disturb the traced program as little as possible.
+ */
+ result = sigaction(SIGUSR1, &act, NULL);
+ if (result == -1) {
+ perror("sigaction");
+ return -1;
+ }
+
+ return 0;
+}
+
+int main(int argc, char **argv)
+{
+ int i, netint;
+ long values[] = { 1, 2, 3 };
+ char text[10] = "test";
+ double dbl = 2.0;
+ float flt = 2222.0;
+ int delay = 0;
+
+ init_int_handler();
+
+ if (argc == 2)
+ delay = atoi(argv[1]);
+
+ sleep(delay);
+
+ for (i = 0; i < 1000000; i++) {
+ netint = htonl(i);
+ tracepoint(tp, tptest, i, netint, values, text,
+ strlen(text), dbl, flt);
+ }
+
+ return 0;
+}
--- /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/../..
+NR_ITER=20
+BIN_NAME="gen-events"
+SESSION_NAME="high-throughput"
+EVENT_NAME="tp:tptest"
+
+source $TESTDIR/utils.sh
+
+echo -e "\n-------------------------------------------"
+echo -e "UST tracer - Testing high 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
+
+for i in `seq 1 $NR_ITER`; do
+ ./$CURDIR/$BIN_NAME & >/dev/null 2>&1
+done
+
+echo "Waiting for all tracing to settle"
+sleep 5
+
+stop_tracing $SESSION_NAME
+destroy_lttng_session $SESSION_NAME
+
+stop_sessiond
+
+# Validate test
+
+TEMP_FILE=$(mktemp)
+TEMP_FILE_2=$(mktemp)
+
+traced=$(babeltrace $TRACE_PATH 2>/dev/null | wc -l)
+babeltrace $TRACE_PATH >/dev/null 2>$TEMP_FILE_2
+
+cat $TEMP_FILE_2 | cut -f4 -d " " >$TEMP_FILE
+
+dropped=0
+while read line;
+do
+ let dropped=$dropped+$line
+done < $TEMP_FILE
+
+let total=$dropped+$traced
+let wanted=$NR_ITER*1000000
+
+if [ $wanted -ne $total ]; then
+ echo -n "Expected $wanted. Dropped $dropped. Recorded $traced. Total $total... "
+ echo -e "\e[1;31mFAILED\e[0m"
+ out=1
+else
+ echo -n "Expected $wanted. Dropped $dropped. Recorded $traced. Total $total... "
+ echo -e "\e[1;32mOK\e[0m"
+ out=0
+fi
+
+rm -rf $TRACE_PATH
+rm $TEMP_FILE $TEMP_FILE_2
+
+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, tptest,
+ TP_ARGS(int, anint, int, netint, long *, values,
+ char *, text, size_t, textlen, double, doublearg, float, floatarg),
+ TP_FIELDS(
+ ctf_integer(int, intfield, anint)
+ ctf_integer_hex(int, intfield2, anint)
+ ctf_integer(long, longfield, anint)
+ ctf_integer_network(int, netintfield, netint)
+ ctf_integer_network_hex(int, netintfieldhex, netint)
+ ctf_array(long, arrfield1, values, 3)
+ ctf_array_text(char, arrfield2, text, 10)
+ ctf_sequence(char, seqfield1, text, size_t, textlen)
+ ctf_sequence_text(char, seqfield2, text, size_t, textlen)
+ ctf_string(stringfield, text)
+ ctf_float(float, floatfield, floatarg)
+ ctf_float(double, doublefield, doublearg)
+ )
+)
+
+TRACEPOINT_EVENT(tp, tptest_sighandler,
+ TP_ARGS(),
+ TP_FIELDS()
+)
+
+#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
DIR=$(dirname $0)
-tests=( $DIR/run-ust-global-tests.sh $DIR/nevents/run $DIR/nprocesses/run )
+tests=( $DIR/run-ust-global-tests.sh $DIR/nevents/run $DIR/nprocesses/run \
+ $DIR/high-throughput/run )
exit_code=0
function start_tests ()