Created
February 6, 2020 11:08
-
-
Save Hermann-SW/3ce6b67fa9d485b63c1a648217b45e3a to your computer and use it in GitHub Desktop.
profiling bash script for work with rgba2fb.c (https://www.raspberrypi.org/forums/viewtopic.php?f=43&t=264109)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [[ rgb2fb.c -nt rgb2fb ]]; then | |
echo "compiling rgb2fb.c"; gcc -O6 -Wall -pedantic -Wextra rgb2fb.c -o rgb2fb | |
fi | |
if [[ "$#" > 0 ]]; then t=$1; else t=600000; fi | |
raspividyuv -fps 135 -rgb -o - -pts $0.pts \ | |
-md 7 -w 640 -h 480 -n -t $t -awb greyworld | \ | |
./rgb2fb 640 480 0 2> $0.txt | |
if [[ "$#" < 2 ]]; then exit; fi | |
paste -d";" \ | |
<(echo " fread[us]" && | |
awk 'NR%2==1 { printf "%6s\n",int($1/1000)"xxx" }' $0.txt | sort -n | uniq -c | |
) \ | |
<(echo " fill[us]" && | |
awk 'NR%2==0 { printf "%6s\n",int($1/100)"xx" }' $0.txt | sort -n | uniq -c | |
) \ | |
<(awk 'NR==1 { } | |
NR==2 { print ",0"; old=$1 } | |
NR>2 { print int(1000*($1-old)+0.5); old=$1 } | |
' $0.pts > $0.csv | |
us=`cat $0.csv | sort -n | uniq -c | sort -n | tail -1 | cut -b9-` | |
l=`wc --lines $0.csv | cut -f1 -d\ ` | |
fps=$((1000000 / $us)) | |
echo " $l frames were captured at ${fps}fps" | |
echo " frame delta[us]" | |
cat $0.csv | cut -f1 -d, | sort -n | uniq -c | |
) | sed 's/^;/ ;/;s/;;/; ;/' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment