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"

(New page: Three old design overview documents (PPT) are attached: #[https://bugs.eclipse.org/bugs/attachment.cgi?id=149425 CPU Profiler Attach and Detach] #[https://bugs.eclipse.org/bugs/attachmen...)
 
(Complement attach/detach changes)
Line 1: Line 1:
 
Three old design overview documents (PPT) are attached:  
 
Three old design overview documents (PPT) are attached:  
  
#[https://bugs.eclipse.org/bugs/attachment.cgi?id=149425 CPU Profiler Attach and Detach]
+
#[https://bugs.eclipse.org/bugs/attachment.cgi?id=149425 CPU Profiler Attach and Detach]  
#[https://bugs.eclipse.org/bugs/attachment.cgi?id=149426 Heap Profiler Attach and Detach]
+
#[https://bugs.eclipse.org/bugs/attachment.cgi?id=149426 Heap Profiler Attach and Detach]  
 
#[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:
 +
 +
....
 +
 +
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 [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.

Revision as of 04:07, 13 November 2009

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.

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