Definition
A measured maximum is the largest value in a finite set of measured durations, such as the longest of 10,000 timed runs. The worst-case execution time §9.33 (WCET) is the longest time some code can take on a given processor over every input and hardware starting state the analysis admits; a WCET bound is a number proven to be at least that long. An accurate measured maximum is a lower bound on the true worst case, since the code took that long once; a WCET bound is an upper bound.
Where it fits
Main entry: Worst-case execution time (WCET) (§9.33).
The worst-case execution time entry explains how a WCET bound is obtained: static analysis §3.1 examines the code and a model of the processor without running the code, covering every path, every loop up to a proven iteration limit and every hardware state the model admits. A looping test instead runs the code many times, usually with the same input and from similar machine states, and records each duration.
More runs can only raise a measured maximum. Durations of 2, 3 and 8 ms have a maximum of 8 ms; a fourth run of 12 ms raises it to 12 ms and refutes any claimed bound below 12 ms. Even when the runs are independent draws from one fixed distribution with no two durations equal, each of runs is equally likely to be the longest, so a new run exceeds the largest of earlier runs with probability : about 0.01% for . At least one of the next runs exceeds the old maximum with probability , one half for the next 10,000 runs. Both calculations average over the original sample and the future runs. For independent uniform durations between 0 and 10 ms, conditioning on a measured maximum of 8 ms leaves a 2 in 10 chance that the next run exceeds 8 ms, whatever the original sample size.
Runs in use need not come from the tested distribution at all. Repeating one workload keeps the same data in the caches (small fast memories for recently used data), follows the same path, and rarely meets an interrupt §6.11, a hardware signal that suspends the code, at the worst moment. A duration read from a clock also includes time spent suspended, which a WCET bound excludes.
Questions answered
What does a looping test establish?
A looping test, which runs the same code many times and records each run, establishes facts about the runs it made, not a limit on runs it did not make.
It gives a lower bound on the worst case: if the timer is accurate, the code can take at least the measured maximum, because it did once.
It describes the distribution of durations under the tested inputs and conditions. If the runs are independent and identically distributed §11.5, a new run under the same conditions exceeds the largest of runs with probability at most .
It can reveal faults that appear only over many runs, such as crashes, growing memory use, hangs and timeouts §9.34.
It does not establish a worst-case execution time (WCET) bound, an upper limit for every input and hardware state the analysis admits, because the inputs, paths and machine states the loop never reached are not covered. A deadline enforced at run time stops overlong runs but does not show that every run finishes in time. Report timed-out and excluded runs: a maximum over successful runs alone leaves out exactly the slowest ones.
Related entries: Quantile and percentile (§11.16), Censoring (§11.28), Scientific claim versus operational guard (§13.31), Response time versus execution time (§9.32), Probability distribution versus execution set (§15.41).