CS_collect_timing.sh 902 Bytes
Newer Older
#!/bin/bash
#
# Read file timer_stats.csv
#
#
export FILE_LENGTH=`wc -l < timer_stats.csv`
#
## echo "Number of lines $FILE_LENGTH"
#
export TAIL_LINE_NUMBER="$(($FILE_LENGTH-4))"
#
## echo $TAIL_LINE_NUMBER
#
tail -$TAIL_LINE_NUMBER timer_stats.csv > timer_1st.tmp
#
##more timer_1st.tmp
#
awk '{print $2}' timer_1st.tmp > timer_2nd.tmp
#
sed 's/,//g' timer_2nd.tmp > timer_1st.tmp
#
export FILE_LENGTH=`wc -l < timer_1st.tmp`
#
## echo "Number of lines $FILE_LENGTH"
#
export FILE_LENGTH=$(($FILE_LENGTH-1))
#
export HEAD_LINE_NUMBER="-$FILE_LENGTH"
#
head $HEAD_LINE_NUMBER timer_1st.tmp > timer_2nd.tmp
#
export sum_of_lines=`awk '{s+=$1}END{print s}' timer_2nd.tmp`
## echo "Sum of the lines of the file: $sum_of_lines"
#
##more timer_2nd.tmp
#
export average_timing=`echo "$sum_of_lines / $FILE_LENGTH" | bc -l`
echo "Averaged timing for the $FILE_LENGTH entries: $average_timing"
#
rm -rf *.tmp