From ae2da697f2361d12e57ff94bb572b28ac58a1cb8 Mon Sep 17 00:00:00 2001 From: Dennis Schafroth Date: Tue, 29 May 2012 11:25:28 +0200 Subject: [PATCH 1/1] Option to time the client run --- perf/bash/pp2client.sh | 40 +++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/perf/bash/pp2client.sh b/perf/bash/pp2client.sh index 611c0dc..0a9f2f8 100755 --- a/perf/bash/pp2client.sh +++ b/perf/bash/pp2client.sh @@ -9,7 +9,8 @@ Options: Default values [--query=QUERY] water [--service=SERVICE] [--settings=SETTINGS] - [--outfile=OUTFILE] 1 + [--outfile=OUTFILE] + [--timed] EOF exit 1 } @@ -18,6 +19,13 @@ SERVICE="" SETTINGS="" QUERY=water OF=1 +TIME="" + +if test $# -eq 0; then + usage + exit 0; +fi + while test $# -gt 0; do case "$1" in -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; @@ -39,13 +47,22 @@ while test $# -gt 0; do --outfile=*) OF=$optarg ;; + --timed) + TIME="yes" + ;; -*) usage ;; esac shift done -wget -q -O $OF.init.xml "$H/?command=init${SERVICE}" + +if [ "$TIME" != "" ] ; then + /usr/bin/time --format "$OF, init, %e" wget -q -O ${TMP_DIR}$OF.init.xml "$H/?command=init${SERVICE}" 2> ${TMP_DIR}$OF.init.time +else + wget -q -O ${TMP_DIR}$OF.init.xml "$H/?command=init${SERVICE}" +fi + R="$?" if [ "$R" != 0 ]; then if [ "$R" = "4" ]; then @@ -58,11 +75,24 @@ if [ "$R" != 0 ]; then fi S=`xsltproc get_session.xsl $OF.init.xml` if [ -n "$SETTINGS" ] ; then - wget -q -O $OF.settings.xml "$H?command=settings&session=$S&${SETTINGS}" + if [ "$TIME" != "" ] ; then + /usr/bin/time --format "$OF, settings, %e" wget -q -O ${TMP_DIR}$OF.settings.xml "$H?command=settings&session=$S&${SETTINGS}" 2> ${TMP_DIR}$OF.settings.time + else + wget -q -O ${TMP_DIR}$OF.settings.xml "$H?command=settings&session=$S&${SETTINGS}" + fi +fi + +if [ "$TIME" != "" ] ; then + /usr/bin/time --format "$OF, search, %e" wget -q -O ${TMP_DIR}$OF.search.xml "$H?command=search&query=$QUERY&session=$S" 2> ${TMP_DIR}$OF.search.time +else + wget -q -O ${TMP_DIR}$OF.search.xml "$H?command=search&query=$QUERY&session=$S" fi -wget -q -O $OF.search.xml "$H?command=search&query=$QUERY&session=$S" sleep 1 -wget -q -O $OF.show.xml "$H?command=show&session=$S&sort=relevance&start=0&num=100&block=1" +if [ "$TIME" != "" ] ; then + /usr/bin/time --format "$OF, show, %e" wget -q -O ${TMP_DIR}$OF.show.xml "$H?command=show&session=$S&sort=relevance&start=0&num=100&block=1" 2> ${TMP_DIR}$OF.show.time +else + wget -q -O ${TMP_DIR}$OF.show.xml "$H?command=show&session=$S&sort=relevance&start=0&num=100&block=1" +fi exit 0 # Local Variables: -- 1.7.10.4