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

  • 相关阅读:
    深入理解C++右值引用
    并发编程的原子性和顺序性
    LLVM简介
    APK及相关的Android路径
    UE4资源移动与跨项目迁移
    OpenGL简介
    IDEA无限试用插件
    使用idea搭建springcloud
    .NET Core 微服务架构 Steeltoe 使用(基于 Spring Cloud)
    微服务:注册中心ZooKeeper、Eureka、Consul 、Nacos对比
  • 原文地址:https://www.cnblogs.com/ooo0/p/14172217.html
Copyright © 2011-2022 走看看