[netperf-dev] netperf2 commit notice r536 - trunk/doc/examples

raj at netperf.org raj at netperf.org
Tue Mar 13 11:43:12 PDT 2012


Author: raj
Date: 2012-03-13 11:43:12 -0700 (Tue, 13 Mar 2012)
New Revision: 536

Added:
   trunk/doc/examples/mins_maxes.awk
   trunk/doc/examples/post_proc.sh
   trunk/doc/examples/runemomniaggdemo.sh
   trunk/doc/examples/vrules.awk
Log:
a firstish pass at the enable-demo mode of doing aggregtes along with a post processing script all of which could probably be implemented better

Added: trunk/doc/examples/mins_maxes.awk
===================================================================
--- trunk/doc/examples/mins_maxes.awk	                        (rev 0)
+++ trunk/doc/examples/mins_maxes.awk	2012-03-13 18:43:12 UTC (rev 536)
@@ -0,0 +1,22 @@
+BEGIN {
+    max_interval = 0.0;
+    min_timestamp = 9999999999.0;
+    max_timestamp = 0.0;
+}
+
+NF == 4 {
+    if ($3 > max_interval) max_interval = $3
+    if ($4 > max_timestamp) max_timestamp = $4
+    if ($4 < min_timestamp) min_timestamp = $4
+    next
+}
+
+END {
+    max_interval = int(max_interval) + 1
+    min_timestamp = int(min_timestamp)
+    max_timestamp = int(max_timestamp) + 1
+    printf("MAX_INTERVAL=%d\nMAX_TIMESTAMP=%d\nMIN_TIMESTAMP=%d\n",
+	   max_interval,
+	   max_timestamp,
+	   min_timestamp)
+}
\ No newline at end of file

Added: trunk/doc/examples/post_proc.sh
===================================================================
--- trunk/doc/examples/post_proc.sh	                        (rev 0)
+++ trunk/doc/examples/post_proc.sh	2012-03-13 18:43:12 UTC (rev 536)
@@ -0,0 +1,132 @@
+
+# find where to put the vertical lines
+awk -f vrules.awk $1 > vrules
+. ./vrules
+
+i=0
+VRULES=""
+while [ $i -lt $NUM_VRULES ]
+do
+  VRULES="$VRULES VRULE:${VRULE_TIME[$i]}#${VRULE_COLR[$i]}:${VRULE_TEXT[$i]}"
+  i=`expr $i + 1`
+done
+# echo $VRULES
+
+rm kitsink
+
+prefix=${1%.log}
+echo "Prefix is $prefix"
+
+
+for i in ${prefix}*.out
+do
+
+# find some boundaries for this .out file
+    awk -F "," -f mins_maxes.awk $i > minsn
+
+    . ./minsn
+
+# echo "MAX_INTERVAL $MAX_INTERVAL MIN_TIMESTAMP $MIN_TIMESTAMP MAX_TIMESTAMP $MAX_TIMESTAMP"
+    LENGTH=`expr $MAX_TIMESTAMP - $MIN_TIMESTAMP`
+    SIZE="-w $LENGTH -h 400"
+
+
+    # ooh, rick learns how to strip a suffix
+    basename=${i%\.out}
+    echo "Post-processing ${basename}"
+
+    rrdtool create ${basename}.rrd --step 1 --start $MIN_TIMESTAMP \
+	DS:mbps:GAUGE:$MAX_INTERVAL:U:U RRA:AVERAGE:0.5:1:$LENGTH
+
+    # keep in mind that rrd only likes timestamps to milliseconds
+    # at some point it would be nice to do more than one data point
+    # at a time
+    awk -v rrdfile=${basename}.rrd -F "," '(NF == 4){printf("rrdtool update %s %.3f:%f\n",rrdfile,$4,$1)}' \
+	$i | sh
+
+    # this and the way things are handled for overall.rrd is massively
+    # kludgey and I would love to know a better way to do this
+    rrdtool fetch ${basename}.rrd AVERAGE \
+	--start $MIN_TIMESTAMP --end $MAX_TIMESTAMP | \
+	awk -F ":" '{printf("%d %f\n",$1,$2)}' | grep -v -e "nan" -e "^0" >> kitsink
+
+done
+
+echo Performing overall summary computations
+
+# find some overall boundaries.  at some point we should build this up
+# based on what we were doing one file at a time above
+    awk -F "," -f mins_maxes.awk ${prefix}*.out > minsn
+
+    . ./minsn
+
+# echo "MAX_INTERVAL $MAX_INTERVAL MIN_TIMESTAMP $MIN_TIMESTAMP MAX_TIMESTAMP $MAX_TIMESTAMP"
+    LENGTH=`expr $MAX_TIMESTAMP - $MIN_TIMESTAMP`
+    WIDTH=$LENGTH
+    if [ $WIDTH -lt 500 ]
+    then
+	WIDTH=500
+    fi
+    SIZE="-w $WIDTH -h 400"
+
+
+# ok time for the overall results
+# by now all the large intervals have been dealt with so we do not
+# have to use MAX_INTERVAL
+
+rrdtool create ${prefix}_overall.rrd --step 1 --start `expr $MIN_TIMESTAMP - 1` \
+    DS:mbps:GAUGE:2:U:U RRA:AVERAGE:0.5:1:$LENGTH
+
+for i in `seq $MIN_TIMESTAMP $MAX_TIMESTAMP`
+do
+    SUM=`grep $i kitsink | awk '{sum += $2}END{print sum}'`
+    rrdtool update ${prefix}_overall.rrd ${i}:$SUM
+done
+
+# get out labels set correctly
+UNITS="bits/s"
+MULTIPLIER="1000000"
+DIRECTION="Bidirectional"
+case $prefix in
+    *pps* | *tps* ) 
+	UNITS="Trans/s"
+	MULTIPLIER="1"
+	;;
+    *inbound* )
+	DIRECTION="Inbound"
+	;;
+    *outbound* )
+	DIRECTION="Outbound"
+	;;
+esac
+
+
+# now graph it
+rrdtool graph ${prefix}_overall.png --start $MIN_TIMESTAMP --end $MAX_TIMESTAMP \
+    $SIZE \
+    --imgformat PNG \
+    --font DEFAULT:0:Helvetica \
+    -t "Overall ${1%.log}" \
+    -v "$DIRECTION $UNITS" \
+    DEF:foo=${prefix}_overall.rrd:mbps:AVERAGE \
+    CDEF:bits=foo,$MULTIPLIER,\* \
+    $VRULES \
+    LINE2:bits#00FF0080:"$UNITS"
+
+# now we can do the individual run graphs using the same x axis limits
+# as the overall graph
+for i in ${prefix}*.out
+do
+    basename=${i%\.out}
+    rrdtool graph ${basename}.png --start $MIN_TIMESTAMP --end $MAX_TIMESTAMP \
+	$SIZE \
+	--imgformat PNG \
+	--font DEFAULT:0:Helvetica \
+	-t "$basename ${1%.log}" \
+	-v "$DIRECTION $UNITS" \
+	DEF:foo=${basename}.rrd:mbps:AVERAGE \
+        CDEF:bits=foo,$MULTIPLIER,\* \
+	$VRULES \
+	LINE2:bits#00FF0080:"$UNITS"
+
+done
\ No newline at end of file


Property changes on: trunk/doc/examples/post_proc.sh
___________________________________________________________________
Added: svn:executable
   + *

Added: trunk/doc/examples/runemomniaggdemo.sh
===================================================================
--- trunk/doc/examples/runemomniaggdemo.sh	                        (rev 0)
+++ trunk/doc/examples/runemomniaggdemo.sh	2012-03-13 18:43:12 UTC (rev 536)
@@ -0,0 +1,126 @@
+# this is a quick and dirty migration of runemomniagg2.sh to the 
+# --enable-demo mode of aggregate testing
+
+function kill_netperfs {
+    pkill -ALRM netperf
+
+    pgrep -P 1 -f netperf > /dev/null
+    while [ $? -eq 0 ]
+    do
+	sleep 1
+	pgrep -P 1 -f netperf > /dev/null
+    done
+}
+
+function run_cmd {
+
+    NOW=`date +%s.%N`
+    echo "Starting netperfs at $NOW for $TEST" | tee $TESTLOG
+    i=0;
+
+# the starting point for our load level pauses
+    PAUSE_AT=1
+
+
+    while [ $i -lt $MAX_INSTANCES ]
+    do
+	echo "Starting netperfs on localhost for $TEST" | tee -a $TESTLOG
+	TARGET=${REMOTE_HOSTS[`expr $i % $NUM_REMOTE_HOSTS`]}
+	$NETPERF -H $TARGET $NETPERF_CMD 2>&1 > netperf_${TEST}_to_${TARGET}_${i}.out &
+
+    # give it a moment to get going
+	sleep 1
+
+	i=`expr $i + 1`
+
+	if [ $i  -eq $PAUSE_AT ] && [ $i -ne $MAX_INSTANCES ]
+	then
+	    NOW=`date +%s.%N`
+	    echo "Pausing for $DURATION seconds at $NOW with $i netperfs running for $TEST" | tee -a $TESTLOG
+	    sleep $DURATION
+	    PAUSE_AT=`expr $PAUSE_AT \* 2`
+	    NOW=`date +%s.%N`
+	    echo "Resuming at $NOW for $TEST" | tee -a $TESTLOG
+	fi    
+    done
+
+    NOW=`date +%s.%N`
+    echo "Netperfs started by $NOW for $TEST" | tee -a $TESTLOG
+
+#wait for our test duration
+    sleep $DURATION
+
+#kludgey but this sleep should mean that another interim result will be emitted
+    sleep 3
+
+# stop all the netperfs
+    NOW=`date +%s.%N`
+    echo "Netperfs stopping $NOW for $TEST" | tee -a $TESTLOG
+    kill_netperfs
+    
+    NOW=`date +%s.%N`
+    echo "Netperfs stopped $NOW for $TEST" | tee -a $TESTLOG
+
+}
+
+# here then is the "main" part
+
+if [ ! -f ./remote_hosts ]
+then
+    echo "This script requires a remote_hosts file"
+    exit -1
+fi
+. ./remote_hosts
+
+# how many processors are there on this system
+NUM_CPUS=`grep processor /proc/cpuinfo | wc -l`
+
+# the number of netperf instances we will run will be up to 2x the
+# number of CPUs
+MAX_INSTANCES=`expr $NUM_CPUS \* 2`
+
+NETPERF=${NETPERF:="./netperf"}
+
+if [ $NUM_REMOTE_HOSTS -lt 2 ]
+then
+    echo "The list of remote hosts is too short.  There must be at least 2."
+    exit -1
+fi
+
+# we assume that netservers are already running on all the load generators
+
+DURATION=120
+MY_UUID=`uuidgen`
+LENGTH="-l 7200"
+OUTPUT="-o all"
+
+# TCP_RR for TPC/PPS using single-byte transactions and TCP_NODELAY
+TEST="tps"
+TESTLOG="netperf_tps.log"
+NETPERF_CMD="-D 1 -c -C -f x -P 0 -t omni $LENGTH -v 2 -- -r 1 -b 8 -D -u $MY_UUID $OUTPUT"
+run_cmd
+
+# Bidirectional using burst-mode TCP_RR and large request/response size
+TEST="bidirectional"
+TESTLOG="netperf_bidirectional.log"
+NETPERF_CMD="-D 1 -c -C -f m -P 0 -t omni $LENGTH -v 2 -- -r 64K -s 1M -S 1M -b 12 -u $MY_UUID $OUTPUT"
+run_cmd
+
+# TCP_STREAM aka outbound with a 64K send size
+TEST="outbound"
+TESTLOG="netperf_outbound.log"
+# the netperf command is everything but netperf -H mumble
+NETPERF_CMD="-D 1 -c -C -f m -P 0 -t omni $LENGTH -v 2 -- -m 64K -u $MY_UUID $OUTPUT"
+run_cmd
+
+# TCP_MAERTS aka inbound with a 64K send size - why is this one last?
+# because presently when I pkill the netperf of a "MAERTS" test, the
+# netserver does not behave well and it may not be possible to get it
+# to behave well.  but we will still have all the interim results even
+# if we don't get the final results, the useful parts of which will be
+# the same as the other tests anyway
+TEST="inbound"
+TESTLOG="netperf_inbound.log"
+NETPERF_CMD="-D 1 -c -C -f m -P 0 -t omni $LENGTH -v 2 -- -m ,64K -u $MY_UUID $OUTPUT"
+run_cmd
+

Added: trunk/doc/examples/vrules.awk
===================================================================
--- trunk/doc/examples/vrules.awk	                        (rev 0)
+++ trunk/doc/examples/vrules.awk	2012-03-13 18:43:12 UTC (rev 536)
@@ -0,0 +1,54 @@
+BEGIN {
+    count=0
+    resumes=0
+    my_index=0
+}
+
+    $1 == "Starting" &&
+    $2 == "netperfs" &&
+    $3 == "on" {
+	count += 1
+	next
+    }
+
+    $1 == "Pausing" {
+	printf("VRULE_TIME[%d]=%d\n",my_index,int($6))
+	printf("VRULE_COLR[%d]=\"FF0000\"\n",my_index)
+	printf("VRULE_TEXT[%d]=\"%d_netperfs_running\"\n",my_index,$8)
+	my_index += 1
+	next
+    }
+
+    $1 == "Resuming" {
+	printf("VRULE_TIME[%d]=%d\n",my_index,int($3))
+	printf("VRULE_COLR[%d]=\"000000\"\n",my_index)
+	if (resumes)
+	    printf("VRULE_TEXT[%d]=\"\"\n",my_index)
+	else
+	    printf("VRULE_TEXT[%d]=\"Resuming_ramp\"\n",my_index)
+	resumes=1
+	my_index += 1
+	next
+    }
+
+    $1 == "Netperfs" &&
+    $2 == "started" {
+	printf("VRULE_TIME[%d]=%d\n",my_index,int($4))
+	printf("VRULE_COLR[%d]=\"FF0000\"\n",my_index)
+	printf("VRULE_TEXT[%d]=\"All_%d_netperfs_started\"\n",my_index,count)
+	my_index += 1
+	next
+    }
+
+    $1 == "Netperfs" &&
+    $2 == "stopping" {
+	printf("VRULE_TIME[%d]=%d\n",my_index,int($3))
+	printf("VRULE_COLR[%d]=\"000000\"\n",my_index)
+	printf("VRULE_TEXT[%d]=\"Rampdown_started\"\n",my_index)
+	my_index += 1;
+	next
+    }
+   
+END {
+	printf("NUM_VRULES=%d\n",my_index)
+    }
\ No newline at end of file



More information about the netperf-dev mailing list