mirror of
https://github.com/teddysun/across.git
synced 2025-01-19 06:19:35 +08:00
Add IPv6 test
This commit is contained in:
parent
c1cb865e61
commit
55c003293e
36
bench.sh
36
bench.sh
@ -12,6 +12,7 @@ freq=$( awk -F: '/cpu MHz/ {freq=$2} END {print freq}' /proc/cpuinfo )
|
||||
tram=$( free -m | awk 'NR==2 {print $2}' )
|
||||
swap=$( free -m | awk 'NR==4 {print $2}' )
|
||||
up=$( awk '{a=$1/86400;b=($1%86400)/3600;c=($1%3600)/60;d=$1%60} {printf("%ddays, %d:%d:%d\n",a,b,c,d)}' /proc/uptime )
|
||||
ipv6=$( curl -s -6 icanhazip.com )
|
||||
|
||||
next() {
|
||||
printf "%-70s\n" "-" | sed 's/\s/-/g'
|
||||
@ -19,7 +20,7 @@ next() {
|
||||
|
||||
speed_test() {
|
||||
speedtest=$(wget -4O /dev/null $1 2>&1 | awk '/\/dev\/null/ {speed=$3 $4} END {gsub(/\(|\)/,"",speed); print speed}')
|
||||
ipaddress=$(ping -c1 `awk -F'/' '{print $3}' <<< $1` | awk -F'[()]' '{print $2;exit}')
|
||||
ipaddress=$(ping -c1 -n `awk -F'/' '{print $3}' <<< $1` | awk -F'[()]' '{print $2;exit}')
|
||||
nodeName=$2
|
||||
if [ "${#nodeName}" -lt "8" ]; then
|
||||
echo -e "\e[33m$2\e[0m\t\t\t\t\e[32m$ipaddress\e[0m\t\t\e[31m$speedtest\e[0m"
|
||||
@ -30,7 +31,21 @@ speed_test() {
|
||||
elif [ "${#nodeName}" -ge "24" ]; then
|
||||
echo -e "\e[33m$2\e[0m\t\e[32m$ipaddress\e[0m\t\t\e[31m$speedtest\e[0m"
|
||||
fi
|
||||
#echo -e "Download speed from \e[33m$2\e[0m(IP:\e[32m$ipaddress\e[0m): \e[31m$speedtest\e[0m"
|
||||
}
|
||||
|
||||
speed_test_v6() {
|
||||
speedtest=$(wget -6O /dev/null $1 2>&1 | awk '/\/dev\/null/ {speed=$3 $4} END {gsub(/\(|\)/,"",speed); print speed}')
|
||||
ipaddress=$(ping6 -c1 -n `awk -F'/' '{print $3}' <<< $1` | awk -F'[()]' '{print $2;exit}')
|
||||
nodeName=$2
|
||||
if [ "${#nodeName}" -lt "8" ]; then
|
||||
echo -e "\e[33m$2\e[0m\t\t\t\t\e[32m$ipaddress\e[0m\t\t\e[31m$speedtest\e[0m"
|
||||
elif [ "${#nodeName}" -lt "13" ]; then
|
||||
echo -e "\e[33m$2\e[0m\t\t\t\e[32m$ipaddress\e[0m\t\t\e[31m$speedtest\e[0m"
|
||||
elif [ "${#nodeName}" -lt "24" ]; then
|
||||
echo -e "\e[33m$2\e[0m\t\t\e[32m$ipaddress\e[0m\t\e[31m$speedtest\e[0m"
|
||||
elif [ "${#nodeName}" -ge "24" ]; then
|
||||
echo -e "\e[33m$2\e[0m\t\e[32m$ipaddress\e[0m\t\e[31m$speedtest\e[0m"
|
||||
fi
|
||||
}
|
||||
|
||||
speed() {
|
||||
@ -52,6 +67,19 @@ speed() {
|
||||
speed_test 'http://speedtest.hkg02.softlayer.com/downloads/test100.zip' 'Softlayer, HongKong, CN'
|
||||
}
|
||||
|
||||
speed_v6() {
|
||||
speed_test_v6 'http://speedtest.atlanta.linode.com/100MB-atlanta.bin' 'Linode, Atlanta, GA'
|
||||
speed_test_v6 'http://speedtest.dallas.linode.com/100MB-dallas.bin' 'Linode, Dallas, TX'
|
||||
speed_test_v6 'http://speedtest.newark.linode.com/100MB-newark.bin' 'Linode, Newark, NJ'
|
||||
speed_test_v6 'http://speedtest.singapore.linode.com/100MB-singapore.bin' 'Linode, Singapore, SG'
|
||||
speed_test_v6 'http://speedtest.tokyo.linode.com/100MB-tokyo.bin' 'Linode, Tokyo, JP'
|
||||
speed_test_v6 'http://speedtest.sjc03.softlayer.com/downloads/test100.zip' 'Softlayer, San Jose, CA'
|
||||
speed_test_v6 'http://speedtest.wdc01.softlayer.com/downloads/test100.zip' 'Softlayer, Washington, WA'
|
||||
speed_test_v6 'http://speedtest.par01.softlayer.com/downloads/test100.zip' 'Softlayer, Paris, FR'
|
||||
speed_test_v6 'http://speedtest.sng01.softlayer.com/downloads/test100.zip' 'Softlayer, Singapore, SG'
|
||||
speed_test_v6 'http://speedtest.tok02.softlayer.com/downloads/test100.zip' 'Softlayer, Tokyo, JP'
|
||||
}
|
||||
|
||||
clear
|
||||
echo "CPU model :$cname"
|
||||
echo "Number of cores : $cores"
|
||||
@ -64,12 +92,14 @@ next
|
||||
if [ -e '/usr/bin/wget' ]; then
|
||||
echo -e "Node Name\t\t\tNode IP address\t\tDownload Speed"
|
||||
speed && next
|
||||
if [[ "$ipv6" != "" ]]; then
|
||||
speed_v6 && next
|
||||
fi
|
||||
else
|
||||
echo "Error: wget command not found. You must be install wget command at first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
io=$((dd if=/dev/zero of=test_$$ bs=64k count=16k conv=fdatasync && /bin/rm -f test_$$) 2>&1 | awk 'END{print}')
|
||||
echo "I/O speed : $io"
|
||||
echo ""
|
Loading…
x
Reference in New Issue
Block a user