Profiler - Instrumenting a Root Method

Instrumenting a Root Method

By choosing a root method you can instrument and profile a limited subset of an application's code. Once partial application profiling is initiated, profiling data is not collected until one of the application's threads enters the profiling root method.

If you choose a given method as a root when a thread is already executing it, profiling will not start – a "fresh" call to the root method is required to begin profiling.

Marking the Profiling Root Method

You can mark a method as an instrumentation root by using the pop-up menu in the Projects window.

  • Expand the class node of the method you wish to instrument.
  • Locate the method from the list of methods.
  • Right-click the method and choose Tools -> Add as Profiling Root Method from the pop-up menu.
or
  • Right-click the method's class, choose Tools -> Select Profiling Root Methods from the pop-up menu, and then select one or more methods from the list of the class's methods.

Note that you may need to first mount the file system or a JAR file that contains your root method's class, e.g. if this class does not belong to your application's class path. That is the case, for example, when profiling code running on top of a Web/J2EE server.

How profiling via root methods works

The code subset to profile can automatically be identified based on whichever profiling root method you provide. The given method is instrumented and all methods that it calls transitively (a call subgraph) are discovered and instrumented automatically while the target application runs. You can select multiple roots and thereby instrument multiple subgraphs.

You can use any method as a root (for example, a method which has previously been identified as a general bottleneck) to see which of its callees contribute most to the execution time. Alternatively, the root method can be the entry point into the part of the Java code that you are currently interested in (for example, the doGet() method of your servlet). In both cases, only the code of this method and its callees are instrumented.

If any of these methods are called in a thread that hasn't previously called the given root method, the instrumentation injected into these methods does nothing and returns immediately, although it cannot be disabled completely.

See also

 

Project Features

About this Project

Profiler was started in November 2009, is owned by Tomas Hurka, and has 58 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20160708.bf2ac18). © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close