Linux | curl命令调用接口时查看调用时长和详情

关注wx: CodingTechWork

引言

  在服务器中通过curl命令调用接口时,我们经常需要分析一些时长。本文主要总结两种方式进行处理。

curl命令

使用time命令

time curl -k -u '<username>':'<password>' https://127.0.0.1/xxxx -vvv

使用文本

编写time.txt

   time_namelookup:  %{time_namelookup}s\n
        time_connect:  %{time_connect}s\n
     time_appconnect:  %{time_appconnect}s\n
    time_pretransfer:  %{time_pretransfer}s\n
       time_redirect:  %{time_redirect}s\n
  time_starttransfer:  %{time_starttransfer}s\n
                     ----------\n
          time_total:  %{time_total}s\n

命令

curl -k -u '<username>':'<password>' https:///127.0.0.1/xxxx -vvv -w "@time.txt"

猜你喜欢

转载自blog.csdn.net/Andya_net/article/details/132262273