| By Yamini K. Balasubramanyam, April 9, 2007 |
Even though profiling simple applications is usually a straightforward task, setting up a profiler to work on a Web server or application server requires extra steps. Configuring the Profiler in the NetBeans IDE (henceforth, NetBeans Profiler), however, is easily accomplished, usually on the first attempt. Not only does NetBeans Profiler support a wide range of profiling tasks on the Solaris, Windows, and Linux (Ubuntu) platforms, it also delivers numerous benefits. Among the benefits are
System.currentTimeMillis() in your code any more. | - | Overview of the GUI |
| - | Downloads and Initial Setup |
| - | Integration Steps |
| - | References |
This section highlights the related GUI.
Figure 1 shows the NetBeans Profiler console.
Figure 1: NetBeans Profiler Console |
Here, you can perform many profiling tasks, among them the following:
Figure 2 shows the wizard for profiling tasks in the NetBeans IDE.
Figure 2: Wizard for Profiling Tasks in NetBeans IDE |
Figure 3 shows a display of CPU performance measurements.
Figure 3: CPU Performance Measurements |
Figure 4 shows a display of threads.
Figure 4: Threads |
Before embarking on profiling tasks, first download the following:
Next, do the following:
This section describes how to integrate NetBeans Profiler into Web Server 7.0.
Configuring Your Web Server Instance
First, configure your Web Server instance to load the NetBeans agent library from the administration command-line interface (CLI), wadm. For details on wadm, see the Sun Java System Web Server 7.0 CLI Reference Manual .
Note: Type all the commands on one line even though some of them wrap to the next line because of page width constraints.
$ wadm -u admin -w /space/admin.pwd Sun Java System Web Server 7.0U1-Technology-Preview-1 B03/13/2007 11:03 wadm> |
wadm> create-jvm-profiler --config=test NetBeans CLI201 Command 'create-jvm-profiler' ran successfully wadm> list-jvm-profilers --config=test --all --verbose name enabled ------------ NetBeans true wadm> |
wadm> create-jvm-options --config=test --profiler=NetBeans -- -agentpath:/space/netbeans-5.5/ profiler1/lib/deployed/jdk15/solaris-sparc/libprofilerinterface.so=/space/netbeans-5.5/ profiler1/lib,5140 CLI201 Command 'create-jvm-options' ran successfully wadm> list-jvm-options --config=test --profiler=NetBeans -agentpath:/space/netbeans-5.5/profiler1/lib/deployed/jdk15/solaris-sparc/ libprofilerinterface.so=/space/netbeans-5.5/profiler1/lib,5140 wadm> |
wadm>deploy-config test CLI201 Command 'deploy-config' ran successfully |
Attaching NetBeans Profiler
Finally, attach the NetBeans Profiler:
[15/Mar/2007:11:00:35] info ( 7092): CORE1116: Sun Java System Web Server 7.0U1-Technology- Preview-1 B03/13/2007 11:03 [15/Mar/2007:11:00:35] warning ( 7093): CORE3283: stderr: Profiler Agent: Initializing ... [15/Mar/2007:11:00:35] warning ( 7093): CORE3283: stderr: Profiler Agent: Options: >/space/ netbeans-5.5/profiler1/lib,5140< [15/Mar/2007:11:00:35] warning ( 7093): CORE3283: stderr: Profiler Agent: Initialized successfully [15/Mar/2007:11:00:35] info ( 7093): CORE3282: stdout: Profiler Agent: Waiting for connection on port 5140 (Protocol version: 2) |
Here is the sample output of a local profiling task:
[15/Mar/2007:11:02:06] info ( 7093): CORE3282: stdout: Profiler Agent: Established local connection with the tool [15/Mar/2007:11:02:09] info ( 7093): CORE5076: Using [Java HotSpot(TM) Server VM, Version 1.5.0_09] from [Sun Microsystems Inc.] [15/Mar/2007:11:02:19] info ( 7093): WEB0100: Loading web module in virtual server [test] at [/ search] [15/Mar/2007:11:02:34] info ( 7093): HTTP3072: http-listener-1: http://kosmo:1894 ready to accept requests [15/Mar/2007:11:02:35] info ( 7093): CORE3274: successful server startup |
Managing Instances With NetBeans Plug-in
If you have installed the NetBeans plugin for Web Server 7.0, you can manage Web Server instances within the IDE. As shown in Figure 5, a screenshot of the window for monitoring threads, the NetBeans IDE lists Web Server 7.0 under Servers on the left pane. The bottom pane displays the log of handshake messages between the NetBeans Profiler and the Web server instance.
Figure 5: Monitoring of Threads |
To start the instance from within the IDE:
Figure 6 shows the Runtime window.
Figure 6: Runtime Window |
Viewing Garbage Collection Statistics With Visual GC Plug-in
If you have installed the Visual GC plug-in in the NetBeans IDE, you can view the statistics on garbage collection there. Figure 7 shows an example.
Figure 7: Garbage Collection Statistics |
