bench.sh 跑分测速
#!/bin/bash
#==============================================================#
# Description: bench test script #
# Author: Teddysun <i@teddysun.com> #
# modify: wwng <wwng@2333.me> #
# Thanks: LookBack <admin@dwhd.org> #
# Visit: https://teddysun.com #
#==============================================================#
get_opsy() {
[ -f /etc/os-release ] && awk -F'[= "]' '/PRETTY_NAME/{print $3,$4,$5}' /etc/os-release && return
[ -f /etc/lsb-release ] && awk -F'[="]+' '/DESCRIPTION/{print $2}' /etc/lsb-release && return
[ -f /etc/redhat-release ] && awk '{print ($1,$3~/^[0-9]/?$3:$4)}' /etc/redhat-release && return
} next() {
printf "%-70s\n" "-" | sed 's/\s/-/g'
} speed_test() {
speedtest=$(wget -4O /dev/null -T300 $1 2>&1 | awk '/\/dev\/null/ {speed=$3 $4} END {gsub(/\(|\)/,"",speed); print speed}')
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"
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\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\t\e[31m$speedtest\e[0m"
fi
} speed() {
speed_test 'http://cachefly.cachefly.net/100mb.test' 'CacheFly'
speed_test 'https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/jquery-speedtest/100MB.txt' 'Google GCE'
speed_test 'http://speed.0738.cc/ldinfo_vod.rar' 'Loudi Telecom, Hunan, CN'
speed_test 'http://101.95.50.18/test.img' 'Shanghai Telecom, Shanghai, CN'
speed_test 'http://61.157.118.78/download/300.data' 'Suining Telecom, Sichuan, CN'
#speed_test 'http://speed.myzone.cn/pc_elive_1.1.rar' 'China Telecom, Henan, CN'
speed_test 'http://speedtest.newark.linode.com/100MB-newark.bin' 'Linode, Newark, NJ'
speed_test 'http://speedtest.atlanta.linode.com/100MB-atlanta.bin' 'Linode, Atlanta, GA'
speed_test 'http://speedtest.dallas.linode.com/100MB-dallas.bin' 'Linode, Dallas, TX'
speed_test 'http://speedtest.fremont.linode.com/100MB-fremont.bin' 'Linode, Fremont, CA'
speed_test 'http://speedtest.frankfurt.linode.com/100MB-frankfurt.bin' 'Linode, Frankfurt, DE'
speed_test 'http://speedtest.london.linode.com/100MB-london.bin' 'Linode, London, UK'
speed_test 'http://speedtest.singapore.linode.com/100MB-singapore.bin' 'Linode, Singapore, SG'
speed_test 'http://speedtest.tokyo.linode.com/100MB-tokyo.bin' 'Linode, Tokyo, JP'
speed_test 'http://speedtest.AMS01.softlayer.com/downloads/test100.zip' 'Softlayer, Amsterdam, NL'
speed_test 'http://speedtest.CHE01.softlayer.com/downloads/test100.zip' 'Softlayer, Chennai, IN'
#speed_test 'http://speedtest.DAL01.softlayer.com/downloads/test100.zip' 'Softlayer, Dallas, TX'
#speed_test 'http://speedtest.FRA02.softlayer.com/downloads/test100.zip' 'Softlayer, Frankfurt, DE'
speed_test 'http://speedtest.HKG02.softlayer.com/downloads/test100.zip' 'Softlayer, Hong Kong, CN'
speed_test 'http://speedtest.HOU02.softlayer.com/downloads/test100.zip' 'Softlayer, Houston, TX'
#speed_test 'http://speedtest.LON02.softlayer.com/downloads/test100.zip' 'Softlayer, London, UK'
speed_test 'http://speedtest.MEL01.softlayer.com/downloads/test100.zip' 'Softlayer, Melbourne, AU'
speed_test 'http://speedtest.MEX01.softlayer.com/downloads/test100.zip' 'Softlayer, Queretaro, MX'
speed_test 'http://speedtest.MIL01.softlayer.com/downloads/test100.zip' 'Softlayer, Milan, IT'
speed_test 'http://speedtest.MON01.softlayer.com/downloads/test100.zip' 'Softlayer, Montreal, CA'
speed_test 'http://speedtest.PAR01.softlayer.com/downloads/test100.zip' 'Softlayer, Paris, FR'
speed_test 'http://speedtest.SJC01.softlayer.com/downloads/test100.zip' 'Softlayer, San Jose, CA'
speed_test 'http://speedtest.SAO01.softlayer.com/downloads/test100.zip' 'Softlayer, Sao Paulo, BR'
speed_test 'http://speedtest.SEA01.softlayer.com/downloads/test100.zip' 'Softlayer, Seattle, WA'
#speed_test 'http://speedtest.SNG01.softlayer.com/downloads/test100.zip' 'Softlayer, Singapore, SG'
speed_test 'http://speedtest.SYD01.softlayer.com/downloads/test100.zip' 'Softlayer, Sydney, AU'
#speed_test 'http://speedtest.TOK02.softlayer.com/downloads/test100.zip' 'Softlayer, Tokyo, JP'
speed_test 'http://speedtest.TOR01.softlayer.com/downloads/test100.zip' 'Softlayer, Toronto, CA'
speed_test 'http://speedtest.WDC01.softlayer.com/downloads/test100.zip' 'Softlayer, Washington, WA'
speed_test 'http://speedtest-nyc1.digitalocean.com/100mb.test' 'Digitalocean, NewYork, NY'
speed_test 'http://speedtest-ams2.digitalocean.com/100mb.test' 'Digitalocean, Amsterdam, NL'
speed_test 'http://speedtest-sfo1.digitalocean.com/100mb.test' 'Digitalocean, San Francisco, CA'
#speed_test 'http://speedtest-sgp1.digitalocean.com/100mb.test' 'Digitalocean, Singapore, SG'
#speed_test 'http://speedtest-LON1.digitalocean.com/100mb.test' 'Digitalocean, London, UK'
#speed_test 'http://speedtest-FRA1.digitalocean.com/100mb.test' 'Digitalocean, Frankfurt, DE'
#speed_test 'http://speedtest-TOR1.digitalocean.com/100mb.test' 'Digitalocean, Toronto, CA'
speed_test 'http://speedtest-blr1.digitalocean.com/100mb.test' 'Digitalocean, Bengaluru, IN'
speed_test 'http://proof.ovh.net/files/100Mio.dat' 'OVH, Roubaix, FR'
#speed_test 'http://mirror.nl.leaseweb.net/speedtest/100mb.bin' 'LeaseWeb, Amsterdam, NL'
speed_test 'http://mirror.us.leaseweb.net/speedtest/100mb.bin' 'LeaseWeb, Manassas, VA'
speed_test 'http://199.231.208.6/100MB.test' 'Enzu, Chicago, IL'
#speed_test 'http://192.80.186.135/100MB.test' 'Enzu, Dallas, TX'
speed_test 'http://192.157.214.6/100MB.test' 'Enzu, Los Angeles, CA'
#speed_test 'http://172.246.125.7/100MB.test' 'Enzu, Miami, FL'
} io_test() {
(LANG=en_US dd if=/dev/zero of=test_$$ bs=64k count=16k conv=fdatasync && rm -f test_$$ ) 2>&1 | awk -F, '{io=$NF} END { print io}' | sed 's/^[ \t]*//;s/[ \t]*$//'
} cname=$( awk -F: '/model name/ {name=$2} END {print name}' /proc/cpuinfo | sed 's/^[ \t]*//;s/[ \t]*$//' )
cores=$( awk -F: '/model name/ {core++} END {print core}' /proc/cpuinfo )
freq=$( awk -F: '/cpu MHz/ {freq=$2} END {print freq}' /proc/cpuinfo | sed 's/^[ \t]*//;s/[ \t]*$//' )
tram=$( free -m | awk '/Mem/ {print $2}' )
swap=$( free -m | awk '/Swap/ {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 )
opsy=$( get_opsy )
arch=$( uname -m )
lbit=$( getconf LONG_BIT )
host=$( hostname )
kern=$( uname -r ) clear
next
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"
echo "OS : $opsy"
echo "Arch : $arch ($lbit Bit)"
echo "Kernel : $kern" next if [ -e '/usr/bin/wget' ]; then
echo -e "Node Name\t\t\tIPv4 address\t\tDownload Speed"
speed
else
echo "Error: wget command not found. You must be install wget command at first."
exit 1
fi io1=$( io_test )
io2=$( io_test )
io3=$( io_test )
ioraw1=$( echo $io1 | awk 'NR==1 {print $1}' )
[ "`echo $io1 | awk 'NR==1 {print $2}'`" == "GB/s" ] && ioraw1=$( awk 'BEGIN{print '$ioraw1' * 1024}' )
ioraw2=$( echo $io2 | awk 'NR==1 {print $1}' )
[ "`echo $io2 | awk 'NR==1 {print $2}'`" == "GB/s" ] && ioraw2=$( awk 'BEGIN{print '$ioraw2' * 1024}' )
ioraw3=$( echo $io3 | awk 'NR==1 {print $1}' )
[ "`echo $io3 | awk 'NR==1 {print $2}'`" == "GB/s" ] && ioraw3=$( awk 'BEGIN{print '$ioraw3' * 1024}' )
ioall=$( awk 'BEGIN{print '$ioraw1' + '$ioraw2' + '$ioraw3'}' )
ioavg=$( awk 'BEGIN{print '$ioall'/3}' )
next
echo "I/O speed(1st run) : $io1"
echo "I/O speed(2nd run) : $io2"
echo "I/O speed(3rd run) : $io3"
echo "Average I/O: $ioavg MB/s"
echo ""
bench.sh 跑分测速的更多相关文章
- LINUX系统下跑分测试脚本:unixbench.sh
linux 系统跑分测试脚本: 一.下载脚本: wget http://teddysun.com/wp-content/uploads/unixbench.sh 二.更改权限: ...
- 网络测速命令--speedtest
网络测速 speedtest-cli 顾名思义,这个命令为网络测速命令,基于Python编写,测试系统网络的上传下载速度,GitHub托管的项目地址,以下列出常见的用法 安装命令 pip instal ...
- iOS炫酷动画图案、多种选择器、网络测速、滑动卡片效果等源码
iOS精选源码 对网络进行测速 自实现大标题,配合原生骨架屏demo 简单方便的pickerVIew记录数据 LZPickerView 科技风绘制组件,简单快速"画"出炫酷图案 R ...
- WiFi 测速
WiFi 测速 shit 联通 20M => 电信 20M ? https://zhuanlan.zhihu.com/p/86140645 shit 房东 中国电信网络测速 50M http:/ ...
- [ Arch Linux ] Arch更新源高速源整理之测速并自动排序高速源 加快更新效率
方法一: 工具:rankmirrors 0x01 备份原来的源,并创建一个测试源 cd /etc/pacman.d cp mirrorlist mirrorlist.bakcp mirrorlist ...
- C# Ping的例子,可用于测试网络,延迟xx毫秒 C#编写网站测速
C#编写网站测速 WebClient wcl = new WebClient(); Stopwatch spwatch = new Stopwatch(); spwatch.Start(); byte ...
- linux测速软件speedtest-cli
linux测速软件: https://github.com/sivel/speedtest-cli 以下是我在gentoo上测的
- 网址测速JS
/*.route_nav li a:hover{background: #3c7f84 url(title.png) no-repeat;border-color:#84a3a5;}*/ .route ...
- 【原创】CLEVO P157SM外接鼠标键盘失灵解决:更换硅脂(附带最新跑分数据)
作者批注:本文允许转载,并且希望给搜索未来人类.蓝天.CLEVO.更换硅脂或者任何有关关键字的朋友提供帮助. 原文地址:http://www.cnblogs.com/c4isr/p/3514140.h ...
随机推荐
- JMeter专题系列(四)参数化
JMeter也有像LR中的参数化,本篇就来介绍下JMeter的参数化如何去实现. 参数化:录制脚本中有登录操作,需要输入用户名和密码,假如系统不允许相同的用户名和密码同时登录,或者想更好的模拟多个用户 ...
- Javascript:JSON总结
JSON(JavaScript Object Notation) 是一种轻量级的数据交换格式.它是基于ECMAScript的一个子集,采用完全独立于语言的文本格式.这些特性使JSON成为理想的数据交换 ...
- ul ol di三者区别
1.ul是无序列表,也就是说没有排列限制可以随意加li: <ul> <li>可以随意放置</li> <li>可以随意放置</li> < ...
- javascript执行环境(执行期上下文)详解
javascript执行环境(执行期上下文) 当js控制器(control)进入可执行代码时,控制器会进入一个执行环境,活动的多个执行环境构成执行环境栈,最上面的是正在运行的执行环境,当控制器进入一个 ...
- 1-1 gulp 实战
npm install gulp-htmlmin gulp-imagemin imagemin-pngcrush gulp-minify-css gulp-jshint gulp-uglify gul ...
- SharePoint 2013 定制搜索显示模板(二)
前言 之前一篇博客,简单的介绍了如何定制搜索显示模板,这一次,我们介绍一下如何定制搜索显示时,弹出来的那个页面,相信这个大家也都会遇到的. 1.第一部分就是搜索显示模板的部分,第二部分就是搜索项目详情 ...
- Day Tips:alertstemplates.xml
1.修改Alert邮件模板,首先要注意的时候最好复制一份alertstemplates.xml,然后改一下名字,我改的是 custom_alertstemplates.xml,修改自己需要的代码部分. ...
- CoreData数据库浅析
Core Data是iOS5之后才出现的一个框架,它提供了对象-关系映射(ORM)的功能,即能够将OC对象转化成数据,保存在SQLite数据库文件中,也能够将保存在数据库中的数据还原成OC对象.在此数 ...
- Android 高级面试题及答案
一 性能优化 1.如何对 Android 应用进行性能分析 android 性能主要之响应速度 和UI刷新速度. 可以参考博客:Android系统性能调优工具介绍 首先从函数的耗时来说,有一个工具Tr ...
- Linux 卸载mysql-libs包出现错误
在Red Hat Enterprise Linux6.6上安装MySQL时,出现与package mysql-libs-5.1.73-3.el6_5.x86_64冲突的情况 [root@localho ...