Wait for all apps in high-throughput test
[lttng-tools.git] / tests / ust / high-throughput / run
CommitLineData
e72d66a6
DG
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
18CURDIR=$(dirname $0)/
19TESTDIR=$CURDIR/../..
20NR_ITER=20
21BIN_NAME="gen-events"
22SESSION_NAME="high-throughput"
23EVENT_NAME="tp:tptest"
24
25source $TESTDIR/utils.sh
26
27echo -e "\n-------------------------------------------"
28echo -e "UST tracer - Testing high events throughput"
29echo -e "-------------------------------------------"
30
8acbe07d 31if [ ! -x "$CURDIR/$BIN_NAME" ]; then
e72d66a6
DG
32 echo -e "No UST nevents binary detected. Passing."
33 exit 0
34fi
35
36TRACE_PATH=$(mktemp -d)
37
38# MUST set TESTDIR before calling those functions
39
40start_sessiond
41
42create_lttng_session $SESSION_NAME $TRACE_PATH
43
44enable_ust_lttng_event $SESSION_NAME $EVENT_NAME
45start_tracing $SESSION_NAME
46
47for i in `seq 1 $NR_ITER`; do
48 ./$CURDIR/$BIN_NAME & >/dev/null 2>&1
49done
50
908ee7bd
DG
51echo "Waiting for applications to end"
52while [ -n "$(pidof $BIN_NAME)" ]; do
53 echo -n "."
54 sleep 0.5
55done
56echo ""
e72d66a6
DG
57
58stop_tracing $SESSION_NAME
59destroy_lttng_session $SESSION_NAME
60
61stop_sessiond
62
63# Validate test
64
65TEMP_FILE=$(mktemp)
66TEMP_FILE_2=$(mktemp)
67
68traced=$(babeltrace $TRACE_PATH 2>/dev/null | wc -l)
69babeltrace $TRACE_PATH >/dev/null 2>$TEMP_FILE_2
70
71cat $TEMP_FILE_2 | cut -f4 -d " " >$TEMP_FILE
72
73dropped=0
74while read line;
75do
76 let dropped=$dropped+$line
77done < $TEMP_FILE
78
79let total=$dropped+$traced
80let wanted=$NR_ITER*1000000
81
82if [ $wanted -ne $total ]; then
83 echo -n "Expected $wanted. Dropped $dropped. Recorded $traced. Total $total... "
84 echo -e "\e[1;31mFAILED\e[0m"
85 out=1
86else
87 echo -n "Expected $wanted. Dropped $dropped. Recorded $traced. Total $total... "
88 echo -e "\e[1;32mOK\e[0m"
89 out=0
90fi
91
92rm -rf $TRACE_PATH
93rm $TEMP_FILE $TEMP_FILE_2
94
95exit $out
This page took 0.027564 seconds and 4 git commands to generate.