Suppose we want to profile a NetBeans Platform application with YourKit Java Profiler, but installing the plugin is not an option, or because we do not want to add third-party plugins that can make the IDE unstable, or maybe we do not use an IDE at all. At this point we have to do some manual configuration of our application ANT build file. Open the main build.xml (the one of platform project to be clear) and add this ANT task: <target name= "profileEclipse" description= "Lancia l'applicazione in debugging for Eclipse">
<property name = "debug.args" value = "-J-agentpath:<yourkit_installation_path>\win32\yjpagent.dll" />
<echo message= "debug.args=${debug.args}" />
<antcall target= "run"> <param name= "run.args" value= "${debug.args}" /> </ antcall> </ target> As you can guess we are simply using the standard NetBeans task to launch the application, we are simply adding the profiling configuration of YourKit agent. At this point, since we can see the Java profiled process in the "Local Monitor Applications" of YourKit Console, we can click it and start the profiling session. Obviously the same can be done directly on a Platform Application of which we only have the final distribution. Just open the configuration file in the etc directory, for example if the application is called "suite-test", then we must open the file <%PATH_TO_SUITE_TEST%\etc\suite-test.conf> and add the agent configuration: # ${HOME} will be replaced by user home directory according to platform Now running the application we can connect and profile it with YourKit. |
Home page > NetBeans Platform >