## Specifying a Root Method

See Also

When analyzing application performance, you can choose to limit the source code that is instrumented by specifying a root method. When you profile an application by instrumenting a root method, profiling data is collected when one of the application's threads enters and leaves the root method.

When you specify a root method, the method is added to the list of selected root methods which you can choose to instrument when profiling application performance. The selected root methods are listed in the Specify Root Methods dialog box. Each profile application performance configuration is associated with a specific set of selected root methods.

To specify a single root method in a class:

1. Locate the class containing the method you want to add and open the class in the Source Editor.
2. In the Source Editor, right-click in the method you want to add and choose Profiling > Add as Profiling Root Method.
3. Select a profiling configuration and click OK.

When you click OK, the method is added to the root methods that are associated with that profiling configuration.

To specify multiple root methods in a class:

1. Locate the class containing the method you want to add and open the class in the Source Editor.
2. In the Source Editor, right-click in the source code and choose Profiling > Select Profiling Root Methods.
3. Select a profiling configuration and click OK to open the Select Root Methods dialog box.
4. Expand the package and method nodes, select the methods you want to add as root methods and click OK.

When you click OK, the selected methods are added to the root methods that are associated with that profiling configuration.

Note: If you right-click in an object that is part of another class, the Select Root Methods dialog box will allow you to select root methods in that class.

Notes:

- 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 classpath. That is the case, for example, when profiling code running on top of a Web/J2EE server.
- If you choose a given method as a root when a thread is already executing it, profiling will not start. To begin profiling, a "fresh" call to the root method is required. Once partial application profiling is initiated, profiling data is not collected until one of the application's threads enters the profiling root method.

For more, see the following NetBeans FAQ:

See Also
  Analyzing Application Performance

Legal Notices