Virtual Timers: Using Hardware Physical Timers for Profiling Kernel Code-Paths

When evaluating the performance of commercial workloads it is important to be able to examine overheads induced by the operating system kernel. Currently the only method for understanding kernel overheads is by using sample-based profiling tools. Although profiling can be very useful, one of its main limitations is that it does not allow the precise profiling of specific code-paths. Using hardware timers with a simple API allows addressing this issue, however, does not deal with context switch operations that incur during code execution, due to synchronous or asynchronous events. In this work we propose a new interface for virtualizing physical timers. Our interface takes into account context switches and provides the system programmer with simple calls to profile specific code-paths. We implement this API in the Linux kernel and demonstrate how it can be used to profile the system overhead of MySQL running a subset of TPC-H over iSCSI. Using our virtual timers we identify the time is spent in I/O related code-paths in the kernel with little effort. We also examine the overhead of the instrumentation code and find that it is less than 3% of the execution time in all experiments we perform.

[1]  Angelos Bilas,et al.  Performance evaluation of commodity iSCSI-based storage systems , 2005, 22nd IEEE / 13th NASA Goddard Conference on Mass Storage Systems and Technologies (MSST'05).