It’s easy to time curl requests (or any program) with the time command:
$ time curl -I https://duckduckgo.com/
But it’s also possible to profile curl requests in greater detail using the --write-out option (-w for short), including timing, download speed and size, and other variables.
For example:
$ curl -I -w "\ntime_total: %{time_total} sec\nsize_download: %{size_download} bytes\nspeed_download: %{speed_download}\nsize_request: %{size_request}\ntime_namelookup: %{time_namelookup}" https://duckduckgo.com
This request measured:
time_total: The total time of the operationsize_download: The total amount of downloaded bytesspeed_download: The average download speed in bytes per secondsize_request: The total amount of bytes sent in the requesttime_name_lookup: The time in seconds until name resolution completed
There are more variables available. Run man curl or see the man page for full details on the -w option.
