Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: for the plan.

Jump to: navigation, search

Pause Resume Attach Detach design of profilers

Initial Pause/Resume, Attach/Detach Design

Three old design overview documents (PPT) are attached:

  1. CPU Profiler Attach and Detach
  2. Heap Profiler Attach and Detach
  3. Thread Profiler Attach and Detach

These three old slides can be a reference. The changes in current TPTP profilers code will be described as below.

Attach/Detach Design Changes

Now TPTP uses JVMTI instrumentation as profiling basis. However, in attach/detach scenarios, some happened events maybe lost if a profiler is attached to running Java apps. For example when using CGProf on below simple Java code snippet:





  // Attach happens here




When attach happens, we can catch MethodB enter but we don't know MethodA. This is because we can not instrument our code into entered methods (See bug 194081, bug 270767). Similar problem also exists in heap profiler: We can not catch some objects allocated before attach happens. To solve this problem, we use shadow stack track for CGProf and heap iteration for HeapProf. Heap iteration solution uses JVMTI iterate heap interface when attach happens in order to catch live objects in heap. Shadow stack track is a little complicated. One design document about shadow stack track solution process, classes and algorithm is here. There is also a slide(PowerPoint) which contains animation explaining how shadow stack solution works.

For Heap profiler, live objects iteration is used. A design document for this iteration process is recorded in this file for bug 241085. Please note, a problem related with on stack replacement (OSR) still exists which is reported in bug 296895.

Copyright © Eclipse Foundation, Inc. All Rights Reserved.