From: jjenista Date: Fri, 21 Oct 2011 23:55:04 +0000 (+0000) Subject: instrument an injected error and plot differences in output samples X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=13131e7629875b0529ed77d70ea02e0a893103da;p=IRC.git instrument an injected error and plot differences in output samples --- diff --git a/Robust/src/Benchmarks/SSJava/MP3Decoder/Player.java b/Robust/src/Benchmarks/SSJava/MP3Decoder/Player.java index b418fc1e..7b2f8beb 100644 --- a/Robust/src/Benchmarks/SSJava/MP3Decoder/Player.java +++ b/Robust/src/Benchmarks/SSJava/MP3Decoder/Player.java @@ -71,6 +71,10 @@ public class Player { @LOC("B") private int lastPosition = 0; + + private long sampleNumber; + + /** * Creates a new Player instance. */ @@ -117,6 +121,9 @@ public class Player { @LOC("THIS,Player.ST") Header h = BitstreamWrapper.readFrame(); decoder.init(h); + sampleNumber = 1; + System.out.println( "Gobble sentinel: +++" ); + @LOC("IN") int count = 0; SSJAVA: while (count++ < 2147483646) { if (h == null) { @@ -178,6 +185,7 @@ public class Player { return 0; } + /** * Decodes a single frame. * @@ -208,9 +216,17 @@ public class Player { // System.out.println(outbuf[i]); sum += outbuf[i]; } - System.out.println(sum); + //System.out.println(sum); // + int stride = outbuf.length / 100; + for( int i = 0; i < 100; ++i ) { + System.out.println( sampleNumber+" "+outbuf[i*stride] ); + sampleNumber++; + } + + + // synchronized (this) // { // out = audio; diff --git a/Robust/src/Benchmarks/SSJava/MP3Decoder/makefile b/Robust/src/Benchmarks/SSJava/MP3Decoder/makefile index 503e2d11..b82df16b 100644 --- a/Robust/src/Benchmarks/SSJava/MP3Decoder/makefile +++ b/Robust/src/Benchmarks/SSJava/MP3Decoder/makefile @@ -3,16 +3,31 @@ BUILDSCRIPT=../../../buildscript PROGRAM=MP3Player SOURCE_FILES=MP3Player.java -BSFLAGS= -32bit -ssjava -mainclass $(PROGRAM) -heapsize-mb 1000 -nooptimize -debug -garbagestats -ssjavadebug #-printlinenum #-joptimize +SSJAVA= -ssjava -ssjavadebug +BSFLAGS= -32bit -mainclass $(PROGRAM) -heapsize-mb 1000 -nooptimize -debug -garbagestats #-printlinenum #-joptimize +NORMAL= -ssjava-inject-error 0 0 +INJECT_ERROR= -ssjava-inject-error 1000 12345 + default: $(PROGRAM)s.bin +normal: $(PROGRAM)n.bin + +error: $(PROGRAM)e.bin + + $(PROGRAM)s.bin: $(SOURCE_FILES) makefile - $(BUILDSCRIPT) $(BSFLAGS) -o $(PROGRAM) -builddir sing $(SOURCE_FILES) + $(BUILDSCRIPT) $(SSJAVA) $(BSFLAGS) -o $(PROGRAM)s -builddir ssj $(SOURCE_FILES) + +$(PROGRAM)n.bin: $(SOURCE_FILES) makefile + $(BUILDSCRIPT) $(NORMAL) $(BSFLAGS) -o $(PROGRAM)n -builddir norm $(SOURCE_FILES) + +$(PROGRAM)e.bin: $(SOURCE_FILES) makefile + $(BUILDSCRIPT) $(INJECT_ERROR) $(BSFLAGS) -o $(PROGRAM)e -builddir injerr $(SOURCE_FILES) clean: - rm -f $(PROGRAM).bin - rm -fr sing + rm -f $(PROGRAM)s.bin $(PROGRAM)n.bin $(PROGRAM)e.bin + rm -fr ssj norm injerr rm -f *~ rm -f *.dot rm -f *.png diff --git a/Robust/src/Benchmarks/SSJava/MP3Decoder/mp3samples2plotData.sh b/Robust/src/Benchmarks/SSJava/MP3Decoder/mp3samples2plotData.sh new file mode 100755 index 00000000..63d01ca8 --- /dev/null +++ b/Robust/src/Benchmarks/SSJava/MP3Decoder/mp3samples2plotData.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +X=converterTempFile + +# first gobble up any lines of SSJAVA talk +# then the benchmark's preamble up to the sentinel: +++ +sed -e '/^SSJAVA:/ d' -e '1,/+++/ d' $1 > $X + +mv $X $1 diff --git a/Robust/src/Benchmarks/SSJava/MP3Decoder/nve.cmds b/Robust/src/Benchmarks/SSJava/MP3Decoder/nve.cmds new file mode 100644 index 00000000..3f80abea --- /dev/null +++ b/Robust/src/Benchmarks/SSJava/MP3Decoder/nve.cmds @@ -0,0 +1 @@ +plot "normal.txt" with lines, "error.txt" with lines, "nve-diff-ranges.tmp" with steps axes x1y2 diff --git a/Robust/src/Benchmarks/SSJava/MP3Decoder/plot-normal-vs-error.sh b/Robust/src/Benchmarks/SSJava/MP3Decoder/plot-normal-vs-error.sh new file mode 100755 index 00000000..ff58ff93 --- /dev/null +++ b/Robust/src/Benchmarks/SSJava/MP3Decoder/plot-normal-vs-error.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +D=nve-diff.tmp +diff normal.txt error.txt > $D + +X=nve-diff-ranges.tmp +echo '0 1' > $X +echo '0 0' >> $X + +#diff normal.txt error.txt | \ +#sed \ +#-e '/^[^0-9]/ d' \ +#-e 's/\(.*\),\(.*\)c.*/\1 0\n\1 1\n\2 1\n\2 0/' \ +#-e 's/\(.*\)c.*/\1 0\n\1 1\n\1 1\n\1 0/' \ +#>> $X + +sed \ +-e '/^[^0-9]/ d' \ +-e 's/\(.*\),\(.*\)c.*/\1 0\n\1 1\n\2 1\n\2 0/' \ +-e 's/\(.*\)c.*/\1 0\n\1 1\n\1 1\n\1 0/' \ +$D >> $X + +if [[ -s $D ]] +then + echo 'Normal and Error files differ.' +else + echo 'NO DIFF!' +fi + +gnuplot -persist nve.cmds + +rm -f $D $X diff --git a/Robust/src/Benchmarks/SSJava/MP3Decoder/run-error.sh b/Robust/src/Benchmarks/SSJava/MP3Decoder/run-error.sh new file mode 100755 index 00000000..fabe0d4f --- /dev/null +++ b/Robust/src/Benchmarks/SSJava/MP3Decoder/run-error.sh @@ -0,0 +1,4 @@ +#!/bin/bash +MP3Playere.bin focus.mp3 > error.txt + +mp3samples2plotData.sh error.txt \ No newline at end of file diff --git a/Robust/src/Benchmarks/SSJava/MP3Decoder/run-normal.sh b/Robust/src/Benchmarks/SSJava/MP3Decoder/run-normal.sh new file mode 100755 index 00000000..98581085 --- /dev/null +++ b/Robust/src/Benchmarks/SSJava/MP3Decoder/run-normal.sh @@ -0,0 +1,4 @@ +#!/bin/bash +MP3Playern.bin focus.mp3 > normal.txt + +mp3samples2plotData.sh normal.txt \ No newline at end of file