🛠 Surveillance fréquence et charge CPU
Objectives
Set up system monitoring for the ODROID-C2: actual per-core CPU frequency via cpufreq, load, and temperature — taking into account a peculiarity of the S905: no thermal sensor exposed by the mainline kernel (the U-Boot amlogic matrix indicates "Thermal Sensor: No"), so monitoring focuses on frequency, load, and potential throttling.
Hardware
- ODROID-C2 running Armbian/mainline, ventilated case or heatsink (the S905 handles heat but gets hot)
- SSH console
- sysstat package (mpstat) optional
- >
Complete code
#!/usr/bin/env bash
# surveil.sh — journalise frequence CPU, charge et temperature si disponible
LOG=/var/log/c2-surveillance.csv
echo "horodatage,cpu0_khz,cpu3_khz,load1,temp" > $LOG
while :; do
f0=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq 2>/dev/null || echo NA)
f3=$(cat /sys/devices/system/cpu/cpu3/cpufreq/scaling_cur_freq 2>/dev/null || echo NA)
l1=$(cut -d' ' -f1 /proc/loadavg)
t=$(cat /sys/class/thermal/thermal_zone*/temp 2>/dev/null | head -n1 || true)
echo "$(date -Is),$f0,$f3,$l1,${t:-absente}" >> $LOG
sleep 10
done
# charge max volontaire pour observer le comportement (4 coeurs, 60 s)
timeout 60 sh -c 'for i in 1 2 3 4; do : & done; wait'
# governor : performance pour un serveur, powersave/ondemand sinon
sudo cpupower frequency-set -g performance
Expected verification
The CSV fills up every 10 s. Under intentional load, load1 rises towards 4 and scaling_cur_freq displays 1,500,000 kHz (the C2's fusion frequency, not the 2 GHz from the S905 datasheet). In mainline, the temperature column remains "absent": this is expected, not a failure. No DVFS SCPI either: the frequency is quasi-fixed depending on the governor.
Common errors
- Desperately searching for /sys/class/thermal on mainline: the sensor is not exposed; rely on loadavg + frequency + case feel.
- Confusing 1.5 GHz (C2 fusion) and 2.0 GHz (S905 datasheet): the board will never reach 2 GHz.
- Storing the CSV on a cheap microSD card with continuous writes: premature wear; prefer eMMC or tmpfs with rotation.
- Forgetting that cpupower may be missing (install linux-tools/cpupower depending on the distribution).
Other tutorials for this board
Code examples for this board
clignotante.pyPythonbouton-gpio.pyPythoncapteur-i2c.shBashsurveillance-temperature.shBashcapteur-dht11.pyPythonservo-pwm-sysfs.shBash