Refactor: test: wrapper for destroy_lttng_session
[lttng-tools.git] / tests / stress / launch_ust_app
CommitLineData
605ac758
DG
1#!/bin/bash
2#
3# Copyright (C) - 2013 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/..
20
21NR_APP=1
22NR_USEC_WAIT=5000000
23NR_APP_LOOP=1
24
25TESTAPP_PATH="$TESTDIR/utils/testapp"
26TESTAPP_NAME="gen-ust-events"
27TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
28
29source $TESTDIR/utils/utils.sh
30
31if [ ! -x "$TESTAPP_BIN" ]; then
32 BAIL_OUT "No UST nevents binary detected."
33fi
34
35# Number of application to spawn.
36if [ -n "$1" ]; then
37 NR_APP=$1
38fi
39
40# Number of seconds before the next loop is done in the app.
41if [ -n "$2" ]; then
42 NR_USEC_WAIT=$(echo $(( $2 * 1000000 )))
43fi
44
45# Number of loop the application should do meaning one TP is hit per loop.
46if [ -n "$3" ]; then
47 NR_APP_LOOP=$3
48fi
49
50# MUST set TESTDIR before this point.
51
52# Infinite loop. Spawns NR_APP apps for NR_USEC_WAIT doing NR_APP_LOOP.
53while :; do
54 for j in `seq 1 $NR_APP`; do
55 $TESTAPP_BIN $NR_APP_LOOP $NR_USEC_WAIT >/dev/null 2>&1 &
56 done
57 # Wait before the next round of applications.
58 sleep 3
59done
This page took 0.037283 seconds and 4 git commands to generate.