当前页面: 开发资料首页 → Netbeans 专题 → Profiling NetBeans Plug-In Modules
摘要: This document applies to NetBeans 5.0 and NetBeans Profiler 5.0.
In this tutorial you are guided through the process of setting up a NetBeans plug-in module project in the IDE so that you can use Profiler to analyze the plug-in performance. This tutorial touches on some aspects of profiling that are specific to profiling the performance and memory of NetBeans plug-in modules. It is assumed that you understand what profiling is and the purpose it serves, and also that you are familiar with NetBeans IDE and its support for plug-in development.
This tutorial covers the following topics.
If you are looking for a general tutorial on profiling with NetBeans Profiler, click here.
To learn about plug-in development, see the NetBeans IDE 5.0 Plug-in Module Quick Start Guide.
To profile your NetBeans plug-in module, you first have to make sure you have all of the necessary software
and that your project is set up correctly. Before you can start profiling a NetBeans module, you need to do the following. Basic setup. Advanced setup. If you do not have a NetBeans module project but would like to try profiling a NetBeans module,
you can use the New Project wizard to create a sample plug-in module project.
The Module Development Environment 5.0 Update 1, available from the NetBeans Update Center Beta,
contains the Paint Application sample plug-in module.
Once you have configured your plug-in project, you can use Profiler to launch the platform and plug-in.
Setting Up the Project
Installing the Software
Setting Up the Plug-in Module Project
If the version of the IDE you are using to develop your plug-in module is the same as the version you are developing your plug-in module for,
set the module as Main Project. You can set the module as Main Project by opening your module project and then right-clicking the module node in the Projects window and choosing Set Main Project.
If you are developing your plug-in module for a version of the IDE that is incompatible with the version you are using to develop the plug-in
(for example, you work in a stable release of the IDE and develop and deploy plug-ins to the lastest trunk build), follow the following steps:
Note. If you are profiling a module included in NetBeans (such as the Editor module), you cannot configure the platform.
The target IDE should be set to nbbuild/netbeans.Profiling the Plug-in Module
Profiling a NetBeans plug-in is a special case because you are running and profiling a large application. In order to minimize the profiling overhead, you will usually want to limit the scope of the code that is profiled.
When you choose the Analyze Performance task, there are various options that enable you to modify the instrumentation of the plug-ins module on the platform. The following is a rough guide on which mode to choose when profiling performance.
As an example, you can create a custom filter to filter out all NetBeans and Java core classes from the performance profiling results by doing the following:
The filter you created is now available in the Filter drop-down list when analyzing application performance.
When profiling memory usage of a plug-in module in NetBeans, you cannot limit the scope of memory profiling as you can when profiling performance (such as by profiling only root methods or only the code for your module). However, there are some ways you can minimize the profiling overhead and still get the results you need.
Increase the maximum java heap size. It is strongly recommended that you increase the maximum java heap size when you do memory profiling. You can do this by editing the conf/netbeans.conf file in your netbeans installation directory and changing the -J-Xmx parameter to -J-Xmx512m.
For more information on using Profiler to profile NetBeans projects, please see the following links: