Bias is a systematic deviation between a measurement and the property it is intended to represent. In performance measurement, the act of timing code can change the execution being measured. section 16.4
Listing 16.2 Measuring calls to timespec_get repeatedly
/* A function call can usually not be optimized out. */ 1
for (uint64_t i = 0; i < iterations; ++i) {
timespec_get(&tdummy, TIME_UTC);
accu1 += tdummy.tv_nsec;
}
timespec_get(&t[4], TIME_UTC);
Repeated calls to timespec_get provide a way to assess the cost of the timing operation itself. section 16.4
A timing call takes time, but its effects can extend beyond that cost. The compiler may need to save registers and abandon optimization assumptions. A system call may also affect scheduling or invalidate data caches. Instrumentation can therefore change both compile-time and run-time properties. section 16.4
Assess timing bias before interpreting measurements of the code of interest. Repeat experiments and collect statistics such as the mean, standard deviation, and sometimes skew. Repetition helps characterize outcomes; it does not by itself remove a systematic effect of instrumentation. section 16.4




























