Skip to content

Instantly share code, notes, and snippets.

@mgor
Created May 8, 2017 13:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mgor/f48a990b8b2b535a5b2947902e7e4043 to your computer and use it in GitHub Desktop.
Save mgor/f48a990b8b2b535a5b2947902e7e4043 to your computer and use it in GitHub Desktop.
cURL measurements as json
↳ cat curl-format.txt
{\n
"time_namelookup": %{time_namelookup},\n
"time_connect": %{time_connect},\n
"time_appconnect": %{time_appconnect},\n
"time_pretransfer": %{time_pretransfer},\n
"time_redirect": %{time_redirect},\n
"time_starttransfer": %{time_starttransfer},\n
"time_total": %{time_total}\n
}\n
↳ LC_NUMERIC="en_US-UTF-8" curl -w "@curl-format.txt" -o /dev/null -s "https://www.github.com"
{
"time_namelookup": 0.060,
"time_connect": 0.178,
"time_appconnect": 0.639,
"time_pretransfer": 0.639,
"time_redirect": 0.000,
"time_starttransfer": 0.756,
"time_total": 0.756
}
@mgor
Copy link
Author

mgor commented May 8, 2017

Oneliner:

LC_NUMERIC="en_US-UTF-8" curl -w '{"time_appconnect": %{time_namelookup}, "time_connect": %{time_connect}, "time_appconnect": %{time_appconnect}, "time_pretransfer": %{time_pretransfer}, "time_redirect": %{time_redirect}, "time_starttransfer": %{time_starttransfer}, "time_total": %{time_total}}' -o /dev/null -s "https://www.github.com" | python -m json.tool

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment