Skip to Main Content
To analyse runtime behaviour and performance of software systems, accurate time measurements are obtained using timer methods. The underlying hardware timers and counters are read and processed by several software layers, which introduce overhead and delays that impact accuracy and statistical validity of fine-granular measurements. To understand and to control these impacts, the resulting accuracy of timer methods and their invocation costs must be quantified. However, quantitative properties of timer methods are usually not specified as they are platform-specific due to differences in hardware, operating systems and virtual machines. Also, no algorithm exists for precisely quantifying the timer methods' properties, so programmers have to work with coarse estimates and cannot evaluate and compare different timer methods and timer APIs. In this paper, we present TimerMeter, a novel algorithm for platform-independent quantification of accuracy and invocation cost of any timer methods, without inspecting their implementation. We evaluate our approach on timer methods provided by the Java platform API, and compare them to additional timer methods that access hardware and software timers from Java. The presented algorithm and the evaluation results benefit researchers and programmers by forming a basis for selecting appropriate timers.