Created
November 5, 2014 20:23
-
-
Save xcsrz/2957d733e52810be93f1 to your computer and use it in GitHub Desktop.
Just a little script to time page requests (no assets, just the single URL). It runs via /usr/bin/ruby which is present on all macs and most posix systems these days. If you're using rvm you'll probably want to change that.
This file contains 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/ruby | |
$url = ARGV[0] | |
$rounds = ARGV[1] || 10 | |
loadTimes = [] | |
puts "fetching page #{$rounds} times ..." | |
$rounds.to_i.times do | |
print "." | |
loadTimes << (`curl -w '%{time_total}\n' -o /dev/null -s "#{$url}"`).to_f | |
end | |
puts "... average request time: #{loadTimes.inject{ |sum, el| sum + el }.to_f / loadTimes.size}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment