source: test/compare-speeds.sh @ 71f218a

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivelibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since 71f218a was a5662447, checked in by Richard Sanger <rsangerarj@…>, 7 years ago

Add a script that runs parallel and single threaded version of tools I've converted and records the time and other useful stats.
Mainly added for backup purposes as this is most likely unneeded/wanted in an actual Libtrace release.

  • Property mode set to 100644
File size: 5.2 KB
Line 
1#!/bin/sh
2
3# A script that runs the single and multi threaded versions of libtrace programs
4# Currently this compares tracestats and traceanon
5# This requires a bit of environment setup since it requires large trace files
6# 100mb+ ideally 1gb to ensure that the times are long enough to compare.
7# See the defines block below for the environment expected
8
9# outfilename
10printresults() {
11        WALLCLOCKAVG=$(cut -d , -f 2 $1 | tail -n +2 | awk '{a+=$1} END{print a/NR}')
12        SYSAVG=$(cut -d , -f 3 $1 | tail -n +2 | awk '{a+=$1} END{print a/NR}')
13        USERAVG=$(cut -d , -f 4 $1 | tail -n +2 | awk '{a+=$1} END{print a/NR}')
14        echo "Wall=$WALLCLOCKAVG Sys=$SYSAVG User=$USERAVG STDOUTMATCH="
15}
16
17
18TRACES=$HOME/traces
19LIBTRACE=$HOME/mylibtrace/
20TRACESTATS=$LIBTRACE/tools/tracestats/tracestats
21TRACESTATSP=$LIBTRACE/tools/tracestats/tracestats_parallel
22TRACEANON=$LIBTRACE/tools/traceanon/traceanon
23TRACEANONP=$LIBTRACE/tools/traceanon/traceanon_parallel
24TRACESTATSARGS=
25# Large output files are put here such as the output of traceanon, these files
26# are not stored rather a md5sum is kept.
27LARGEOUTPUT=/ramdisk
28TRACEANONARGS=--encrypt-source --encrypt-dest --cryptopan="HereISS0meB1GKey"
29# We push the most useful forward
30TIMEFORMAT=%e,%S,%U,%C,%D,%F,%I,%K,%M,%O,%P,%R,%W,%X,%Z,%c,%k,%p,%r,%s,%t,%w,%x
31CSVHEADINS="num,Wall Clock(e),System Time (S),User Time (U),Command (C),Average unshared data(D),Major page faults (F),I,K,M,O,P,R,W,X,Z,c,k,p,r,s,t,w,exit status (x), outputsum, errorsum"
32
33# Get the current git revision we use this for our output
34cd $LIBTRACE
35GITREV=$(git rev-parse HEAD)
36cd -
37echo "Git revision is $GITREV"
38
39#Name our results
40TIME=$(date +%Y%m%d-%T)
41RESULTSDIR=$TIME-$GITREV
42cd $TRACES
43mkdir $RESULTSDIR
44cd $RESULTSDIR
45
46# Now lets run the timings single threaded
47for tracefile in $TRACES/*.gz
48do
49        OUTFILENAME=$(basename $tracefile)
50        OUTFILENAME=tracestats-$OUTFILENAME.csv
51        echo $CSVHEADINS > $OUTFILENAME
52        # Load this file into memory so disk I/O is less important
53        cat $tracefile > /dev/null
54        echo "Running tracestats (singlethreaded) on $tracefile"
55        for i in {1..5}
56        do
57                printf "\tRun $i : "
58                /usr/bin/time -o times -f "$i,$TIMEFORMAT" $TRACESTATS $TRACESTATSARGS erf:$tracefile 1>$OUTFILENAME.stdout$i 2>$OUTFILENAME.stderr$i
59                STDERRSUM=$(md5sum $OUTFILENAME.stderr$i | cut -f1 -d ' ')
60                STDOUTSUM=$(md5sum $OUTFILENAME.stdout$i | cut -f1 -d ' ')
61                echo "stdout=$STDOUTSUM stderr=$STDERRSUM"
62                TIMESOUTPUT=$(cat times | tr -d "\n")
63                echo "$TIMESOUTPUT,$STDOUTSUM,$STDERRSUM" >> $OUTFILENAME
64                # clean up times
65                rm times
66        done
67        printresults $OUTFILENAME
68done
69
70# Now lets do the parallel version
71for tracefile in $TRACES/*.gz
72do
73        OUTFILENAME=$(basename $tracefile)
74        OUTFILENAME=tracestats_parallel-$OUTFILENAME.csv
75        echo $CSVHEADINS > $OUTFILENAME
76        # Load this file into memory so disk I/O is less important
77        cat $tracefile > /dev/null
78        echo "Running tracestats_parallel on $tracefile"
79        for i in {1..5}
80        do
81                printf "Run $i : "
82                /usr/bin/time -o times -f "$i,$TIMEFORMAT" $TRACESTATSP $TRACESTATSARGS erf:$tracefile 1>$OUTFILENAME.stdout$i 2>$OUTFILENAME.stderr$i
83                STDERRSUM=$(md5sum $OUTFILENAME.stderr$i | cut -f1 -d ' ')
84                STDOUTSUM=$(md5sum $OUTFILENAME.stdout$i | cut -f1 -d ' ')
85                echo "Sums stdout=$STDOUTSUM stderr=$STDERRSUM"
86                TIMESOUTPUT=$(cat times | tr -d "\n")
87                echo "$TIMESOUTPUT,$STDOUTSUM,$STDERRSUM" >> $OUTFILENAME
88                # clean up times
89                rm times
90        done
91        printresults $OUTFILENAME
92done
93
94# Now lets do traceanon
95for tracefile in $TRACES/*.gz
96do
97        OUTFILENAME=$(basename $tracefile)
98        OUTFILENAME=traceanon-$OUTFILENAME.csv
99        echo $CSVHEADINS > $OUTFILENAME
100        # Load this file into memory so disk I/O is less important
101        cat $tracefile > /dev/null
102        echo "Running traceanon on $tracefile"
103        for i in {1..5}
104        do
105                printf "Run $i : "
106                /usr/bin/time -o times -f "$i,$TIMEFORMAT" $TRACEANON $TRACEANONARGS erf:$tracefile erf:$LARGEOUTPUT/output.erf 1>$OUTFILENAME.stdout$i 2>$OUTFILENAME.stderr$i
107                STDERRSUM=$(md5sum $OUTFILENAME.stderr$i | cut -f1 -d ' ')
108                STDOUTSUM=$(md5sum $LARGEOUTPUT/output.erf | cut -f1 -d ' ')
109                # this will be big but we just check the sums
110                rm $LARGEOUTPUT/output.erf
111                echo "Sums stdout=$STDOUTSUM stderr=$STDERRSUM"
112                TIMESOUTPUT=$(cat times | tr -d "\n")
113                echo "$TIMESOUTPUT,$STDOUTSUM,$STDERRSUM" >> $OUTFILENAME
114                # clean up times
115                rm times
116        done
117        printresults $OUTFILENAME
118done
119
120# Now lets do traceanon_parallel
121for tracefile in $TRACES/*.gz
122do
123        OUTFILENAME=$(basename $tracefile)
124        OUTFILENAME=traceanon_parallel-$OUTFILENAME.csv
125        echo $CSVHEADINS > $OUTFILENAME
126        # Load this file into memory so disk I/O is less important
127        cat $tracefile > /dev/null
128        echo "Running traceanon_parallel on $tracefile"
129        for i in {1..5}
130        do
131                printf "Run $i : "
132                /usr/bin/time -o times -f "$i,$TIMEFORMAT" $TRACEANONP $TRACEANONARGS erf:$tracefile erf:$LARGEOUTPUT/output.erf 1>$OUTFILENAME.stdout$i 2>$OUTFILENAME.stderr$i
133                STDERRSUM=$(md5sum $OUTFILENAME.stderr$i | cut -f1 -d ' ')
134                STDOUTSUM=$(md5sum $LARGEOUTPUT/output.erf | cut -f1 -d ' ')
135                # this will be big but we just check the sums
136                rm $LARGEOUTPUT/output.erf
137                echo "Sums stdout=$STDOUTSUM stderr=$STDERRSUM"
138                TIMESOUTPUT=$(cat times | tr -d "\n")
139                echo "$TIMESOUTPUT,$STDOUTSUM,$STDERRSUM" >> $OUTFILENAME
140                # clean up times
141                rm times
142        done
143        printresults $OUTFILENAME
144done
Note: See TracBrowser for help on using the repository browser.