JProfiler's built-in script editor allows you to enter custom logic in various places in the JProfiler GUI, including custom probe configuration, heap walker filters and inspections and the "Run interceptor script" trigger action. |
The box above the edit area show the available parameters of the script as well
as its return type. If parameters or return type are classes (and not primitive types), they
will be shown as hyperlinks. Clicking on such a hyperlink opens the Javadoc in the external browser.
To get more information on classes from the com.jprofiler.api.* packages, please choose Help->Show Javadoc Overview from the menu and read the the help topic on custom probes. A number of packages can be used without using fully-qualified class names. Those packages are:
You can put a number of import statements as the first lines in the text area in order to avoid using fully qualified class names. All scripts are passed an instance of com.jprofiler.api.agent.ScriptContext that allows you to save state between successive invocations of the script. |
Scripts can be
|
The Java editor offers the following code assistance powered by the eclipse platform:
|
If the gutter icon in the top right corner of the dialog is green, your script is going to compile unless you have disabled error analysis in the Editor Settings. In some situations, you might want to try the actual compilation. Choosing Code->Test Compile from the menu will compile the script and display any errors in a separate dialog. Saving your script with the [OK] button will not test the syntactic correctness of the script unless the script is used right away. |
Often you will want to reuse a script that you have entered previously. The script history saves recently used scripts. If you click on the script history tool bar button, a dialog will be shown where you can see all scripts that have been used recently. Scripts are organized by script signature and the current script signature is selected by default. When you confirm the script history dialog, the current script in the editor is replaced. |