Gangmax Blog

How to know the time used by curl?

The question is straightforward. The solution is from here.

1
2
3
4
5
6
7

# time_total: The total time, in seconds, that the full operation lasted(from curl manual).
curl 'https://www.baidu.com/s?wd=%E9%AD%8F%E5%88%99%E8%A5%BF&rsv_spt=1&rsv_iqid=0xb09369f5000bd010&issp=1&f=8&rsv_bp=1&rsv_idx=2&ie=utf-8&rqlang=cn&tn=baiduhome_pg&rsv_enter=0&rsv_dl=tb&oq=%25E9%25AD%258F%25E5%2588%2599%25E8%25A5%25BF&rsv_t=3d04pHx8Bs%2FmYunjdTnDIzaza54mK9zBD3c8X%2FjVGzufb08dYqEQQWWZqQdV0IFNGWaz&rsv_sug3=10&rsv_pq=915b07df000252ef&rsv_sug4=769' -s -o /dev/null -w '%{time_total}\n'

# time_starttransfer: The time, in seconds, it took from the start until the first
# byte was just about to be transferred. This includes time_pretransfer and also
# the time the server needed to calculate the result.

The “-w” parameter can be used to display many useful information items of the curl execution. More details can be found in the “man curl” output.

Comments