perftest-tsdb-compare-1d.sh 2.6 KB
Newer Older
S
Shuduo Sang 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
#!/bin/bash

# Coloured Echoes                                                                                                       #
function red_echo      { echo -e "\033[31m$@\033[0m";   }                                                               #
function green_echo    { echo -e "\033[32m$@\033[0m";   }                                                               #
function yellow_echo   { echo -e "\033[33m$@\033[0m";   }                                                               #
function white_echo    { echo -e "\033[1;37m$@\033[0m"; }                                                               #
# Coloured Printfs                                                                                                      #
function red_printf    { printf "\033[31m$@\033[0m";    }                                                               #
function green_printf  { printf "\033[32m$@\033[0m";    }                                                               #
function yellow_printf { printf "\033[33m$@\033[0m";    }                                                               #
function white_printf  { printf "\033[1;37m$@\033[0m";  }                                                               #
# Debugging Outputs                                                                                                     #
function white_brackets { local args="$@"; white_printf "["; printf "${args}"; white_printf "]"; }                      #
function echoInfo   { local args="$@"; white_brackets $(green_printf "INFO") && echo " ${args}"; }                      #
function echoWarn   { local args="$@";  echo "$(white_brackets "$(yellow_printf "WARN")" && echo " ${args}";)" 1>&2; }  #
function echoError  { local args="$@"; echo "$(white_brackets "$(red_printf    "ERROR")" && echo " ${args}";)" 1>&2; }  #

function restartTaosd {
	systemctl stop taosd
	pkill -KILL -x taosd
	sleep 10
	
	rm -rf /mnt/var/log/taos/*
	rm -rf /mnt/var/lib/taos/*
	
	taosd 2>&1 > /dev/null &
	sleep 10
}

function runPerfTest1d {
	echoInfo "Restart Taosd"
	restartTaosd

	cd /home/taos/tliu/timeseriesdatabase-comparisons/build/tsdbcompare
S
Shuduo Sang 已提交
36
	./runreal-1d-csv.sh $1 2>&1 | tee /root/perftest-1d-$1-$today.log
S
Shuduo Sang 已提交
37 38 39 40 41
}

function generatePerfPlot1d {
	cd /root

S
Shuduo Sang 已提交
42
	csvLines=`cat perftest-1d-$1-report.csv | wc -l`
S
Shuduo Sang 已提交
43 44

	if [ "$csvLines" -gt "10" ]; then
S
Shuduo Sang 已提交
45
		sed -i '2d' perftest-1d-$1-report.csv
S
Shuduo Sang 已提交
46 47
	fi

S
Shuduo Sang 已提交
48
	gnuplot -e "filename='perftest-1d-$1-report'" -p perftest-csv2png.gnuplot
S
Shuduo Sang 已提交
49 50 51 52 53 54
}

today=`date +"%Y%m%d"`
cd /root

echoInfo "run Performance Test with 1 day data"
S
Shuduo Sang 已提交
55
runPerfTest1d $1
S
Shuduo Sang 已提交
56
echoInfo "Generate plot of 1 day data"
S
Shuduo Sang 已提交
57
generatePerfPlot1d $1
S
Shuduo Sang 已提交
58
echoInfo "End of TSDB-Compare 1-day-data Test"