使用Curl计算服务器处理时间 [英] Calculating Server Processing Time With Curl
问题描述
我正在使用 - write-out
选项来获取请求计时信息curl。。
I am getting request timing info with curl using the --write-out
option as described in this article.
这里是我的一个请求:
time_namelookup: 0.031
time_connect: 0.328
time_appconnect: 1.560
time_pretransfer: 1.560
time_redirect: 0.000
time_starttransfer: 1.903
----------
time_total: 2.075
我的问题是:如何确定服务器处理请求的时间?是答案:
My question is: How can I determine how much time the server took processing the request? Is the answer:
time_starttransfer - time-connect
也就是说,从建立连接到服务器开始发送响应的时间?这似乎是正确的,但我想确定。
That is, the time from when the connection was established to when the server starting sending its response? That seems correct but I want to be sure.
有关curl计时变量的详细信息可以在这里找到: http://curl.haxx.se/libcurl/c/curl_easy_getinfo.html
Details about curl timing variables may be found here: http://curl.haxx.se/libcurl/c/curl_easy_getinfo.html
推荐答案
是的,(time_starttransfer - 时间连接)是从连接被curl注意到第一个字节到达的时间。请注意,它还包括传输时间,所以对于远程站点,它将更长,只是因为这一点。
Yes, (time_starttransfer - time-connect) is the time from the connect was noticed by curl until the first byte arrived. Do note that it also includes the transfer time so for a remote site it will be longer simply because of that.
这篇关于使用Curl计算服务器处理时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!