11 Commits
0.1 ... 1.00

Author SHA1 Message Date
dcd6806e72 updated inline help
added check if gnuplot is installed correctly.
2026-02-06 07:13:36 +01:00
8f7fe4f016 added label for T(max) to chart. 2026-02-02 09:54:12 +01:00
114a194758 enhanced .gitignore 2026-02-02 07:29:00 +01:00
08acce525b enhanced command line parsing. 2026-02-01 10:21:35 +01:00
34d8ba7214 first usable plot_cpu_temp_compare.sh 2026-01-30 08:03:00 +01:00
954e387544 updated README.md 2026-01-24 10:26:20 +01:00
f22b2a8e82 added .gitignore 2026-01-24 09:15:44 +01:00
e9da74e3c8 added usage() 2026-01-24 09:14:36 +01:00
fb803c13f0 added usage to measure_temp.sh
run-cpu-stress.sh uses the  job file in fio.
2026-01-24 06:20:50 +01:00
b8c8a18db3 added script for mesuring core temperature and generating log file. 2026-01-24 05:54:27 +01:00
87540bf04b Script for stressing and measure temperature added. 2026-01-24 05:52:36 +01:00
6 changed files with 178 additions and 47 deletions

6
.gitignore vendored Normal file
View File

@@ -0,0 +1,6 @@
*.log
*.bak
*.png
bin/minimal_test.sh

View File

@@ -1,3 +1,5 @@
# pistress # pistress
Measure the CPU core temperature on a Raspberry Pi on full load A bunch of scripts for measuring the core temperature of the Raspberry Pi 5 CPU under full load
and plotting graphs .
Requirements: fio, gnuplot

26
bin/measure_temp.sh Executable file
View File

@@ -0,0 +1,26 @@
#!/bin/bash
START=$(date +%s)
usage() {
local name=${0##*/}
cat <<-EOF
Usage: ${name} [-h || --help]
measures the pu core temperature an echoes with a squenence number to stdout.
EOF
}
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
usage
exit 0
fi
while true; do
NOW=$(date +%s)
TS=$((NOW - START))
TEMP=$(vcgencmd measure_temp | sed 's/[^0-9.]//g')
echo "$TS $TEMP"
sleep 1
done

View File

@@ -1,28 +1,126 @@
#!/bin/bash #!/bin/bash
VERSION="1.00"
usage() {
local name=${0##*/}
cat <<-EOF
Version: ${VERSION}
Usage: ${name}
-h, --help display this help
-l, --logfile <logfile> logfile with temperature data to be plotted
-o, --output <output.png> output file the plotted chart should be written to
-c, --color <colorname> color in which the ghraph should be plotted ('red','blue'dtc.) defaults to 'red'
-t, --title <title> title of the graph
-v, --verbose verbose mode (not implemented yet)
Plots the graph of the <logfile> and writes it to <outfile>
<logfile> must contain
timestamp temperature
in seperate lines
EOF
}
check() {
if ! command -v gnuplot >/dev/null 2>&1; then
echo "gnuplot is not installed."
echo "Please use"
echo " sudo apt install -y gnuplot"
echo "and try again"
exit 5
fi
}
verbose=false
COLOR='red'
PADDING=5
VALID_ARGS=$(getopt -o vho:c:t:l: --long verbose,help,output,color:,title:,logfile: -- "$@")
if [[ $? -ne 0 ]]; then
exit 1;
fi
eval set -- "$VALID_ARGS"
while [ : ]; do
case "$1" in
-h | --help)
usage
exit 0
shift
;;
-l | --logfile)
LOGFILE="${2}"
echo "LOGFILE=${LOGFILE}"
shift 2
;;
-o | --output)
OUTFILE="${2}"
shift 2
;;
-c | --color)
COLOR="${2}"
shift 2
;;
-t | --title)
TITLE="${2}"
shift 2
;;
-v | --verbose)
verbose=true
shift
;;
--) shift;
break
;;
esac
done
check
#determine max and min values
read YMIN YMAX < <(
awk '
NR==1 { min=$2; max=$2 }
$2 < min { min=$2 }
$2 > max { max=$2 }
END { printf "%.1f %.1f\n", min, max }
' "${LOGFILE}"
)
echo "YMIN=${YMIN} YMAX=${YMAX}"
echo "Parameter geparsed."
# Eingabeparameter # Eingabeparameter
LOGFILE="${1}"
OUTFILE="${2}"
TITLE="${3}"
if [ -z "$LOGFILE" ] || [ -z "$OUTFILE" ] || [ -z "$TITLE" ]; then if [ -z "$LOGFILE" ] || [ -z "$OUTFILE" ] || [ -z "$TITLE" ]; then
echo "Usage: ${0} <temp.log> <output.png> <title>" usage
exit 1 exit 1
fi fi
gnuplot <<EOF echo "generating plot from ${LOGFILE}"
set terminal pngcairo size 1600,900 gnuplot \
set output "$OUTFILE" -e "OUTFILE='${OUTFILE}'" \
-e "LOGFILE='${LOGFILE}'" \
-e "TITLE='${TITLE}'" \
-e "COLOR='${COLOR}'" \
-e "YMAX=${YMAX}" \
-e "PADDING=${PADDING}" \
-e "YMIN=${YMIN}" \
-e "
set terminal pngcairo size 1800,800;
set output OUTFILE;
set title TITLE;
set xlabel 'Zeit (s)';
set ylabel 'Temperatur (°C)';
set grid;
set key top left;
set title "$TITLE" set label sprintf('Tmax: %.1f°C', YMAX-PADDING) at graph 0.98,0.02 right;
set xlabel "Zeit (s)"
set ylabel "Temperatur (°C)" plot LOGFILE using 1:2 with lines lc rgb COLOR lw 2 title 'CPU-Temperatur';
set grid "
set key top left
# Linie rot, Dicke 2
plot "$LOGFILE" using 1:2 with lines lc rgb "red" lw 2 title "CPU-Temperatur"
EOF
echo "Plot erzeugt: $OUTFILE" echo "Plot erzeugt: $OUTFILE"
exit 0

View File

@@ -1,39 +1,33 @@
#!/bin/bash #!/bin/bash
ACTIVE_LOG="${1}" ACTIVE_LOG="$1"
ICE_LOG="${2}" ICE_LOG="$2"
OUTFILE="${3}" OUTFILE="$3"
TITLE="${4} TITLE="$4"
if [ -z "${ACTIVE_LOG}" ] || [ -z "${ICE_LOG}" ] || [ -z "${OUTFILE}" ]; then if [ -z "${ACTIVE_LOG}" ] || [ -z "${ICE_LOG}" ] || [ -z "${OUTFILE}" ]; then
echo "Usage: $0 <temp_active.log> <temp_ice.log> <output.png>" echo "Usage: $0 <temp_active.log> <temp_ice.log> <output.png> [title]"
exit 1 exit 1
fi fi
echo "ACTIVE_LOG=${ACTIVE_LOG}"
echo "ICE_LOG=${ICE_LOG}"
echo "OUTFILE=${OUTFILE}"
echo "TITLE=${TITLE}"
gnuplot <<EOF gnuplot -e "
set terminal pngcairo size 1800,800 set terminal pngcairo size 1800,800;
set output "${OUTFILE}" set output '${OUTFILE}';
set multiplot layout 1,2 title '${TITLE}';
set xlabel 'Zeit (s)';
set ylabel 'Temperatur (°C)';
set grid;
set key top left;
set yrange [0:100];
set title 'Active Cooler';
plot '${ACTIVE_LOG}' using 1:2 with lines lc rgb 'red' lw 2 title 'CPU-Temperatur';
set title 'Ice Tower Cooler 5';
plot '${ICE_LOG}' using 1:2 with lines lc rgb 'blue' lw 2 title 'CPU-Temperatur';
unset multiplot;
"
set multiplot layout 1,2 title "${TITLE}"
set xlabel "Zeit (s)"
set ylabel "Temperatur (°C)"
set grid
set key top left
# Einheitliche Y-Achse für fairen Vergleich
set yrange [30:90]
# Plot 1: Active Cooler
set title "Active Cooler"
plot "$I{ACTIVE_LOG}" using 1:2 with lines lc rgb "red" lw 2 title "CPU-Temperatur"
# Plot 2: Ice Tower Cooler
set title "Ice Tower Cooler 5"
plot "${ICE_LOG}" using 1:2 with lines lc rgb "blue" lw 2 title "CPU-Temperatur"
unset multiplot
EOF
echo "Vergleichsplot erzeugt: ${OUTFILE}"
exit 0 exit 0

5
bin/run-cpu-stress.sh Executable file
View File

@@ -0,0 +1,5 @@
measure_temp.sh > ${1} &
TPID=$!
fio ~/git/pistress/fio/fio_cpu
kill $TPID > /dev/null