Skip to content

Instantly share code, notes, and snippets.

@satoshihirose
Created November 19, 2014 04:43
Show Gist options
  • Save satoshihirose/91e1f2753347e352c9de to your computer and use it in GitHub Desktop.
Save satoshihirose/91e1f2753347e352c9de to your computer and use it in GitHub Desktop.
レスポンスタイム計測shellscript
#!/bin/bash
if [ $# -ne 1 ]; then
echo "usage: $0 {url}" 1>&2
exit 1
fi
url=$1
rs1=curl -kL $url -o /dev/null -w "%{time_total}" 2> /dev/null
sum=0
for i in `seq 1 10`
do
rs=`curl -kL $url -o /dev/null -w "%{time_total}" 2> /dev/null`
echo $rs
sum=`echo "scale=3;$sum+$rs" | bc`
done
echo avg `echo "scale=3;$sum/10" | bc`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment