Peter Hofer, Hanspeter Mössenböck,
"Fast Java Profiling with Scheduling-Aware Stack Fragment Sampling and Asynchronous Analysis"
, in ACM: Proceeding PPPJ '14 Proceedings of the 2014 International Conference on Principles and Practices of Programming on the Java platform: Virtual machines, Languages, and Tools, Seite(n) 145-156, 2014, ISBN: 978-1-4503-2926-2
Fast Java Profiling with Scheduling-Aware Stack Fragment Sampling and Asynchronous Analysis
Sprache des Titels:
Proceeding PPPJ '14 Proceedings of the 2014 International Conference on Principles and Practices of Programming on the Java platform: Virtual machines, Languages, and Tools
Sampling is a popular approach to profiling because it typically has only a small impact on performance and does not modify the profiled application. Common sampling profilers collect data about an application by pausing the application threads, walking the stacks to create stack traces, and then adding the traces to their profile. Waiting threads are often sampled as well, even when they have not been active since their last sample. Sampling profilers for Java commonly rely on safepoints, which are locations in the Java code where a thread can pause to be sampled. However, restricting profiling to these locations affects the accuracy of the profile, and the safepoint mechanism itself imposes significant pause times on the application.
We present stack fragment sampling, a new approach for Java applications that minimizes pause times and eliminates redundant samples altogether. It interrupts an application thread only to copy a fragment of its stack to a buffer and then immediately resumes its execution. Retrieving and decoding the stack fragments happens asynchronously and can run on a separate core or on another processor. Our approach integrates with the operating system to only take samples of threads while they are running in order to avoid redundant samples. We demonstrate that our approach has a very small impact on performance even at high sampling rates. Furthermore, we validate our approach by comparing our profiles to those from a profiler using safepoints as well as to a VM-internal profiler that does not use safepoints. The results show that the profiles agree.