Previous Topic

Next Topic

Book Contents

Book Index

Starting mBProfiler Headless

You can run mBProfiler headless – i.e. without its Eclipse plugin frontend. The generated profiling data can be automatically saved to XML, text or binary format and later analysed (e.g. in Eclipse with the help of the mBProfiler frontend if using the binary format).

Starting mBProfiler headless is useful, for instance, if you want to track down the performance of an application from one version to another. For this purpose, you can start mBProfiler without its frontend automatically each time the application is run. Moreover, you can take advantage of the Profiler API to invoke profiling actions during the application's execution.

Launching a Headless Session

To start mBProfiler headless:

  1. Go to plugins\com.prosyst.mbs.mbprofiler_x.x.x when mBProfiler is installed via update site.
  2. Locate the headless_config.ini file. It contains mBProfiler launch properties, which perform the same functions as the ones supplied in a Profile Configuration (refer to Starting Local Profiling and Starting Remote Profiling). See the "Profiling Settings" table below for a detailed description.
  3. Edit the values of the mBProfiler's launch properties in order to configure the actions that it will perform upon startup. Initially, the property lines are commented, that is, they are in the format

    #<property> = <value_1> | <value_2> | <value_n>

    To activate a property, remove the # token in front of it, set a value by choosing the one that you need and removing the others.

    For example, to set the transport type to socket, the transport property line should be

    transport=socket

  4. If needed, save the profiling output by using the saveOn and saveAs properties in headless_config.ini.
  5. Start the profiled application. Configure it in attach profiling mode as described in the Starting Remote Profiling.
  6. Finally, run one of the following OS-specific startup scripts. You can do this directly, or through another script or an API.

Profiling Settings

This table describes the properties from headless_config.ini that you can use to configure the headless profiling session to a remote Java application.

Property Name

Description

transport

The transport type in use. Its value can be:

  • socket – Indicates the use of a standard socket
  • ipc – Indicates using Inter Process Communication (IPC) sockets for Windows only.

address

The host and the port of the profiled application. This property value should be provided as <application_host>:<port>. For example, localhost:5115.

depth

The depth of call stack traces for memory profiling.

memAutoStart

If true, autostart a memory profiling session on mBProfiler startup.

cpuAutoStart

If true, autostart a CPU profiling session on mBProfiler startup.

vmAutoStart

If true, autostart a VM telemetry session on mBProfiler startup.

threadsAutoStart

If true, autostart a threads profiling session on mBProfiler startup.

keepTemps

If true, save the temporary objects during the session (they are usually cleaned by the JVM's garbage collector) to check if the application is producing too many such objects.

cpuMode

The CPU profiling method in use. Its value can be:

cpuClock

Additional CPU profiling settings. This property can have one of the following values:

  • wall – mBProfiler will not record real CPU time. Instead, mBProfiler will calculate the total execution time of the tested thread/method.
  • real – mBProfiler will record real CPU time.
  • filterWait – mBProfiler will not retrieve the stack traces of threads that are blocked, waiting or sleeping.

cpuInterval

Depending on the CPU profiling method in use (specified through the cpuMode property):

  • For the timing method – The minimum method execution time in milliseconds. That is, only the methods whose execution in milliseconds takes longer than the value of this property will be included in the profiling report.
  • For the sampling method – The rate in milliseconds for taking samples.

saveOn

The moment to save the collected information in the format indicated by the saveAs property. Can have one of the following values:

  • exit – The profiling data will be saved upon terminating the profiled application.
  • none – The data will not be saved.

The data will be saved into the current directory, that is, into dropins/mBProfiler/eclipse/plugins/com.prosyst.profiler_6.2.0 or into plugins/com.prosyst.profiler_6.2.0.

saveAs

The format in which the profiling data will be saved if saveOn is equal to exit. Can have one of the following values:

  • binary – Use this format to load collected data in the mBProfiler visual frontend. Refer to Exporting In Binary Format.
  • xml – Use this format to subsequently parse saved information and display it in a third party application. Refer to Exporting In XML Format.
  • text – Use this format to examine collected data in a text editor. mBProfiler will use ";" as column delimiter to separate the information for the active session types (memory, CPU, VM telemetry and thread activity). Refer to Exporting In Text Format.

saveTraces

If true, mBProfiler will save the full stack traces of profiled applications. For the XML format this option will be applied on CPU, memory and heap profiling, for the text one – on CPU profiling.

saveHotSpots

If true, mBProfiler will also save profiling information on memory hot spots in the generated report.