aboutsummaryrefslogtreecommitdiffstats
path: root/lib/megaco/examples/meas/mstone1.sh.skel.src
blob: 088739f88b2440241dd0c2d4da263fa24dd0edb7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
#!/bin/sh

#
# %CopyrightBegin%
# 
# Copyright Ericsson AB 2007-2012. All Rights Reserved.
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# 
# %CopyrightEnd%

# Skeleton for a script intended to run the mstone1(N) 
# performance test.
#

# Get the name of the program
program=`echo $0 | sed 's#.*/##g'`

usage="\
Usage: $program [options]

This shell script is used to run the mstone 1 (factor) performance 
test. It is not intended to test the megaco stack but instead to 
give a \"performance value\" of the host on which it is run.

Options:
 -help                  display this help and exit.
 -mp <message package>  message package to use for test
                        default is time_test
 -h <num>               default process heap size
 -a <num>               async thread pool size (default is 0)
 -f <factor>            normally the test is run with 16 processes 
                        (factor 1), one for each codec config. The test 
                        can however be run with other factors, e.g. 
                        factor 10 means that 10 processes will be started 
                        for each megaco codec config.
                        The options -s and -f cannot both be present.
 -s <num sched>         normally the test is run with a fixed factor,
                        but if this option is given, the number of
                        schedulers is fixed (to the value set by this option)
                        and the factor is the variable.
                        The options -s and -f cannot both be present.
 -d <drv-mode>          driver mode for the test:
                        std  - all codec config(s) will be used
                        flex - only the text codec config(s) utilizing the 
                               flex scanner will be used
                        nd   - only codec config(s) without drivers will be used
                        od   - only codec config(s) with drivers will be used
 -sbt <bind-type>       Set scheduler bind type. See erl man page for more info.
                        tnnps - Thread no node processor spread (default)
                        u     - Unbound
                        ns    - No spread
                        ts    - Thread spread
                        ps    - Processor spread
                        s     - Spread
                        nnts  - No node thread spread
                        nnps  - No node processor spread
 --                     everything after this is just passed on to erl.
"

ERL_HOME=<path to otp top dir>
MEGACO_HOME=$ERL_HOME/lib/erlang/lib/megaco-%VSN%
MEAS_HOME=$MEGACO_HOME/examples/meas
PATH=$ERL_HOME/bin:$PATH

MODULE=megaco_codec_mstone1
STARTF="start"
FACTOR=""
MSG_PACK=time_test
SBT="+sbt tnnps"

while test $# != 0; do
    # echo "DBG: Value = $1"
    case  $1 in
        -help)
            echo "$usage" ;
            exit 0;;

        -mp)
            MSG_PACK="$2";
            shift ; shift ;;

        -h)
            PHS="+h $2";
            shift ; shift ;;

        -a)
            ATP="+A $2";
            shift ; shift ;;

        -d)
	    case $2 in
		std)
		    STARTF="start";
		    shift ; shift ;;
		flex)
		    STARTF="start_flex";
		    shift ; shift ;;
		nd)
		    STARTF="start_no_drv";
		    shift ; shift ;;
		od)
		    STARTF="start_only_drv";
		    shift ; shift ;;
		*)
		    echo "unknown driver mode: $2";
		    echo "$usage" ;
		    exit 0
	    esac;;
	    
        -sbt)
	    case $2 in
		tnnps|u|ns|ts|ps|s|nnts|nnps)
		    SBT="+sbt $2";
		    shift ; shift ;;
		*)
		    echo "unknown scheduler bind type: $2";
		    echo "$usage" ;
		    exit 0
	    esac;;
	    
        -f)
            if [ "x$SCHED" != "x" ]; then
                echo "option(s) -s and -f cannot both be given" ;
                echo "$usage" ;
                exit 0
            fi
            FACTOR="$2";
            TYPE=factor;
            shift ; shift ;;

        -s)
            if [ "x$FACTOR" != "x" ]; then
                echo "option(s) -f and -s cannot both be given" ;
                echo "$usage" ;
                exit 0
            fi
            SCHED="$2";
            TYPE=sched;
            shift ; shift ;;

        --)
            shift ;
            break;;

        *)
            echo "unknown option: $1";
            echo "$usage" ;
            exit 0
    esac
done

if [ $TYPE = factor ]; then

    MSTONE="-s $MODULE $STARTF $MSG_PACK $FACTOR"

    # SCHEDS="no_smp 01 02 04"
    # SCHEDS="no_smp 01 02 04 08"
    # SCHEDS="no_smp 01 02 04 08 16"
    # SCHEDS="no_smp 01 02 04 08 16 32"
    # SCHEDS="no_smp 01 02 04 08 16 32 64"
    SCHEDS="no_smp 01 02 03 04 05 06 07 08"

    for i in `echo $SCHEDS`; do
        case $i in
            no_smp)
                SMP_INFO="No SMP"
                SMP_OPTS="-smp disable" # THIS IS THE R12B WAY TO DISABLE SMP
                LOG="mstone1-f$FACTOR-s00.log"
                ;;

            01)
                SMP_INFO="SMP: 1 scheduler"
                SMP_OPTS="-smp +S $i"
                LOG="mstone1-f$FACTOR-s$i.log"
                ;;

            *)
                SMP_INFO="SMP: $i schedulers"
                SMP_OPTS="-smp +S $i"
                LOG="mstone1-f$FACTOR-s$i.log"
                ;;
        esac

        echo ""
        echo "---------------------------------------------"
        echo "$SMP_INFO"
        echo ""

        ERL="erl \
          -noshell \
          $SBT \
          $PHS \
          $ATP \
          $SMP_OPTS \
          -pa $MEAS_HOME \
          $MSTONE \
          $* \
          -s init stop"

        echo $ERL
        $ERL | tee $LOG
    done

elif [ $TYPE = sched ]; then

    MSTONE="-s $MODULE $STARTF $MSG_PACK"

    # FACTORS="01 02 03 04"
    # FACTORS="01 02 03 04 05 06 07 08 09 10"
    FACTORS="01 02 04 08 16 32"
    # FACTORS="001 010 100"

    case $SCHED in
        no_smp)
            SMP_OPTS="-smp disable" # THIS IS THE R12B WAY TO DISABLE SMP
            ;;

        *)
            SMP_OPTS="-smp +S $SCHED"
            ;;
    esac

    for i in `echo $FACTORS`; do
        LOG="mstone1-s$SCHED-f$i.log"

        echo ""
        echo "---------------------------------------------"
        echo "Factor $i"
        echo ""

        ERL="erl \
          -noshell \
          $SBT \
          $PHS \
          $ATP \
          $SMP_OPTS \
          -pa $MEAS_HOME \
          $MSTONE $i \
          $* \
          -s init stop"

        echo $ERL
        $ERL | tee $LOG
    done


else
    echo "Either option -f or -s must be specified"
    echo "$usage" ;
    exit 0
    
fi