HexaCone/tools/plot-timing.sh

64 lines
1.4 KiB
Bash
Raw Normal View History

2025-01-05 10:41:14 +11:00
#!/bin/bash
set -ue
TMPFILE="/dev/shm/plot-timing.tmp"
IMAGE="timing.png"
2025-01-12 06:37:54 +11:00
if [ $# == 1 ]
then
sequence=$1
else
sequence="escadrille"
fi
2025-01-16 08:13:42 +11:00
echo "plot timing $sequence" | tee -a WS/log
# wc WS/mp4.timing | tee -a WS/log
grep $sequence WS/mp4.timing | tail -3600 | awk ' \
2025-01-05 10:41:14 +11:00
BEGIN { \
nbrames=360; \
for (foo=0; foo<nbrames; foo++) { \
mini[foo] = 666; \
maxi[foo] = -42; \
count[foo] = 0; \
} \
} \
\
{ \
accu[$2] += $3; \
count[$2]++; \
if (mini[$2] > $3) mini[$2] = $3; \
if (maxi[$2] < $3) maxi[$2] = $3; \
} \
\
END { \
for (foo=0; foo<nbrames; foo++) { \
if (count[foo] > 0) { \
mean = accu[foo] / count[foo]; \
printf "%4d %4f %4d %4d\n", foo, mean, \
mini[foo], maxi[foo]; \
} \
} \
} \
' > $TMPFILE
# cat -n $TMPFILE | tail # ; exit
gnuplot << __EOC__
set term png size 1024,768
set output "timing.png"
set grid
set xrange [:360]
set yrange [0:]
2025-01-12 06:37:54 +11:00
set title "Séquence '${sequence}'"
2025-01-05 10:41:14 +11:00
set xlabel "numéro de la trame"
set ylabel "temps en secondes"
2025-01-12 06:37:54 +11:00
plot "/dev/shm/plot-timing.tmp" u 1:4 w l lc "#ff0000" t "maximum", \
"/dev/shm/plot-timing.tmp" u 1:3 w l lc "#0000ff" t "minimum", \
"/dev/shm/plot-timing.tmp" u 1:2 w l lc "#000000" t "moyenne",
2025-01-05 10:41:14 +11:00
__EOC__
2025-01-12 06:37:54 +11:00
convert -negate -colorspace gray -level -33% $IMAGE WS/negatif.png
2025-01-05 10:41:14 +11:00