Skip to content

Instantly share code, notes, and snippets.

@rabbitz
Last active June 9, 2022 03:48
Show Gist options
  • Save rabbitz/791758de47724695cad05026b8c43a67 to your computer and use it in GitHub Desktop.
Save rabbitz/791758de47724695cad05026b8c43a67 to your computer and use it in GitHub Desktop.
curl查看请求时间

curl命令查看请求响应时间

对于一些禁止ping 的网址可以使用curl进行测试

curl -o /dev/null -s -w %{http_code}---%{content_type}---%{time_namelookup}---%{time_namelookup}---%{time_connect}---%{time_starttransfer}---%{time_total}---%{speed_download}"\n" "http://www.baidu.com/"

-o /dev/null:把curl 返回的html、js 写到垃圾回收站[ /dev/null] -s:去掉所有状态 -w:按照后面的格式写出rt

http_code http状态码

content_type 类型

time_namelookup:DNS 解析域名www.36nu.com的时间

time_commect:client和server端建立TCP 连接的时间

time_starttransfer:从client发出请求;到web的server 响应第一个字节的时间

time_total:client发出请求;到web的server发送会所有的相应数据的时间

speed_download:下载速度 单位 byte/s

--- 分隔符号

curl -o /dev/null -s -w %{http_code}---%{content_type}---%{time_namelookup}---%{time_namelookup}---%{time_connect}---%{time_starttransfer}---%{time_total}---%{speed_download}"\n" -X 'GET' 'http://localhost:4000/v1/account/cdt6obcy0h4z5ubc/messages?path=INBOX&page=0&pageSize=20&access_token=e820d5d8bc48d1d2531d1fd6fb2494d2a72a2a838adc1123bbb96a7df5f8117d' -H 'accept: application/json'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment