1、测试网站速度
curl -o /dev/null -s -w "time_namelookup:%{time_namelookup}\n\
time_connect:%{time_connect}\n\
time_starttransfer:%{time_starttransfer}\n\
time_total:%{time_total}\n\
speed_download:%{speed_download}\n" \
https://xielong.cn/uc/xampp-linux-1.7.7.tar.gz
返回值
time_namelookup:0.513
time_connect:0.520
time_starttransfer:0.771
time_total:0.771
speed_download:561.000
参数说明
# 下载速度,单位 字节每秒 byte/s
speed_download
# 不下载文件
-o /dev/null
# 不输出错误和进度信息
-s
# DNS解析时间,从请求开始到DNS解析完毕所用时间
time_namelookup
# 连接时间,从开始到建立TCP连接完成所用时间,包括前边DNS解析时间,如果需要单纯的得到连接时间,用这个 time_connect 时间减去前边 time_namelookup 时间
time_connect
# 开始传输时间。在发出请求之后,Web 服务器返回数据的第一个字节所用的时间
time_starttransfer
# 总时间,按秒计,精确到小数点后三位
time_total
# http状态码,如200成功,301转向,404未找到,500服务器错误等
http_code