diff options
author | Jon Bratseth <bratseth@yahoo-inc.com> | 2016-06-15 23:09:44 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@yahoo-inc.com> | 2016-06-15 23:09:44 +0200 |
commit | 72231250ed81e10d66bfe70701e64fa5fe50f712 (patch) | |
tree | 2728bba1131a6f6e5bdf95afec7d7ff9358dac50 /fbench/util/runtests.sh |
Publish
Diffstat (limited to 'fbench/util/runtests.sh')
-rwxr-xr-x | fbench/util/runtests.sh | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/fbench/util/runtests.sh b/fbench/util/runtests.sh new file mode 100755 index 00000000000..58b72ae1f86 --- /dev/null +++ b/fbench/util/runtests.sh @@ -0,0 +1,92 @@ +#!/bin/sh +# Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +opt_o=false +opt_l=false + +opt_error=false + +while getopts "ol" option; do + case $option in + "o") opt_o=true;; + "l") opt_l=true;; + "*") opt_error=true;; + esac +done + +shift $(($OPTIND - 1)) +if [ $# -lt 8 ] || [ "$opt_error" = "true" ]; then + echo "usage: runtests.sh [-o] [-l] <minClients> <maxClients> <deltaClients>" + echo " <minCycle> <maxCycle> <deltaCycle> [fbench options] <hostname> <port>" + echo "" + echo "The number of clients varies from <minClients> to <maxClients> with" + echo "<deltaClients> increments. For each client count, the cycle time will" + echo "vary in the same way according to <minCycle>, <maxCycle> and <deltaCycle>." + echo "fbench is run with each combination of client count and cycle time, and" + echo "the result output is filtered with the 'resultfilter.pl' script." + echo "If you want to save the results you should redirect stdout to a file." + echo "" + echo " -o : change the order in which the tests are performed so that client" + echo " count varies for each cycle time." + echo " -l : output a blank line between test subseries. If -o is not specified this" + echo " will output a blank line between test series using different client count." + echo " If -o was specified this will output blank lines between test series" + echo " using different cycle time." + echo "" + echo "[fbench options] <hostname> <port>: These arguments are passed to fbench." + echo " There are 2 things to remenber: first; do not specify either of the -n" + echo " or -c options since they will override the values for client count and" + echo " cycle time generated by this script. secondly; make sure you specify" + echo " the correct host and port number. See the fbench usage (run fbench" + echo " without parameters) for more info on how to invoke fbench." + exit 1 +fi + +minClients=$1; shift +maxClients=$1; shift +deltaClients=$1; shift +minCycle=$1; shift +maxCycle=$1; shift +deltaCycle=$1; shift + +if [ ! $deltaClients -gt 0 ]; then + echo "error: deltaClients must be greater than 0 !" + exit 1 +fi + +if [ ! $deltaCycle -gt 0 ]; then + echo "error: deltaCycle must be greater than 0 !" + exit 1 +fi + +echo "# fbench results collected by 'runtests.sh'." +echo "#" +echo "#1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20" +echo "#clients duration cycle lowlimit skip fail ok overtime min max avg 25% 50% 75% 90% 95% 99% rate util zerohit" +echo "#--------------------------------------------------------------------------------------------------" + +if [ "$opt_o" = "true" ]; then + cycle=$minCycle + while [ ! $cycle -gt $maxCycle ]; do + clients=$minClients + while [ ! $clients -gt $maxClients ]; do + test -f pretest.sh && ./pretest.sh > /dev/null 2>&1 + fbench -n $clients -c $cycle $@ | resultfilter.pl + clients=$(($clients + $deltaClients)) + done + [ "$opt_l" = "true" ] && echo "" + cycle=$(($cycle + $deltaCycle)) + done +else + clients=$minClients + while [ ! $clients -gt $maxClients ]; do + cycle=$minCycle + while [ ! $cycle -gt $maxCycle ]; do + test -f pretest.sh && ./pretest.sh > /dev/null 2>&1 + fbench -n $clients -c $cycle $@ | resultfilter.pl + cycle=$(($cycle + $deltaCycle)) + done + [ "$opt_l" = "true" ] && echo "" + clients=$(($clients + $deltaClients)) + done +fi |