scripts: add profiling test

This commit is contained in:
Roman Zeyde
2015-02-19 14:57:14 +02:00
parent 8fe7f1d716
commit 52ee71fad1

15
scripts/profile.sh Executable file
View File

@@ -0,0 +1,15 @@
#!/bin/bash
set -x -u
SRC=`tempfile`
DST=`tempfile`
AUDIO=`tempfile`
dd if=/dev/urandom of=$SRC bs=1kB count=1000
export BITRATE=80
time python -m cProfile -o send.prof amodem-cli send -l- -vv -i $SRC -o $AUDIO 2> send.log
echo -e "sort cumtime\nstats" | python -m pstats send.prof > send.prof.txt
time python -m cProfile -o recv.prof amodem-cli recv -l- -vv -i $AUDIO -o $DST 2> recv.log
echo -e "sort cumtime\nstats" | python -m pstats recv.prof > recv.prof.txt
diff $SRC $DST || echo "ERROR!"
rm $SRC $DST $AUDIO