Fix: make lttng expand path for trace output opt
[lttng-tools.git] / tests / ust / high-throughput / run
1 #!/bin/bash
2 #
3 # Copyright (C) - 2012 David Goulet <dgoulet@efficios.com>
4 #
5 # This library is free software; you can redistribute it and/or modify it under
6 # the terms of the GNU Lesser General Public License as published by the Free
7 # Software Foundation; version 2.1 of the License.
8 #
9 # This library is distributed in the hope that it will be useful, but WITHOUT
10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12 # details.
13 #
14 # You should have received a copy of the GNU Lesser General Public License
15 # along with this library; if not, write to the Free Software Foundation, Inc.,
16 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
18 CURDIR=$(dirname $0)/
19 TESTDIR=$CURDIR/../..
20 NR_ITER=20
21 BIN_NAME="gen-events"
22 SESSION_NAME="high-throughput"
23 EVENT_NAME="tp:tptest"
24
25 source $TESTDIR/utils.sh
26
27 echo -e "\n-------------------------------------------"
28 echo -e "UST tracer - Testing high events throughput"
29 echo -e "-------------------------------------------"
30
31 if [ ! -x "$CURDIR/$BIN_NAME" ]; then
32 echo -e "No UST nevents binary detected. Passing."
33 exit 0
34 fi
35
36 TRACE_PATH=$(mktemp -d)
37
38 # MUST set TESTDIR before calling those functions
39
40 start_sessiond
41
42 create_lttng_session $SESSION_NAME $TRACE_PATH
43
44 enable_ust_lttng_event $SESSION_NAME $EVENT_NAME
45 start_tracing $SESSION_NAME
46
47 for i in `seq 1 $NR_ITER`; do
48 ./$CURDIR/$BIN_NAME & >/dev/null 2>&1
49 done
50
51 echo "Waiting for all tracing to settle"
52 sleep 5
53
54 stop_tracing $SESSION_NAME
55 destroy_lttng_session $SESSION_NAME
56
57 stop_sessiond
58
59 # Validate test
60
61 TEMP_FILE=$(mktemp)
62 TEMP_FILE_2=$(mktemp)
63
64 traced=$(babeltrace $TRACE_PATH 2>/dev/null | wc -l)
65 babeltrace $TRACE_PATH >/dev/null 2>$TEMP_FILE_2
66
67 cat $TEMP_FILE_2 | cut -f4 -d " " >$TEMP_FILE
68
69 dropped=0
70 while read line;
71 do
72 let dropped=$dropped+$line
73 done < $TEMP_FILE
74
75 let total=$dropped+$traced
76 let wanted=$NR_ITER*1000000
77
78 if [ $wanted -ne $total ]; then
79 echo -n "Expected $wanted. Dropped $dropped. Recorded $traced. Total $total... "
80 echo -e "\e[1;31mFAILED\e[0m"
81 out=1
82 else
83 echo -n "Expected $wanted. Dropped $dropped. Recorded $traced. Total $total... "
84 echo -e "\e[1;32mOK\e[0m"
85 out=0
86 fi
87
88 rm -rf $TRACE_PATH
89 rm $TEMP_FILE $TEMP_FILE_2
90
91 exit $out
This page took 0.030691 seconds and 4 git commands to generate.