HexaCone/tools/plot-timing.sh

76 lines
1.5 KiB
Bash
Raw Normal View History

2025-01-05 10:41:14 +11:00
#!/bin/bash
set -ue
2025-01-27 05:32:18 +11:00
source tools/config.sh
2025-01-05 10:41:14 +11:00
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-27 05:32:18 +11:00
# echo "plot timing $sequence" >> WS/log
2025-01-16 08:13:42 +11:00
2025-01-27 05:32:18 +11:00
grep $sequence WS/mp4.timing | tail -3600 | awk \
-v nbframes=$NBFRAMES \
' \
2025-01-05 10:41:14 +11:00
BEGIN { \
2025-01-27 05:32:18 +11:00
# print "nb frames = ", nbframes; \
for (foo=0; foo<nbframes; foo++) { \
2025-01-05 10:41:14 +11:00
mini[foo] = 666; \
maxi[foo] = -42; \
count[foo] = 0; \
} \
} \
2025-02-10 14:14:38 +11:00
# for every line \
2025-01-05 10:41:14 +11:00
{ \
accu[$2] += $3; \
count[$2]++; \
if (mini[$2] > $3) mini[$2] = $3; \
2025-02-10 14:14:38 +11:00
if (maxi[$2] < $3) maxi[$2] = $3;
last[$2] = $3 \
2025-01-05 10:41:14 +11:00
} \
\
END { \
2025-01-27 05:32:18 +11:00
for (foo=0; foo<nbframes; foo++) { \
2025-01-05 10:41:14 +11:00
if (count[foo] > 0) { \
mean = accu[foo] / count[foo]; \
2025-02-10 14:14:38 +11:00
printf "%4d %4f %4d %4d %4d\n",
foo, mean,
mini[foo], maxi[foo],
last[foo];
2025-01-05 10:41:14 +11:00
} \
} \
} \
' > $TMPFILE
2025-01-27 05:32:18 +11:00
# head $TMPFILE ; exit
2025-01-05 10:41:14 +11:00
gnuplot << __EOC__
2025-01-27 05:32:18 +11:00
set term png size $Img_Width,$Img_Height
2025-01-05 10:41:14 +11:00
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-02-10 14:14:38 +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 "#00ff00" t "moyenne", \
"/dev/shm/plot-timing.tmp" u 1:5 w l \
lc "#000000" t "last"
2025-01-05 10:41:14 +11:00
__EOC__
2025-01-27 05:32:18 +11:00
convert -negate -level -33% $IMAGE WS/negatif.png
2025-01-05 10:41:14 +11:00