#!/bin/sh # CPU the program spends while the camera streams and nothing is saved: the # tower's installed build against the branch (buffer reuse). Manual mode, one # snapshot to start the stream, then 60 s measured. ~5 min. set -u export GENICAM_GENTL64_PATH=/opt/VimbaX/cti # as scripts/fgc does T=~/thermal-test CFG=$T/manual-config.ini # The tower's config, but starting in manual (still homing: a snapshot needs it). sed 's/^mode = auto/mode = manual/' ~/.config/fire_gimbal_control/config.ini > "$CFG" ln -sf ~/.config/fire_gimbal_control/scan.csv "$T/scan.csv" ln -sfn ~/.config/fire_gimbal_control/camera_profiles "$T/camera_profiles" HZ=$(getconf CLK_TCK) measure() { # label binary FIFO=$T/cmd2.fifo rm -f "$FIFO"; mkfifo "$FIFO" sleep 100000 > "$FIFO" & holder=$! "$2" -c "$CFG" --no-tui --no-mqtt --no-log-file < "$FIFO" > "$T/stream_$1.log" 2>&1 & pid=$! sleep 60 # start + homing echo snapshot > "$FIFO" sleep 15 # the snapshot saved; the stream keeps running a=$(awk '{print $14 + $15}' /proc/$pid/stat) sleep 60 b=$(awk '{print $14 + $15}' /proc/$pid/stat) echo "$1: $(echo "scale=1; 100 * ($b - $a) / $HZ / 60" | bc) % of one core while streaming" kill -TERM "$pid"; sleep 10; kill "$holder" 2>/dev/null; sleep 3 kill -0 "$pid" 2>/dev/null && kill -KILL "$pid" rm -f "$FIFO" } measure installed ~/projects/fwt_2a/software/build/fire_gimbal_control measure branch $T/software/build/fire_gimbal_control