first usable plot_cpu_temp_compare.sh

This commit is contained in:
2026-01-30 08:03:00 +01:00
parent 954e387544
commit 34d8ba7214
2 changed files with 26 additions and 45 deletions

2
.gitignore vendored
View File

@@ -1,2 +1,4 @@
*.log *.log
bin/minimal_test.sh

View File

@@ -1,54 +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"
usage() {
local name=${0##*/}
cat <<-EOF
Usage: ${name} [-h || --help] <logfile>i <logfile2> <outfile> <title>
Generates graph of the <logfile> and <logfile2> and writes it to <outfile>
EOF
}
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
usage
exit 0
fi
if [ -z "${ACTIVE_LOG}" ] || [ -z "${ICE_LOG}" ] || [ -z "${OUTFILE}" ]; then if [ -z "${ACTIVE_LOG}" ] || [ -z "${ICE_LOG}" ] || [ -z "${OUTFILE}" ]; then
usage 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