Understanding Profiler Agent Parameters

Anytime the profiled application is started for Profiler direct attach, the -agentpath argument of java command is used to load the Profiler agent into JVM. For Profile Project action this happens automatically and you don't have to care about it. But when you are using the Attach Profiler action, you have to start the profiled application manually and provide correct -agentpath argument. Synopsis of the argument is:

   -agentpath:​path_to_agent_library=​path_to_profiler_lib_dir,​comm_port_number​[,timeout_in_secs]

where

  • path_to_agent_library is full path to Profiler agent binary, on Windows %NB_INSTALL%\\​profiler1\\​lib\\​deployed\\​jdk15\\​windows\\​profilerinterface.dll
  • path_to_profiler_lib_dir is full path to Profiler lib directory, on Windows %NB_INSTALL%\\​profiler1\\​lib
  • comm_port_number is Profiler agent communication port, must meet the value set in Profiler Options, default is 5140
  • timeout_in_secs is optional timeout value in seconds which defines the time for which the agent waits for Profiler GUI connection; if elapsed, the agent breaks profiled application startup and stops its JVM. If not provided, default value 0 is used which means no timeout

The timeout_in_secs option is useful when you use some kind of automated connection of Profiler GUI to the agent or just when you are not sure that the Profiler GUI will be able to connect to the agent. The timeout ensures that profiled application won't stay blocked when connection fails. The Profiler itself uses timeout for Profile Project action for J2SE projects, its value is 10 seconds.

Note that you don't have to construct the -agentpath argument manually, the Attach Wizard will generate it for you - you can just copy-paste it to the console.

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

A blog by NetBeans Profiler & VisualVM developers.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today