SCS - Callstack Sampling


Callstack sampling uses events in the same way as time profiling (TPROF). However, instead of merely recording the address being executed, it calls the JVM to record the entire callstack for that thread. By treating this callstack as if it were a series of method entries and exits, the information can be stored in the same way that callflow information is stored. This allows callflow analysis of an application with far less overhead than would be encountered by handling all of the method entry and exit events.

The platform independent event mode is very useful for identifying the context in which events occur. Although the overhead of getting the callstack information varies by the depth of the callstack, the impact on the execution of the application is usually minimal because the events do not occur often and only occur on one thread at a time.


The best way to explain anything is through examples. We have a page of examples of common tasks which is worth reading. The following are examples specific to callstack sampling: