chinyakao / camera_stress_test_tool

0 stars 0 forks source link

[WHISHLIST] have a script to run gst stress #2

Open chinyakao opened 5 days ago

chinyakao commented 5 days ago

User can set the stress cycle e.g., run_gst_stress.sh -c 50

for i in {1..100}
do
        sudo gst-launch-1.0 icamerasrc ! autovideosink&
        sleep 10

        sudo killall gst-launch-1.0
        sleep 2
done
hicruby commented 2 days ago
#set default count
MAX_COUNT=100

#parse parameters
while getopts "c:" opt; do
 case $opt in
   c) MAX_COUNT=$OPTARG ;;  #set the maximum count
   *)
     echo "Usage: $0 [-c count]"
     exit 1
     ;;
 esac
done

#confirm MAX_COUNT a positive integer
if ! [[ "$MAX_COUNT" =~ ^[0-9]+$ ]]; then
 echo "Error: Count must be a positive integer."
 exit 1
fi

#execute loop
for ((i = 1; i <= MAX_COUNT; i++)); do
 echo "Running iteration $i..."
 sudo gst-launch-1.0 icamerasrc ! autovideosink &
 sleep 10
 sudo killall gst-launch-1.0
 sleep 2
done