Measure llama.cpp energy per token on a Raspberry Pi 5
Review frequently asked questions
These FAQs were drafted with an approved AI-assisted workflow and reviewed by Arm contributors before publication. Human technical review remains part of the process so the final page reflects engineering rigor, accuracy, and Arm editorial standards.
You can list the sensors under
/sys/class/hwmon/ and check for power or current files. On the Raspberry Pi 5, you use vcgencmd pmic_read_adc to read current and voltage from the onboard PMIC rails instead.You choose the output CSV path when you run
pmic_sampler.py, for example idle.csv in your working directory. In your CSV, each row contains time_s, total_W, and a watts column for each rail with both current and voltage readings.When you run
energy_per_token.py, it starts the sampler before llama-bench. You can trace each generation window from the script timestamp for a --progress start marker, and the corresponding samples_ns duration. The script selects samples inside that window.Multiply the mean power during a generation window by its duration, then divide by the generated token count for
J/token. For net_J/token, subtract the measured idle baseline from the mean window power before multiplying and dividing.Set
scaling_max_freq and check scaling_cur_freq during token generation to confirm the cap. Then, repeat the sweep at least five times, alternating the setting order. Compare J/token and net_J/token separately, and avoid ranking settings whose differences fall within run-to-run variation.