Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Pause Resume Attach Detach design of profilers"

()
Line 1: Line 1:
 +
== Initial Pause/Resume, Attach/Detach Design  ==
 +
 
Three old design overview documents (PPT) are attached:  
 
Three old design overview documents (PPT) are attached:  
  
Line 5: Line 7:
 
#[https://bugs.eclipse.org/bugs/attachment.cgi?id=149427 Thread Profiler Attach and Detach ]
 
#[https://bugs.eclipse.org/bugs/attachment.cgi?id=149427 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.
+
These three old slides can be a reference. The changes in current TPTP profilers code will be described as below.  
  
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/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:
  
MethodA()
+
....
  
{
+
MethodA()
  
  ...
+
{
  
  // Attach happens here
+
  ...
  
  MethodB();
+
  // Attach happens here
  
  ...
+
  MethodB();
  
}
+
  ...
  
 +
}
  
 +
<br>
  
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 [https://bugs.eclipse.org/bugs/attachment.cgi?id=136463 here]. There is also [https://bugs.eclipse.org/bugs/attachment.cgi?id=139605 a slide](PowerPoint) which contains animation explaining how shadow stack solution works.
+
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 [https://bugs.eclipse.org/bugs/attachment.cgi?id=136463 here]. There is also [https://bugs.eclipse.org/bugs/attachment.cgi?id=139605 a slide](PowerPoint) which contains animation explaining how shadow stack solution works.  
  
 
----
 
----
 
<div></div><div><span class="Apple-style-span" style="font-family: arial;">←[http://wiki.eclipse.org/TPTP Back to TPTP wiki page]</span></div>
 
<div></div><div><span class="Apple-style-span" style="font-family: arial;">←[http://wiki.eclipse.org/TPTP Back to TPTP wiki page]</span></div>

Revision as of 04:52, 13 November 2009

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:

....

MethodA()

{

  ...

  // Attach happens here

  MethodB();

  ...

}


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.


Back to the top