mirror of
https://github.com/toradex/rt-validation.git
synced 2025-07-07 11:38:47 +00:00
stress-tests: Improve stressing
*hackbench* doesn't produce much load on a SMP system. A better way to stress the CPU is copying data from /dev/zero to /dev/null. Running *du* and *find* doesn't stress Linux very much. Most of it is optimised through caches. Better: run *dd* to copy the whole block device to /dev/null. To stress the network interface (but not your internet connection) send massive pings to the gateway. In a docker container this might be the system itself which wouldn't load the NIC. With the environment variable STRESS_SERVER you can set a different address. The tool *ip* used to find the gateway is in the package iproute2.
This commit is contained in:
parent
1a880a38f6
commit
95cc35b4e8
@ -4,7 +4,7 @@ ARG IMAGE_TAG=2-bullseye
|
||||
FROM --platform=$IMAGE_ARCH torizon/debian:$IMAGE_TAG
|
||||
|
||||
RUN apt update \
|
||||
&& apt install -y --no-install-recommends iperf3 rt-tests iputils-ping \
|
||||
&& apt install -y --no-install-recommends iperf3 rt-tests iputils-ping iproute2 \
|
||||
&& apt clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
|
@ -3,11 +3,14 @@
|
||||
echo "Setting up stress tests..."
|
||||
|
||||
# CPU load
|
||||
while true; do hackbench >/dev/null 2>&1; done &
|
||||
for i in $(seq $(nproc)); do dd if=/dev/zero of=/dev/null bs=4M & done
|
||||
|
||||
# I/O load (eMMC read)
|
||||
while true; do du /usr >/dev/null 2>&1; done &
|
||||
while true; do find / -name a* >/dev/null 2>&1; done &
|
||||
# I/O read load
|
||||
for dev in /dev/mmcblk? /dev/sd?; do
|
||||
test -b "$dev" || continue
|
||||
|
||||
while true; do dd if="$dev" of=/dev/null bs=4M; done &
|
||||
done
|
||||
|
||||
# I/O load (USB read/write)
|
||||
if mount | grep /mnt/pendrive >/dev/null; then
|
||||
@ -37,6 +40,9 @@ while true; do
|
||||
done
|
||||
done &
|
||||
|
||||
ping -A -f -t 3 -q -s 49152 \
|
||||
${STRESS_SERVER:-$(ip route get 1.1.1.1 |sed '/.* via \([^ ]*\) .*/ s//\1/; q')}
|
||||
|
||||
echo "RT stress tests started successfully!"
|
||||
|
||||
# Dont exit
|
||||
|
Loading…
Reference in New Issue
Block a user