A Randomized Sampling Clock for CPU Utilization Estimation and Code Profiling.
Steven McCanne, Chris Torek · 1993
The unix rusage statistics are well known to be highly inaccurate measurements of CPU utilization. We have observed errors in real applications as large as 80%, and we show how to construct an adversary process that can use an arbitrary amount of the CPU without being charged. We demonstrate that these inaccuracies result from aliasing effects between the periodic system clock and periodic process behavior. Process behavior cannot be changed but periodic sampling can. To eliminate aliasing, we have introduced a randomized, aperiodic sampling clock into the 4.4bsd kernel. Our measurements show that this randomization has completely removed the systematic errors. 1 Introduction Traditional implementations of the Unix operating system provide coarse grained, statistical measurements of CPU utilization. On each tick of the system clock, the CPU state is examined. If the processor is in user mode, the current process is charged with one sampling interval of user time. Similarly, if the pr...