azure-linux-automation/remote-scripts/generate_csvs.sh

115 строки
4.0 KiB
Bash
Исходник Обычный вид История

#!/bin/bash
#
# This script converts Network performance output files into csv files.
2016-04-02 11:52:10 +03:00
# Author: Srikanth Myakam
# Email : v-srm@microsoft.com
#
format_bites(){
temp_size=$1
temp_units="Gbps"
temp_size=`echo $temp_size 1000| awk '{printf "%.3f \n", $1/$2}'`
temp_size=`echo $temp_size 1000| awk '{printf "%.3f \n", $1/$2}'`
echo $temp_size,$temp_units
}
gen_csv(){
input_file=$1
number_of_connections=$2
summary_file=$3
output_file=`echo $input_file |sed s/\.log$/\.csv/`
top_array_file=`echo $output_file |sed s/sar/top/`
conn_array_file=`echo $output_file |sed s/sar/connections/`
cpu_vmstat_file=`echo $input_file |sed s/sar/vmstat/`
rx_pcks_array_file=$input_file-rxpcks.log
tx_pcks_array_file=$input_file-txpcks.log
rx_array_file=$input_file-rxkBps.log
tx_array_file=$input_file-txkBps.log
cpu_vmstat_array_file=$input_file-cpu-vmstat.log
cat $cpu_vmstat_file | grep -v [a-z]| awk '{print 100 - $15}' > $cpu_vmstat_array_file
cat $input_file | grep eth0 | awk '{print $4}' > $rx_pcks_array_file
cat $input_file | grep eth0 | awk '{print $5}' > $tx_pcks_array_file
cat $input_file | grep eth0 | awk '{print $6}' > $rx_array_file
cat $input_file | grep eth0 | awk '{print $7}' > $tx_array_file
rx_pcks_array=(`cat $rx_pcks_array_file`)
tx_pcks_array=(`cat $tx_pcks_array_file`)
rx_array=(`cat $rx_array_file`)
tx_array=(`cat $tx_array_file`)
top_array=(`cat $top_array_file`)
conn_array=(`cat $conn_array_file`)
cpu_array=(`cat $cpu_vmstat_array_file`)
length=$((${#rx_array[@]}-1))
count=0
sum=0
rx_pcks_sum=0
tx_pcks_sum=0
rx_sum=0
tx_sum=0
cpu_sum=0
echo Rx Throughput,Units,TxThroughput,Units,Total,Units,,Time,ActiveConnection,Rx packets,Tx packets,,Time,CPU Usage >> $output_file
for i in `seq 1 $length`;
do
Tx_bits=`echo 8 ${tx_array[count]}| awk '{printf "%.3f \n", $1*$2}'`
Rx_bits=`echo 8 ${rx_array[count]}| awk '{printf "%.3f \n", $1*$2}'`
Tx_data=`format_bites $Tx_bits`
Rx_data=`format_bites $Rx_bits`
Total_bits=`echo $Tx_bits $Rx_bits| awk '{printf "%.3f \n", $1+$2}'`
Total_data=`format_bites $Total_bits`
conn_info=${conn_array[count]}
if [ "x$conn_info" == "x" ]
then
conn_info=","
fi
echo $Rx_data,$Tx_data,$Total_data,,$conn_info,${rx_pcks_array[count]},${tx_pcks_array[count]},,$count,${cpu_array[count]}>> $output_file
rx_pcks_sum=`echo $rx_pcks_sum ${rx_pcks_array[count]}| awk '{printf "%.3f \n", $1+$2}'`
tx_pcks_sum=`echo $tx_pcks_sum ${tx_pcks_array[count]}| awk '{printf "%.3f \n", $1+$2}'`
rx_sum=`echo $rx_sum ${rx_array[count]}| awk '{printf "%.3f \n", $1+$2}'`
tx_sum=`echo $tx_sum ${tx_array[count]}| awk '{printf "%.3f \n", $1+$2}'`
cpu_sum=`echo $cpu_sum ${cpu_array[count]}| awk '{printf "%.3f \n", $1+$2}'`
((count++))
done
sum=`echo $tx_sum $rx_sum| awk '{printf "%.3f \n", $1+$2}'`
pcks_sum=`python -c "print '%d' % ($tx_pcks_sum+$rx_pcks_sum)"`
avg_thrpt=`python -c "print '%.2f' % ($sum*8/($length*1000*1000))"`
avg_cpu=`python -c "print '%d' % ($cpu_sum/$length)"`
echo $number_of_connections,$avg_thrpt,$pcks_sum,$avg_cpu >> $summary_file
rm -rf $rx_array_file $tx_array_file $cpu_vmstat_array_file.log
}
logs_folder=$1
Merging branch to upstream. (#10) * Added new test script for Middlewarw Mongodb benchmark tets * Minor fixes for mongodb perf test * Updated mogngodb test cycle name * Added new test script for FIO perf benchmark test * Minor fix * Minor fix * Minor fix * minor fix * Minor fix for collecting test logs * Updated mongodb code for logs collection * Minor fix for ci logs * Updated FIO test code for proper logs collection * Minor fix * Minor fix for log file names * Minor fix for mongodb ycsb logs collection * Minor fix cleanup VM * Minor fix cleanup VM * Minor fix * Minor fixes for FIO test * Added New script for build linux-next deb package * Added New script for build linux-next deb package * minor fixes * Minor fixes * updated linux-next build deb pack script * Updated instance size Linux-next build deb test * Minor fixes for Linux-next build deb pack test * Minor fixes for Linux-next build deb pack test * Updated the test script to store the deb pack in new loaction * Minor fix * removed duplicate deployment type * Minor fix for distro names * Minor fix * Minor fix for deb package staore loaction * Updated "updaterepos" with new distro name format * Uppercase the distribution name * Updated the UDP net perf test script to run test with given buffer sizes and upload the data loss in database * Reating dummy Documentation/Changes file to avoid .deb creation failure * updated unlimitted bandwidth option for UDP test * Added ARM SAs * Added duration90 secs * Fixed conflicts. * Update NttcpTestPlanFull.csv * Minor fix for fio test
2016-12-08 13:49:50 +03:00
testtype=$2
buffersize=$3
2016-10-07 09:06:14 +03:00
#summary_file=$logs_folder/summary_file_`hostname`.csv
Merging branch to upstream. (#10) * Added new test script for Middlewarw Mongodb benchmark tets * Minor fixes for mongodb perf test * Updated mogngodb test cycle name * Added new test script for FIO perf benchmark test * Minor fix * Minor fix * Minor fix * minor fix * Minor fix for collecting test logs * Updated mongodb code for logs collection * Minor fix for ci logs * Updated FIO test code for proper logs collection * Minor fix * Minor fix for log file names * Minor fix for mongodb ycsb logs collection * Minor fix cleanup VM * Minor fix cleanup VM * Minor fix * Minor fixes for FIO test * Added New script for build linux-next deb package * Added New script for build linux-next deb package * minor fixes * Minor fixes * updated linux-next build deb pack script * Updated instance size Linux-next build deb test * Minor fixes for Linux-next build deb pack test * Minor fixes for Linux-next build deb pack test * Updated the test script to store the deb pack in new loaction * Minor fix * removed duplicate deployment type * Minor fix for distro names * Minor fix * Minor fix for deb package staore loaction * Updated "updaterepos" with new distro name format * Uppercase the distribution name * Updated the UDP net perf test script to run test with given buffer sizes and upload the data loss in database * Reating dummy Documentation/Changes file to avoid .deb creation failure * updated unlimitted bandwidth option for UDP test * Added ARM SAs * Added duration90 secs * Fixed conflicts. * Update NttcpTestPlanFull.csv * Minor fix for fio test
2016-12-08 13:49:50 +03:00
summary_file=$logs_folder/summary_file_`hostname`_${testtype}_${buffersize}.csv
echo "" > $summary_file
echo "Connections,Avg Throughput,Total packets,Avg CPU" > $summary_file
for number_of_connections in 1 2 4 8 16 32 64 128 256 512 1024
do
2016-04-01 18:10:18 +03:00
echo "Converting $number_of_connections logs.."
gen_csv $logs_folder/$number_of_connections/$number_of_connections-sar.log $number_of_connections $summary_file&
done
wait
2016-04-01 18:10:18 +03:00
mkdir -p $logs_folder/csv_files/
for number_of_connections in 1 2 4 8 16 32 64 128 256 512 1024
2016-04-01 18:10:18 +03:00
do
mv $logs_folder/$number_of_connections/$number_of_connections-sar.csv $logs_folder/csv_files/
done
cat $summary_file | sort -n > $summary_file.tmp
mv $summary_file.tmp $summary_file
logs_folder=`echo $logs_folder| sed 's/\/$//'`
2016-04-01 18:10:18 +03:00
tar -czf $logs_folder.tar.gz $logs_folder/
2016-04-01 20:07:01 +03:00
echo "Completed!"