A noisy timing sample
Suppose repeated run times have a mean of 0.6 seconds and a standard deviation of 0.31 seconds. Their relative standard deviation is 0.31 / 0.6 ≈ 0.52, or 52%. The variation is substantial compared with the average. section 15.3
Relative standard deviation divides standard deviation by the mean, expressing variation relative to the average. A high value may signal a perturbed computation, unreliable measurements, or both. TAKEAWAY: Relative standard deviation of run times should be in a low percentage range; no fixed cutoff is given. section 15.3
Listing 15.3. Printing time statistics with stats_mean and stats_rsdev_unbiased
109 for (unsigned i = 0; i < loops; i++) {
110 double mean = stats_mean(&statistic[i]);
111 double rsdev = stats_rsdev_unbiased(&statistic[i]);
112 printf("loop %u: E(t) (sec):\t%5.2e ± %4.02f%%,\tloop body %5.2e\n",
113 i, mean, 100.0*rsdev, mean/iterations);
114 }
!@%STYLE%@!
{"css":"{\"css\": \"font-weight: bold;\"}","target":"[[{\"line\":0,\"ch\":0},{\"line\":0,\"ch\":3}],[{\"line\":0,\"ch\":8},{\"line\":0,\"ch\":11}],[{\"line\":0,\"ch\":13},{\"line\":0,\"ch\":21}],[{\"line\":1,\"ch\":0},{\"line\":1,\"ch\":3}],[{\"line\":1,\"ch\":10},{\"line\":1,\"ch\":16}],[{\"line\":2,\"ch\":10},{\"line\":2,\"ch\":16}],[{\"line\":2,\"ch\":0},{\"line\":2,\"ch\":3}],[{\"line\":1,\"ch\":10},{\"line\":1,\"ch\":16}],[{\"line\":2,\"ch\":10},{\"line\":2,\"ch\":16}],[{\"line\":3,\"ch\":0},{\"line\":3,\"ch\":3}],[{\"line\":3,\"ch\":10},{\"line\":3,\"ch\":16}],[{\"line\":4,\"ch\":0},{\"line\":4,\"ch\":3}],[{\"line\":5,\"ch\":0},{\"line\":5,\"ch\":3}]]"}
!@%STYLE%@!
The C listing prints the mean beside 100 times the relative standard deviation, making the reported percentage visible alongside each loop’s run time. section 15.3

