|
代码如下,另外附件也有个压缩包,内容一样的.这个脚本实际上就是利用常见的几个测试点进行下载文件测试,有爱的可以自己额外添加其他下载点.附图为我某台san jose的linode VPS,性能一般吧,网卡是G口,磁盘确实不咋滴,可能是因为linode都是大母鸡,至少16G内存,磁盘性能普遍很低.[ol]#!/bin/bashcname=$( awk -F: '/model name/ {name=$2} END {print name}' /proc/cpuinfo )cores=$( awk -F: '/model name/ {core++} END {print core}' /proc/cpuinfo )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=$(uptime|awk '{ $1=$2=$(NF-6)=$(NF-5)=$(NF-4)=$(NF-3)=$(NF-2)=$(NF-1)=$NF=""; print }')echo "CPU model : $cname"echo "Number of cores : $cores"echo "CPU frequency : $freq MHz"echo "Total amount of ram : $tram MB"echo "Total amount of swap : $swap MB"echo "System uptime : $up"cachefly=$( wget -O /dev/null http://cachefly.cachefly.net/100mb.test 2>&1 | awk '/\/dev\/null/ {speed=$3 $4} END {gsub(/\(|\)/,"",speed); print speed}' )echo "Download speed from CacheFly: $cachefly "linodeatl=$( wget -O /dev/null http://atlanta1.linode.com/100MB-atlanta.bin 2>&1 | awk '/\/dev\/null/ {speed=$3 $4} END {gsub(/\(|\)/,"",speed); print speed}' )echo "Download speed from Linode, Atlanta GA: $linodeatl "linodedltx=$( wget -O /dev/null http://dallas1.linode.com/100MB-dallas.bin 2>&1 | awk '/\/dev\/null/ {speed=$3 $4} END {gsub(/\(|\)/,"",speed); print speed}' )echo "Download speed from Linode, Dallas, TX: $linodedltx "linodejp=$( wget -O /dev/null http://tokyo1.linode.com/100MB-tokyo.bin 2>&1 | awk '/\/dev\/null/ {speed=$3 $4} END {gsub(/\(|\)/,"",speed); print speed}' )echo "Download speed from Linode, Tokyo, JP: $linodejp "linodeuk=$( wget -O /dev/null http://london1.linode.com/100MB-london.bin 2>&1 | awk '/\/dev\/null/ {speed=$3 $4} END {gsub(/\(|\)/,"",speed); print speed}' )echo "Download speed from Linode, London, UK: $linodeuk "leaseweb=$( wget -O /dev/null http://mirror.leaseweb.com/speedtest/100mb.bin 2>&1 | awk '/\/dev\/null/ {speed=$3 $4} END {gsub(/\(|\)/,"",speed); print speed}' )echo "Download speed from Leaseweb, Haarlem, NL: $leaseweb "slsg=$( wget -O /dev/null http://speedtest.sng01.softlayer.com/downloads/test100.zip 2>&1 | awk '/\/dev\/null/ {speed=$3 $4} END {gsub(/\(|\)/,"",speed); print speed}' )echo "Download speed from Softlayer, Singapore: $slsg "slwa=$( wget -O /dev/null http://speedtest.sea01.softlayer.com/downloads/test100.zip 2>&1 | awk '/\/dev\/null/ {speed=$3 $4} END {gsub(/\(|\)/,"",speed); print speed}' )echo "Download speed from Softlayer, Seattle, WA: $slwa "slsjc=$( wget -O /dev/null http://speedtest.sjc01.softlayer.com/downloads/test100.zip 2>&1 | awk '/\/dev\/null/ {speed=$3 $4} END {gsub(/\(|\)/,"",speed); print speed}' )echo "Download speed from Softlayer, San Jose, CA: $slsjc "slwdc=$( wget -O /dev/null http://speedtest.wdc01.softlayer.com/downloads/test100.zip 2>&1 | awk '/\/dev\/null/ {speed=$3 $4} END {gsub(/\(|\)/,"",speed); print speed}' )echo "Download speed from Softlayer, Washington, DC: $slwdc "io=$( ( dd if=/dev/zero of=test_$ bs=64k count=16k conv=fdatasync && rm -f test_$ ) 2>&1 | awk -F, '{io=$NF} END { print io}' )echo "I/O speed : $io"[/ol]复制代码保存为 test.sh 文件,给755权限,也就是chmod 755 test.sh,然后执行 ./test.sh
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
×
|