Created
April 27, 2023 07:36
-
-
Save petskratt/c19b551d0721bd54db27216e51e97d3a to your computer and use it in GitHub Desktop.
curltime and curloop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# should go into .profile | |
# | |
# single timing: | |
# curltime https://example.com/ | |
# | |
# with unique query argument to bypass cache: | |
# curltime https://example.com/?cachebuster=202304271033 | |
# | |
# loop with increasing counter: | |
# curloop https://example.com/?cachebuster= | |
alias curltime='curl -4Lo /dev/null -skw "\ntime_connect: %{time_connect}s\ntime_namelookup: %{time_namelookup}s\ntime_pretransfer: %{time_pretransfer}\ntime_starttransfer: %{time_starttransfer}s\ntime_redirect: %{time_redirect}s\ntime_total: %{time_total}s\n\n"' | |
function curloop () { | |
i=0 | |
while [ true ] | |
do | |
i=$(($i+1)) | |
echo "$1$i" | |
curl -4Lo /dev/null -skw "\ntime_connect: %{time_connect}s\ntime_namelookup: %{time_namelookup}s\ntime_pretransfer: %{time_pretransfer}\ntime_starttransfer: %{time_starttransfer}s\ntime_redirect: %{time_redirect}s\ntime_total: %{time_total}s\n\n" $1$i | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment