What this is about
You run a program on a phone, you read a time, and you think you know how fast it is. You do not, yet. A phone slows down when it gets hot. A charger can hide how much power the program uses. The first second of a run is slower than the rest. Another app may be busy in the background.
This article lists the habits we use so a phone number means something. They come from our own measurements on a Xiaomi 17 Ultra, a phone with an Adreno 840 graphics chip.
Why it matters
A wrong number is worse than no number. If you decide a change made a program faster, and it was only the phone cooling down, you keep a change that does nothing. If you decide it is slower, you throw away a good idea.
The same habits help on any computer, but a phone shows the problem clearly, because its heat and battery limits are tight.
How to do it, step by step
1. Take the cable out for energy tests. A phone on a charger gets its power from the charger, so a power reading hides the load. In our test, a stream kernel on USB read 0.65 W. With the cable out and the phone on its battery, the same kernel added about 1.42 W over an idle phone, which sat near 0.14 W. A sweep of load levels on the cable gave 0.07, 0.17, 0.54 and 0.65 W, with no clear bend. That flat shape is what a charger hiding the load looks like.
2. Let the phone cool first. Our energy runs wait until the graphics chip is under 34 C, and then wait six seconds of idle. Heat slows a chip down, so a hot start gives slower numbers.
3. Warm up, then throw away the first second. Each version of a kernel ran for four seconds of back-to-back batches. We dropped the first second and kept the best per-second time. A batch right after the build saw idle clocks. In one case, a kernel took 173 microseconds cold and 143 after one second of work. Without the warm-up, we would have compared a cold run with a warm one.
4. Take the best of several rounds. We took the best of five rounds for timing. The best round is the one least disturbed by background work.
5. Run your measurement twice, and learn your noise. Two energy runs of the same kernel differed by 1 percent for one version and 5 percent for another. So we do not count an energy difference under 5 percent as a result.
6. Check the answer too. Every version of the kernel had to produce the same checksum on the same input. A faster kernel with a wrong answer is not faster. In our tests, one full-wave variant reported 141.8 microseconds, but its checksum was half the right one, so we marked it invalid.
How corewait reads a phone
Our profiler, corewait, asks a processor why it waits. On a Linux desktop it uses the perf tool. On the phones, it uses simpleperf, in user space only, with events whose names end in :u. It records samples, joins them to the program's instructions and gives each row a cause: memory, branch, dependency, front end or busy.
You build the probe on your desktop with corewait build DEV, which cross-compiles it for the phone, and then record on the device. A phone is a good place to use it because a fix that works on a desktop may not help on a phone, and the cause tells you why.
What we could not see
The phone hid its own counters. Without root, the route to the graphics chip's hardware counters returned a permission error. Turning on the driver flag that would open them power-cycles the chip, so we left it alone. The Vulkan performance query extension is not offered. The power monitor lists a graphics rail, but every rail read zero, idle and under load. The battery details are denied to the shell.
So our energy figure is the extra power the whole phone draws while the kernel runs. It includes the graphics chip, memory traffic and the processor thread that queues the work. It is not a graphics-only number, and we say so wherever we report it.
We also do not know why one of our phones, a OnePlus, fell below 0.7 of its median on 3 of 20 runs, with a spread up to 59 percent on one measurement. We report that as an open question and not as a finished result.
What we found with these habits
With the rules above, one change to a matrix-vector kernel mattered. The baseline took 160.8 microseconds at 4096 by 4096. A version that did its block dot product with packed integer instructions took 144.4 microseconds, which is 10 percent less. It also used 0.310 mJ per run at 25 seconds against 0.371 for the baseline, which is 16 percent lower, and finished the 60-second run at 70.5 C against 79.5 C. It was faster and cheaper at the same time.
Most other changes did not help. Setting a low power hint cut energy but also made the kernel about five times slower. We call that a trade, not a speed-up.
Words you may not know
- Benchmark: a repeatable test of how fast something runs.
- Warm-up: running a program briefly before you measure, so that clocks and caches settle.
- Checksum: a number computed from the output, used to confirm the answer is the same.
- Millijoule (mJ): a small unit of energy.
- Counter: a hardware register that counts events, such as cache misses.
- Root: full administrator access to a phone.
Try it
- Time a small program on your phone or laptop three times in a row and note how much the numbers vary.
- Read the corewait page for the list of device commands.
- Browse the corewait repository and its device notes.
Read next
- A phone GPU with no counters has every row of the kernel table, including the ones that did not win.

Comentarios
Aún no hay comentarios.
Iniciar sesión para comentar.