#!/bin/bash -u MPSTAT_LOG=mpstat_log1908 VMSTAT_LOG=vmstat_log1908 SYSINFO=sysinfo1908 PERFLOG=perf-fuse-ami.log source gnuplotrc 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/$/ 200/g' times num_procs=`grep -w ^processor $SYSINFO | wc -l` echo `grep idle $MPSTAT_LOG | head -1 | awk '{print $NF}'` | grep -o idle col_tweak=$? for i in "all" 0 `seq $((num_procs-1))` do egrep -v 'Linux|^$|idle' $MPSTAT_LOG | awk -v v1=$col_tweak '{print $3 " " $(NF-v1)}' | 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 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 lc rgb \"#FF0000\"" >> $plot_info gnuplot < vm_datafile totalmem=`grep -w ^MemTotal $SYSINFO | awk '{print $2}'` cat vm_datafile | sed "s/^/$totalmem-/g" | bc > memfile } function plot_vm_usage() { vmstat_interval=5 total_mem=`grep -w ^MemTotal $SYSINFO | awk '{print $2}'` xrange=$((`tail -1 times | awk '{print $1}'`+50)) 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 <