analyse.sh #3

  • //
  • guest/
  • robert_cowham/
  • p4benchmark/
  • pb/
  • analyse.sh
  • View
  • Commits
  • Open Download .zip Download (2 KB)
#!/bin/bash

function bail () { echo "\nError: ${1:-Unknown Error}\n"; exit ${2:-1}; }

# Analyse using next available directory
#runid=${1:-Unset}
#[[ $runid == "Unset" ]] && bail "Specify runid as parameter"

last_run=$(ls run/ | sort -n | tail -1)
runid=$((last_run+1))  
rundir=run/$runid
echo "Creating $rundir"

# copy client logs just in case useful
echo "Copying logs..."
ansible-playbook -i hosts ansible/copy_logs.yml > /dev/null

# For replicas
ansible-playbook -i hosts ansible/copy_monitor_logs.yml
ansible-playbook -i hosts ansible/stop_monitoring.yml

mkdir $rundir
config_file=$(ls -tr config_p4_* | tail -1)
pushd $rundir
cp ../../$config_file .

p4port=`grep 666 $config_file | head -1 | sed -e 's/\s*port:\s*//' | sed -e 's/ \- //'`
p4user=`grep user $config_file | sed -e 's/\s*user:\s*//'`
p4="p4 -p $p4port -u $p4user "

port=`echo "$p4port" | cut -d: -f2`
instance=${port:0:1}

cp ../../nethogs.out .
[[ -e ../../ps.out ]] && mv ../../ps.out .
[[ -e ../../network.out ]] && mv ../../network.out .
kill $(pgrep run_top)
cp ../../logs/*slave* .

# Record sizes of clients
$p4 clients -e bruno* |cut -d " " -f 2| while read c; do $p4 -c $c sizes -sh //$c/... >> client_sizes.txt; done

echo $p4 configure show > config.out
$p4 configure show > config.out
sudo ls -l /p4/$instance/ >> config.out

# Get logs from server instance(s)
sudo mv /p4/$instance/logs/log .
for h in sn1-r720-a02-13 sn1-r720-a02-15 sn1-r720-a02-17 sn1-r720-a02-19
do
  scp $h:/p4/$instance/logs/log $h-edge.log
  ssh $h mv /p4/$instance/logs/log /p4/$instance/logs/log.old
done

# Analyse logs into sql db
~/bin/log2sql.py -d run log
for h in sn1-r720-a02-13 sn1-r720-a02-15 sn1-r720-a02-17 sn1-r720-a02-19
do
  [[ -e $h-edge.log ]] && ~/bin/log2sql.py -d run $h-edge.log
done

popd
./sqlreport.sh $rundir

# Change User Description Committed
#8 25669 Robert Cowham Refactored - move scripts to utils dir
#7 25521 Robert Cowham Install net-tools to get ifconfig.
Expand explanation
#6 25519 Robert Cowham Basically working
#5 25449 Robert Cowham Latest updates.
Record changes
#4 25448 Robert Cowham Tweak reporting for phases
#3 25354 Robert Cowham Working with multiple edges
#2 25353 Robert Cowham Monitor network at beginning and end of benchmark
#1 25346 Robert Cowham Populate //stream/pure.