Skip to content

Instantly share code, notes, and snippets.

@davidmontoyago
Created June 25, 2015 13:05
Show Gist options
  • Save davidmontoyago/283810a11ab2857428a6 to your computer and use it in GitHub Desktop.
Save davidmontoyago/283810a11ab2857428a6 to your computer and use it in GitHub Desktop.
Average load time with curl
#!/bin/bash
total_load_time=0
total_runs=10
if [ -z "$1" ]; then
host="http://localhost:3000"
else
host=`echo $1`
fi
echo banging $host
for (( i=1; i<=$total_runs; i++ ))
do
load_time=`curl -s -w "%{time_total}\n" -o /dev/null $host`
#echo $load_time
total_load_time=`echo $total_load_time+$load_time | bc`
done
avg=`echo $total_load_time/$total_runs | bc -l`
echo $avg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment