Commit | Line | Data |
---|---|---|
605ac758 DG |
1 | #!/bin/bash |
2 | # | |
9d16b343 | 3 | # Copyright (C) 2013 David Goulet <dgoulet@efficios.com> |
605ac758 | 4 | # |
9d16b343 | 5 | # SPDX-License-Identifier: LGPL-2.1-only |
605ac758 | 6 | # |
605ac758 DG |
7 | |
8 | CURDIR=$(dirname $0)/ | |
9 | TESTDIR=$CURDIR/.. | |
10 | ||
11 | NR_APP=1 | |
12 | NR_USEC_WAIT=5000000 | |
13 | NR_APP_LOOP=1 | |
14 | ||
15 | TESTAPP_PATH="$TESTDIR/utils/testapp" | |
16 | TESTAPP_NAME="gen-ust-events" | |
17 | TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME" | |
18 | ||
19 | source $TESTDIR/utils/utils.sh | |
20 | ||
21 | if [ ! -x "$TESTAPP_BIN" ]; then | |
22 | BAIL_OUT "No UST nevents binary detected." | |
23 | fi | |
24 | ||
25 | # Number of application to spawn. | |
26 | if [ -n "$1" ]; then | |
27 | NR_APP=$1 | |
28 | fi | |
29 | ||
30 | # Number of seconds before the next loop is done in the app. | |
31 | if [ -n "$2" ]; then | |
32 | NR_USEC_WAIT=$(echo $(( $2 * 1000000 ))) | |
33 | fi | |
34 | ||
35 | # Number of loop the application should do meaning one TP is hit per loop. | |
36 | if [ -n "$3" ]; then | |
37 | NR_APP_LOOP=$3 | |
38 | fi | |
39 | ||
40 | # MUST set TESTDIR before this point. | |
41 | ||
42 | # Infinite loop. Spawns NR_APP apps for NR_USEC_WAIT doing NR_APP_LOOP. | |
43 | while :; do | |
44 | for j in `seq 1 $NR_APP`; do | |
6c4a91d6 | 45 | $TESTAPP_BIN -i $NR_APP_LOOP -w $NR_USEC_WAIT >/dev/null 2>&1 & |
605ac758 DG |
46 | done |
47 | # Wait before the next round of applications. | |
48 | sleep 3 | |
49 | done |