Interpreting Elapsed and CPU Time in a Benchmark
Elapsed time includes waiting. CPU time reports how much execution was charged under an operating system's accounting rules.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 4
- Reading time
- 1 min
In this article4 chapters
Trace a slow file operation
A run can spend 100 milliseconds computing and 400 waiting on I/O. Optimizing the calculation by half saves around fifty milliseconds if the other work is unchanged. See low CPU during a long wait.
Check parallel totals
Several workers may use more total CPU seconds than the elapsed interval. CPU accounting across threads explains why both metrics can be valid.[1]
Interpret simultaneous compute and waiting
A threaded job uses two cores for 200 milliseconds each and then waits 100 milliseconds for storage. With perfect overlap during compute, wall time could be about 300 milliseconds and aggregate CPU time about 400. Those figures answer different questions. See CPU and elapsed time for threads.
Two simultaneous CPU intervals: 200 ms wall, 400 ms aggregate CPU
IO wait: about 100 ms wall, little job CPU
Idealized total: 300 ms wall, 400 ms CPU
Match the cost to the improvement being assessed
Response time concerns elapsed time. Host capacity often needs CPU utilization and work per result. Report both when overlap or waiting changes.