Replaced the multi-blaster skeleton with real functionality. multi-blaster functions...
authorJan Medved <jmedved@cisco.com>
Sun, 30 Nov 2014 03:54:35 +0000 (19:54 -0800)
committerJan Medved <jmedved@cisco.com>
Sun, 30 Nov 2014 03:56:03 +0000 (19:56 -0800)
Change-Id: I2209a8bf86f3c26930a4f5a126356917ae0548e7
Signed-off-by: Jan Medved <jmedved@cisco.com>
test/tools/odl-mdsal-clustering-tests/clustering-performance-test/multi-blaster.sh

index f4296a1c93dfe2c8e433cc9a2dee1abefd6f5956..0b8dc1b586837d020b64f9cb10b4e306b09fbce1 100755 (executable)
@@ -1,18 +1,86 @@
-#!/usr/bin/env bash
+#!/bin/bash
 
-echo "Starting Blaster 1:"
-./flow_config_blaster.py  --flows=1000 --threads=5 --auth --no-delete &
+# author__ = "Jan Medved"
+# copyright__ = "Copyright(c) 2014, Cisco Systems, Inc."
+# license__ = "New-style BSD"
+# email__ = "jmedved@cisco.com"
 
-echo "Starting Blaster 2:"
-./flow_config_blaster.py  --flows=1000 --threads=5 --auth --no-delete --startflow=5000 &
+CMD="./flow_config_blaster.py"
+programname=$0
 
-echo "Starting Blaster 3:"
-./flow_config_blaster.py  --flows=1000 --threads=5 --auth --no-delete --startflow=10000 &
+function usage {
+    echo "usage: $programname [-h?an] [-i instances] [-c cycles] [-f flows] [- threads]"
+    echo "     -h|?          print this message"
+    echo "     -a            use default authentication ('admin/admin')"
+    echo "     -n            use the 'no-delete' flag in '$CMD'"
+    echo "     -i instances  number of '$CMD' instances to spawn"
+    echo "     -c cycles     number of cycles in '$CMD'"
+    echo "     -f flows      number of flows in '$CMD'"
+    echo "     -t threads    number of threads in '$CMD'"
+}
 
-echo "Starting Blaster 4:"
-./flow_config_blaster.py  --flows=1000 --threads=5 --auth --no-delete --startflow=15000 &
+# Initialize our own variables:
 
-echo "Starting Blaster 5:"
-./flow_config_blaster.py  --flows=1000 --threads=5 --auth --no-delete --startflow=20000 &
+instances=1
+no_delete=false
+auth=false
+threads=1
+flows=1000
+cycles=1
 
+while getopts "h?ac:f:i:nt:" opt; do
+    case "$opt" in
+    h|\?)
+        usage
+        exit 1
+        ;;
+    a)  auth=true
+        ;;
+    c)  cycles=$OPTARG
+        ;;
+    f)  flows=$OPTARG
+        ;;
+    i)  instances=$OPTARG
+        ;;
+    n)  no_delete=true
+        ;;
+    t)  threads=$OPTARG
+        ;;
+    esac
+done
+
+echo "Running $instances instance(s), parameters:\n  flows='flows', threads=$threads, cycles=$cycles, \
+no-delete='$no_delete', auth='$auth'"
+
+
+let "flows_per_instance=$cycles * $flows * $threads"
+
+printf "FPI: %d\n" $flows_per_instance
+
+i=0
+START_TIME=$SECONDS
+while [  $i -lt $instances ]; do
+    let "startflow=$flows_per_instance * $i"
+
+    CMD_STRING=$(printf '%s --cycles %s --flows %s --threads %s --startflow %s' $CMD $cycles $flows $threads $startflow)
+    if [ "$auth" = true ] ; then
+        CMD_STRING+=' --auth'
+    fi
+    if [ "$no_delete" = true ] ; then
+        CMD_STRING+=' --no-delete'
+    fi
+
+    echo "Starting instance $i: '$CMD_STRING'"
+    let i=$i+1
+    $CMD_STRING &
+done
+
+wait
+ELAPSED_TIME=$(($SECONDS - $START_TIME))
+
+let "rate=($flows_per_instance * $instances)/$ELAPSED_TIME"
 echo "Done."
+echo "Measured rate: $rate"
+echo "Measured time: $ELAPSED_TIME"
+
+# End of file