# 一、测试命令展示 ```shell curl -o /dev/null -s -w time_namelookup:"\t"%{time_namelookup}"\n"time_connect:"\t\t"%{time_connect}"\n"time_appconnect:"\t"%{time_appconnect}"\n"time_pretransfer:"\t"%{time_pretransfer}"\n"time_starttransfer:"\t"%{time_starttransfer}"\n"time_total:"\t\t"%{time_total}"\n"time_redirect:"\t\t"%{time_redirect}"\n" https://www.sina.com.cn/ ``` ![curl命令展示-01.png](https://www.xiaoleizhang.com/usr/uploads/2022/12/4011272161.png) ```shell for ((i=1;i<=10;i++));do curl -s -w "%{http_code}::%{time_namelookup}::%{time_total}""\n" -o /dev/null "https://www.sina.com.cn/" ; sleep 2; done ``` ![curl命令展示-02.png](https://www.xiaoleizhang.com/usr/uploads/2022/12/723962280.png) # 二、返回字段解读 ***time_namelookup # 从开始计算,域名解析完成的耗时 time_connect # 从开始计算,TCP建立完成的耗时 time_appconnect # 从开始计算,应用层(SSL,在TCP之上的应用层)连接/握手完成的耗时 time_pretransfer # 从开始计算,准备开始传输数据的耗时 time_starttransfer # 从开始计算,开始传输数据的耗时(libcurl接收到第一个字节) time_total # 总的耗时 time_redirect # 整个过程重定向的耗时,如果整个过程没有重定向,这个时间为0*** 最后修改:2022 年 12 月 21 日 © 允许规范转载 赞 0 如果觉得我的文章对你有用,请随意赞赏