Skip to content

Instantly share code, notes, and snippets.

@lkosak
Created September 26, 2012 18:19
Show Gist options
  • Save lkosak/3789649 to your computer and use it in GitHub Desktop.
Save lkosak/3789649 to your computer and use it in GitHub Desktop.
times = []
for i in 1..15
res = `curl -s -w "%{time_connect}:%{time_starttransfer}\n" -o /dev/null http://www.pinchit.com/api/v1/markets/san-francisco/music\?limit\=50\&market\=san-francisco\&abc\=$i`
connect, transfer = res.strip.split(":").map { |t| t.to_f }
time = (transfer - connect).round(3)
times << time
puts time
end
total = times.inject(:+)
len = times.length
avg = total / len
puts ""
puts "#{times.min} / #{avg.round(3)} / #{times.max}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment