Created
October 25, 2012 11:37
-
-
Save LionsAd/3952123 to your computer and use it in GitHub Desktop.
Find fastest execution time
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
| #!/bin/bash | |
| # | |
| # Syntax: find-min-web.sh <namespace> <loops> | |
| MIN=1000000 | |
| NS='drupal-perf' | |
| LOOPS=100 | |
| [ -n "$1" ] && NS=$1 | |
| [ -n "$2" ] && LOOPS=$2 | |
| for i in $(seq 1 $LOOPS) | |
| do | |
| curl -s 'http://127.0.0.1/index-perf.php?q=node&extra='"$NS" | grep 'loop time: |0.' | |
| done | while read line | |
| do | |
| mytime=$(echo $line | cut -d'|' -f2 | cut -d'.' -f2 | cut -d's' -f1) | |
| if [ $mytime -lt $MIN ] | |
| then | |
| MIN=$mytime | |
| echo $line | |
| fi | |
| LC_ALL=C sleep 0.1 | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment