X

An Oracle blog about NetBeans Profiler

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.

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.