analyse.sh #15

  • //
  • guest/
  • robert_cowham/
  • p4benchmark/
  • main/
  • analyse.sh
  • View
  • Commits
  • Open Download .zip Download (3 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
origdir=`pwd`
echo "Creating $rundir"

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

# For edge servers this might be useful
# 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 $origdir/$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}

[[ $instance -gt 0 && $instance -lt 10 ]] || bail "can't find instance"

# Set to a list of edge servers to poll for logs
# edges="sn1-r720-a02-15 sn1-r720-a02-17 sn1-r720-a02-19"
edges=""

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

# 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
for h in $edges
do
  ep4="p4 -p $h:${instance}666 -u $p4user"
  $ep4 clients -e bruno* |cut -d " " -f 2| while read c; do $ep4 -c $c sizes -sh //$c/... >> client_sizes-$h.txt; done
done

echo $p4 configure show > config.out
$p4 configure show > config.out
sudo ls -l /p4/$instance/ >> config.out
grep numActions $origdir/locust_files/p4benchutils.py >> config.out

# record number of submitted changes
start_chg=$(cat change_counter.out)
end_chg=$($p4 changes -ssubmitted -m1 | cut -d" " -f2)
chgs=$($p4 changes "@>$start_chg" | wc -l)
echo "Submitted change start $start_chg end $end_chg" > changes.out
echo "Count: $chgs" >> changes.out

# Get logs from server instance(s)
sudo mv /p4/$instance/logs/log .
for h in $edges
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 $edges
do
  [[ -e $h-edge.log ]] && ~/bin/log2sql.py -d run $h-edge.log
done

popd
./sqlreport.sh $rundir
# Change User Description Committed
#15 25529 Robert Cowham Latest copy of files including docker compose setup.
Merging
//guest/robert_cowham/p4benchmark/pb/...
to //guest/robert_cowham/p4benchmark/main/...
#14 24851 Robert Cowham Improve sql reporting.
Log ps usage
#13 24848 Robert Cowham Drop caches per run.
Increase num slaves to 70
#12 24760 Robert Cowham Output sum column in sql report
#11 24743 Robert Cowham fix call to copy_logs
#10 24742 Robert Cowham Analyse correct yml files
#9 24723 Robert Cowham Fix sql reports
#8 24693 Robert Cowham Tidy sql output
#7 24690 Robert Cowham Tweak analyse better.
Fix deletion of workspaces root
#6 24687 Robert Cowham Got analysis working
#5 22003 Robert Cowham Latest state - with p4python and no syncing
#4 21903 Robert Cowham New edge servers
#3 21897 Robert Cowham Handle edge servers too
#2 21790 Robert Cowham New analyse for replica work
#1 21767 Robert Cowham add latest stuff with analyse