At end of project development, profile your application will become important, at least it's better to know the hot spots of your application, and think about improving it.
There exist many different commercial and open source profile tools for java, but in Eclipse area, TPTP seems the best choice because TPTP itself is a suite of Eclipse plugins too.
TPTP([url]http://www.eclipse.org/tptp/[/url]) is a giant/complex project of Eclipse, it try to supply a one stop solution based on Eclipse, which include testing, monitoring, tracing and profiling functionalities.
Most of documents and tutorials of TPTP are focus on how to profiling a java Application(even Eclipse workbench itself is a java Application too, but at least, it's has special feautres), but ignore how to profiling Eclipse plugins, or the runtime workbench of Eclipse when you debugging your Eclipse plugins, which most of Eclipse plugin developers are interesting on :)
TPTP profiling using Agent mechanism to collect data, the latest release of TPTP also include a IAC(Integrated Agent Controller) to make profiling simple, but unfortunately it's hard to profile Eclipse plugin using IAC, it seems can't profile Eclipse plugin at all even it's very convenient to profile a standalone java Application, so here I will profile Eclipse plugin using stand alone Agent Controller, also all examples here are running on Linux.
[b][size=16]1. prepare environment[/size] [/b]
[b]a. First, you need install Eclipse and TPTP [/b]
[url] http://www.eclipse.org/tptp/home/downloads/ [/url]
[url]http://www.eclipse.org/tptp/home/downloads/installguide/InstallGuide44.html [/url]
[b]b. Install Agent Controller, you could test it follow tutorial below [/b]
[url] http://www.eclipse.org/tptp/home/downloads/ [/url]
[url]http://www.eclipse.org/tptp/home/downloads/installguide/agentcontroller_44/linux/getting_started.html[/url]
[b][size=16]2. profile steps[/size][/b]
[b]a. start Agent Controller [/b]
[code]
$ACStart
[/code]
[b]b. start your runtime workbench which containts all of your plugins using JVM arguments below [/b]
[code]
-XrunpiAgent:server=enabled
[/code]
or you can start a Eclipse workbench which include all of your plugins using command like
[code]
eclipse -vmargs -XrunpiAgent:server=enabled
[/code]
the -XrunpiAgent will notice Agent Controller of your instance of Eclipse workbench, if you work on Linux you need set LD_LIBRARY_PATH before you start piAgent like
[code]
$export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/local/<agent controller dir>/lib
[/code]
if you work on Windows, add directory above to your PATH environment
[b]c. do profile [/b]
* start a Eclipse workbench
* switch to "profiling and logging" perspective
* open profile configuration dialog, create a new "Attach - Java process" entry
* select the running Agent from Host tab, you can't use "Local Direct Connection" because we use a stand alone Agent Controller now, you could verify the agent from the PID you get, which must equtal to PID of your Eclipse workbench which contains all of your plugins
* then set the profile filter set for your plugins
* click profile button, do profile, that's it.
There exist many different commercial and open source profile tools for java, but in Eclipse area, TPTP seems the best choice because TPTP itself is a suite of Eclipse plugins too.
TPTP([url]http://www.eclipse.org/tptp/[/url]) is a giant/complex project of Eclipse, it try to supply a one stop solution based on Eclipse, which include testing, monitoring, tracing and profiling functionalities.
Most of documents and tutorials of TPTP are focus on how to profiling a java Application(even Eclipse workbench itself is a java Application too, but at least, it's has special feautres), but ignore how to profiling Eclipse plugins, or the runtime workbench of Eclipse when you debugging your Eclipse plugins, which most of Eclipse plugin developers are interesting on :)
TPTP profiling using Agent mechanism to collect data, the latest release of TPTP also include a IAC(Integrated Agent Controller) to make profiling simple, but unfortunately it's hard to profile Eclipse plugin using IAC, it seems can't profile Eclipse plugin at all even it's very convenient to profile a standalone java Application, so here I will profile Eclipse plugin using stand alone Agent Controller, also all examples here are running on Linux.
[b][size=16]1. prepare environment[/size] [/b]
[b]a. First, you need install Eclipse and TPTP [/b]
[url] http://www.eclipse.org/tptp/home/downloads/ [/url]
[url]http://www.eclipse.org/tptp/home/downloads/installguide/InstallGuide44.html [/url]
[b]b. Install Agent Controller, you could test it follow tutorial below [/b]
[url] http://www.eclipse.org/tptp/home/downloads/ [/url]
[url]http://www.eclipse.org/tptp/home/downloads/installguide/agentcontroller_44/linux/getting_started.html[/url]
[b][size=16]2. profile steps[/size][/b]
[b]a. start Agent Controller [/b]
[code]
$ACStart
[/code]
[b]b. start your runtime workbench which containts all of your plugins using JVM arguments below [/b]
[code]
-XrunpiAgent:server=enabled
[/code]
or you can start a Eclipse workbench which include all of your plugins using command like
[code]
eclipse -vmargs -XrunpiAgent:server=enabled
[/code]
the -XrunpiAgent will notice Agent Controller of your instance of Eclipse workbench, if you work on Linux you need set LD_LIBRARY_PATH before you start piAgent like
[code]
$export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/local/<agent controller dir>/lib
[/code]
if you work on Windows, add directory above to your PATH environment
[b]c. do profile [/b]
* start a Eclipse workbench
* switch to "profiling and logging" perspective
* open profile configuration dialog, create a new "Attach - Java process" entry
* select the running Agent from Host tab, you can't use "Local Direct Connection" because we use a stand alone Agent Controller now, you could verify the agent from the PID you get, which must equtal to PID of your Eclipse workbench which contains all of your plugins
* then set the profile filter set for your plugins
* click profile button, do profile, that's it.