Megatest

Check-in [5ded10a6e8]
Login
Overview
Comment:Improved loadrunner
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.55
Files: files | file ages | folders
SHA1: 5ded10a6e83655147e453a0b66dddf6a3e83ef43
User & Date: mrwellan on 2014-06-17 22:54:05
Other Links: branch diff | manifest | tags
Context
2014-06-18
00:19
Increased the delay in loadrunner to hopefully minimize overshoot check-in: 21daa4826c user: matt tags: v1.55
2014-06-17
22:54
Improved loadrunner check-in: 5ded10a6e8 user: mrwellan tags: v1.55
17:08
Improved build makefile check-in: da1fdc017f user: matt tags: v1.55
Changes

tests/installall/config/megatest.config.dat became a symlink with target [736a5da885].

tests/installall/config/runconfigs.config.dat became a symlink with target [3b8f260acb].

Modified utils/loadrunner from [3fad28f85d] to [b02c49d790].

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



#!/bin/bash 



# load=`uptime|awk '{print $10}'|cut -d, -f1`
load=`uptime|perl -pe 's/.*: (\d+.\d+),.*/$1/'`



if which cpucheck > /dev/null;then
    numcpu=`cpucheck|tail -1|awk '{print $6}'`
elif which lscpu > /dev/null;then
    numcpu=`lscpu|grep "CPU.s.:"|awk '{print $2}'`
else
    numcpu=2
fi

# NB// max_load is in units of percent.
#
lperc=`echo "100 * $load / $numcpu"|bc`

if [[ "x$MAX_ALLOWED_LOAD" == "x" ]]; then
  max_load=100
else
  max_load=$MAX_ALLOWED_LOAD
fi




if [[  $lperc -lt $max_load ]];then

  echo "Load acceptable: lperc=$lperc %, max_load=$max_load %, load=$load, numcpu=$numcpu, MAX_ALLOWED_LOAD=$MAX_ALLOWED_LOAD %"
  echo "Starting command: \"$@\""
  nbfake "$@"
else




  # echo "Load too high: lperc=$lperc, max_load=$max_load, waiting two minutes before trying to run command: \"$@\""
  echo "loadrunner $@" | at now + 2 minutes 2> /dev/null
fi





>
>

|
>
>
>










|
>






>
>
>

>
|
|
|
|
>
>
>
>

|

>
>
>
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
#!/bin/bash 

LOADRUNNER=$0

# load=`uptime|awk '{print $10}'|cut -d, -f1`
load=$(uptime|perl -pe 's/.*: (\d+.\d+),.*/$1/')
load2=$(uptime|perl -pe 's/.*: (\d+.\d+), (\d+.\d+),.*/$2/')
# echo "load2=$load2, load=$load"

if which cpucheck > /dev/null;then
    numcpu=`cpucheck|tail -1|awk '{print $6}'`
elif which lscpu > /dev/null;then
    numcpu=`lscpu|grep "CPU.s.:"|awk '{print $2}'`
else
    numcpu=2
fi

# NB// max_load is in units of percent.
#
lperc=$(echo "100 * $load / $numcpu"|bc)
lperc2=$(echo "100 * $load2 / $numcpu"|bc)
if [[ "x$MAX_ALLOWED_LOAD" == "x" ]]; then
  max_load=100
else
  max_load=$MAX_ALLOWED_LOAD
fi

lfile=/tmp/loadrunner-$USER.lockfile
lockfile -r 2 -l 20 $lfile

if [[  $lperc -lt $max_load ]];then
  if [[ $lperc -ge $lperc2 ]];then
    echo "Load acceptable: lperc=$lperc %, max_load=$max_load %, load=$load, numcpu=$numcpu, MAX_ALLOWED_LOAD=$MAX_ALLOWED_LOAD % and $lperc2 < $lperc"
    echo "Starting command: \"$@\""
    nbfake "$@"
  else
   rm -f $lfile
    echo "$LOADRUNNER $@" | at now + 2 minutes 2> /dev/null
  fi
else
  # echo "Load too high: lperc=$lperc, max_load=$max_load, waiting two minutes before trying to run command: \"$@\""
  echo "$LOADRUNNER $@" | at now + 2 minutes 2> /dev/null
fi

sleep 1
rm -f $lfile