Who is this for?

This is an advanced topic for developers who run llama.cpp on a Raspberry Pi 5 and want to measure the energy each generated token costs.

What will you learn?

After completing this Learning Path, you'll be able to perform the following tasks:

  • Read current and voltage from each Raspberry Pi 5 power rail, and interpret what the rail sum measures.
  • Log timestamped power management integrated circuit (PMIC) power samples to a CSV file and align them with the llama.cpp token-generation phase.
  • Compute joules per token from aligned power samples, with and without idle power subtracted.
  • Compare energy per token across CPU clock caps and thread counts to identify the most efficient inference settings.

Prerequisites

Before starting, you'll need the following prerequisites:

  • A Raspberry Pi 5 running 64-bit Raspberry Pi OS with an active cooler
  • About 1 GB of free disk space for llama.cpp and one GGUF model
  • Familiarity with building software with CMake and running Python scripts on Linux

Summary

AI-assisted

This summary was 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.

Close
?
You’ll measure llama.cpp energy per generated token on a Raspberry Pi 5 using its PMIC readings. First, you’ll check the available power data and read the PMIC rails. You’ll then log timestamped samples and align them with token-generation windows to calculate joules per token, with or without idle power. Finally, you’ll compare clock caps and thread counts across repeated runs, accounting for variation and sampler overhead.
Next