Inspect the benchmark summary
After capturing performance data, you have a directory with the timestamp of when you ran the benchmark, named runtime-perf-TIMESTAMP/. This directory is under $WORK/data/. Open runtime-perf-TIMESTAMP/ and inspect the summary.txt file.
This text file contains the following useful information about the benchmark:
- Duration
- Number of inference calls
- Number of measurement samples
- Device information
Check the following fields in the job summary:
device_serial: Ensure that it matches your target device. If not, repeat the device setup steps.package_name: Ensure that it’scom.google.aiedge.examples.phototalk. If not, check the application setup.inference_count: Ensure that it’s greater than zero. If not, check that the instrumented build is installed and the engine is initialized. Also confirm that you sent prompts while the monitor was running.power_source: Ensure that it identifies eitherperfetto_batteryorbattery_sysfs_fallback. A value ofunavailablemeans the device didn’t expose both current and voltage readings. The rest of the capture is still valid.
Download the plotting scripts
Download the four plotting scripts into $WORK/plots/:
mkdir -p "$WORK/plots"
cd "$WORK/plots"
curl -fL -O "$BASE_URL/inference_plot.py"
curl -fL -O "$BASE_URL/temperature_time_plot.py"
curl -fL -O "$BASE_URL/memory_time_plot.py"
curl -fL -O "$BASE_URL/power_time_plot.py"
Visualise the latest benchmark
The plotting scripts use pandas to load the CSV files and Matplotlib to create the figures.
Create a new Jupyter Notebook section titled Visualise performance data.
Install both packages from a new notebook cell if they aren’t already available:
%pip install pandas matplotlib
Create another cell and add this Python code:
from IPython.display import Image, display
from pathlib import Path
import subprocess
import sys
ROOT = Path.cwd().resolve()
DATA_DIR = ROOT / "data"
PLOTS_DIR = ROOT / "plots"
run_dirs = sorted(DATA_DIR.glob("runtime-perf-*"))
if not run_dirs:
raise FileNotFoundError(f"No benchmark runs found in {DATA_DIR}")
run_dir = run_dirs[-1]
FIGURES_DIR = run_dir / "figures"
plot_scripts = [
"inference_plot.py",
"temperature_time_plot.py",
"memory_time_plot.py",
"power_time_plot.py",
]
for script_name in plot_scripts:
result = subprocess.run(
[
sys.executable,
str(PLOTS_DIR / script_name),
"--run-dir",
str(run_dir),
"--output-dir",
str(FIGURES_DIR),
],
check=False,
)
if result.returncode:
print(f"Warning: {script_name} failed with exit code {result.returncode}")
for figure_path in sorted(FIGURES_DIR.glob("*.png")):
display(Image(filename=str(figure_path)))
This cell selects the newest timestamped benchmark directory and creates data plots under the $WORK/data/runtime-perf-TIMESTAMP/figures/ directory. A plotting script prints a warning if its device-specific source contains no samples.
Run the cell and inspect the available figures to visualise the following performance measurements:
- Time to first token (TTFT), prefill, and decode speed by prompt length
- Mean CPU-sensor temperature over time, or the mean of all reported thermal sensors when no CPU sensor is identified
- Application resident memory over time
- Estimated whole-device battery power over time
What you’ve accomplished and what’s next
You’ve converted the measurements from your benchmark into figures that show inference performance and device behavior over time.
Next, you’ll learn how to interpret the results that you’ve gathered.