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