Curl命令查看請求響應時間


1、vim curl

\n 
       time_namelookup: %{time_namelookup}\n time_connect: %{time_connect}\n time_appconnect: %{time_appconnect}\n time_pretransfer: %{time_pretransfer}\n time_redirect: %{time_redirect}\n time_starttransfer: %{time_starttransfer}\n ----------\n time_total: %{time_total}\n \n
time_namelookup:DNS解析域名時間,把域名--->ipd的時間
time_connect:TCP連接的時間,三次握手的時間
time_appconnect:SSL|SSH等上層連接建立的時間
time_pretransfer:從請求開始到到響應開始傳輸的時間
time_redirect:從開始到最后一個請求事務的時間
time_starttransfer:從請求開始到第一個字節將要傳輸的時間
time_total:總時間

2、eg

  curl -w "@curl" -o /dev/null -s -d "username=aaa&password=bbb" https://xxx.xxx.com/webapp/xxx/login

 -w:從文件中讀取信息打印格式

 -o:輸出的全部信息

 -s:不打印進度條

 -d:參數

3、簡單的方式

curl -o /dev/null -s -w '%{time_connect}:%{time_starttransfer}:%{time_total}\n' 'http://www.baidu.com'

忽略ssl認證  並輸出結果

curl -k -XPOST -w '\n%{time_connect}:%{time_starttransfer}:%{time_total}\n' www.baidu.com

4、當Content-Type:application/json,requestBody:{id: 93, status: 2}

 curl -w "@curl" -H "Content-Type:application/json" -X PUT --data '{id: 93, status: 2}' http:/xxxxxxxxxxx/changeStatus


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM