From db468693ef5faa294d9bc3cd3c5d70c0d99d488b Mon Sep 17 00:00:00 2001 From: Rahul C S Date: Fri, 17 Feb 2012 17:23:28 +0530 Subject: Adding the performance framework to the qa repo Change-Id: Ia7dbd82e9bb2e5e65e9345234ce34f8518a091ad Signed-off-by: Rahul C S --- perf-framework/analyze_perf_data | 466 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 466 insertions(+) create mode 100755 perf-framework/analyze_perf_data (limited to 'perf-framework/analyze_perf_data') diff --git a/perf-framework/analyze_perf_data b/perf-framework/analyze_perf_data new file mode 100755 index 0000000..129a1e9 --- /dev/null +++ b/perf-framework/analyze_perf_data @@ -0,0 +1,466 @@ +#!/bin/bash -u + +source gf_perf_config + +if [ $# -le 0 -o $# -gt 2 ] +then + echo "Usage : $0 " + exit 1 +fi + +rundir=$1 +cmpdir="" + +if [ $# -eq 2 ] +then + cmpdir=$2 +fi + +function gen_cpu_data() +{ + time=0 + sum=0 + + if [ -f times ] + then + rm times + fi + + for op in `cat ops` + do + time=0; + for i in `grep -w ^$op $PERFLOG | awk '{print $2}'| cut -f1 -d'.'` + do + time=$((time+$i)) + done; + time=$((time/3)) # Average over three runs + sum=$((sum + $time)) + echo $sum >> times + done + sed -i 's/$/ 100/g' times + + num_procs=`grep -w ^processor $SYSINFO | wc -l` + echo `grep idle $MPSTAT_LOG | head -1 | awk '{print $NF}'` | grep -o idle + idle_col_tweak=$? + echo `grep CPU $MPSTAT_LOG | head -1 | awk '{print $3}'` | grep -o CPU > /dev/null + cpu_col_tweak=$? + for i in "all" 0 `seq $((num_procs-1))` + do + egrep -v 'Linux|^$|idle' $MPSTAT_LOG | awk -v v1=$cpu_col_tweak -v v2=$idle_col_tweak '{print $(3-v1) " " $(NF-v2)}' | grep -w ^$i | cut -f 2 -d' '| sed 's/^/100-/g' | bc -l > cpu-$i; + cat -n cpu-$i > cpu-$i.new + done +} + +function plot_cpu_usage() +{ + xrange=$((`tail -1 times | awk '{print $1}'`+50)) + mpstat_interval=5 + plot_info=pinfo.$$ + num_procs=`grep -w ^processor $SYSINFO | wc -l` + ltype=1 + identity=$1 + + for i in "all" 0 `seq $((num_procs-1))` + do + echo -ne "\"cpu-$i.new\" using (\$1*$mpstat_interval):2 title 'cpu-$i' with lines lt $ltype lw 2,\\c" >> $plot_info + ltype=$((ltype+1)) + done + echo "\"times\" using 1:2 title '' with impulse lt 2 lw 1" >> $plot_info + + gnuplot < vm_datafile + totalmem=`grep -w ^MemTotal $SYSINFO | awk '{print $2}'` + cat vm_datafile | sed "s/^/$totalmem-/g" | bc > memfile + cat -n memfile > memfile.new +} + +function plot_vm_usage() +{ + vmstat_interval=5 + total_mem=`grep -w ^MemTotal $SYSINFO | awk '{print $2}'` + xrange=$((`tail -1 times | awk '{print $1}'`+50)) + identity=$1 + + gnuplot < io_await + cat -n io_await > io_await.new + egrep -v 'Device|^$' $IOSTAT_LOG |grep -w ^$dev | awk '{print $6}' | cut -f1 -d'.' > read_tput + cat -n read_tput > read_tput.new + egrep -v 'Device|^$' $IOSTAT_LOG |grep -w ^$dev | awk '{print $7}' | cut -f1 -d'.' > write_tput + cat -n write_tput > write_tput.new +} + +function plot_iostats() +{ + iostat_interval=5 + max_wait=$((`sort -n io_await | tail -1` + 50)) + max_read=$(((`sort -n read_tput | tail -1`) / 2 + 100)) + max_write=$(((`sort -n write_tput | tail -1`) / 2 + 100)) + max_io=$max_write + if [ $max_read -gt $max_write ] + then + max_io=$max_read; + fi + xrange=$((`tail -1 times | awk '{print $1}'`+50)) + identity=$1 + + gnuplot <> btimes.$$ + done + + for op in `cat ops` + do + time=0; + for i in `grep -w ^$op $perflog_current | awk '{print $2}'| cut -f1 -d'.'` + do + time=$((time+$i)) + done; + time=$((time/3)) # Average over three runs + echo $time >> ctimes.$$ + done + + paste -d " " ops btimes.$$ ctimes.$$ > $CMP_DATAFILE + rm btimes.$$ ctimes.$$ +} + +function plot_comparison() +{ + a=`cat $CMP_DATAFILE | awk '{print $2"\n"$3}' | sort -n | tail -1` + yrange=`echo $a + $a/5 | bc` + b=`wc -l $CMP_DATAFILE | awk '{print $1}'` + xrange=`echo $b - 0.5 | bc` + + gnuplot < intrstat + cat -n intrstat > intrstat.new + egrep -v 'memory|free|^$' $VMSTAT_LOG | awk '{print $12}' > cswstat + cat -n cswstat > cswstat.new +} + +function plot_intr_csw_stats() +{ + vmstat_interval=5 + xrange=$((`tail -1 times | awk '{print $1}'` + 50)) + max_intr=$((`sort -n intrstat | tail -1` + 100)) + max_csw=$((`sort -n cswstat | tail -1` + 100)) + max_val=$max_csw + if [ $max_intr -gt $max_csw ] + then + max_val=$max_intr; + fi + identity=$1 + + gnuplot < rpkts + cat -n rpkts > rpkts.new + egrep -v 'IFACE|^$' $SAR_NETSTAT_LOG |grep -w $dev | awk '{print $4}' | cut -f1 -d'.' > wpkts + cat -n wpkts > wpkts.new + egrep -v 'IFACE|^$' $SAR_NETSTAT_LOG |grep -w $dev | awk '{print $5}' | cut -f1 -d'.' > rkbytes + cat -n rkbytes > rkbytes.new + egrep -v 'IFACE|^$' $SAR_NETSTAT_LOG |grep -w $dev | awk '{print $6}' | cut -f1 -d'.' > wkbytes + cat -n wkbytes > wkbytes.new +} + +function plot_netstats() +{ + sar_netstat_interval=5 + max_read_pkts=$((`sort -n rpkts | tail -1` + 50)) + max_write_pkts=$((`sort -n wpkts | tail -1` + 50)) + max_read_kbytes=$(((`sort -n rkbytes | tail -1`)/1024 + 100)) + max_write_kbytes=$(((`sort -n wkbytes | tail -1`)/1024 + 100)) + + max_pkts=$max_write_pkts + if [ $max_read_pkts -gt $max_write_pkts ] + then + max_pkts=$max_read_pkts; + fi + + max_kbytes=$max_write_kbytes + if [ $max_read_kbytes -gt $max_write_kbytes ] + then + max_kbytes=$max_read_kbytes; + fi + xrange=$((`tail -1 times | awk '{print $1}'`+50)) + identity=$1 + + gnuplot <