zoukankan      html  css  js  c++  java
  • curl http请求响应时间

    1、直接访问使用:

    curl -o /dev/null -s -w %{http_code}:%{http_connect}:%{content_type}:%{time_namelookup}:%{time_redirect}:%{time_pretransfer}:%{time_connect}:%{time_starttransfer}:%{time_total}:%{speed_download} www.baidu.com

    输出变量需要按照%{variable_name}的格式,如果需要输出%,double一下即可,即%%,同时, 是换行, 是回车, 是TAB。 

    -w 指定格式化文件

    -o 请求重定向到,不带此参数则控制台输出返回结果

    -s 静默,不显示进度

    2、定义时间格式化文件访问

    #vim  curl-time.txt 
    
    
                  http: %{http_code}
    
                   dns: %{time_namelookup}s
    
              redirect: %{time_redirect}s
    
          time_connect: %{time_connect}s
    
       time_appconnect: %{time_appconnect}s
    
      time_pretransfer: %{time_pretransfer}s
    
    time_starttransfer: %{time_starttransfer}s
    
         size_download: %{size_download}bytes
    
        speed_download: %{speed_download}B/s
    
                      ----------
    
            time_total: %{time_total}s
    
    
    
    curl -w "@curl-time.txt" https://www.sogou.com/websearch/api/getcity

     

    curl的部分时间等变量注释:

    time_total 总时间

    time_namelookup DNS解析时间

    time_connect 连接时间

    time_appconnect 连接建立完成时间

    time_pretransfer 从开始到准备传输的时间

    time_redirect 重定向时间

    time_starttransfer 开始传输时间

    文章参考:

    https://blog.csdn.net/hqzxsc2006/article/details/50547684

    https://blog.csdn.net/weifangan/article/details/80741981

  • 相关阅读:
    【报错】ES报错找不到Gson类
    【报错】Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
    【JUC】AtomicInteger源码
    【Netty】Netty服务启动源码
    【Netty】Netty实现简单RPC
    【Netty】心跳机制
    【Netty】Netty模型
    【Netty】Reactor模型
    C# 好狂的多线程呀
    select使用
  • 原文地址:https://www.cnblogs.com/ooo0/p/14172217.html
Copyright © 2011-2022 走看看