Generating Performance Data Through APIs

There are two common approaches:

  1. Add the performance snapshots into your testing framework, like JUnit for example.
  2. Directly add performance snapshots to your code.

The first approach is preferred since it leaves your production code completely unchanged. However, this approach requires that you introduce Performance Monitor calls into your code so that you can capture performance metrics.

The second approach requires that your plug-in import the org.eclipse.perfmsr.core plug-in.

Typically you would configure the Performance Monitor via an environment variable or a properties file. (See Configuring the Performance Monitor for more information on how to do this). You would then add the following method call to the points in your test case where you would like to capture performance data:

PerfMsrCorePlugin.getPerformanceMonitor(true).snapshot(step);
The step parameter is an integer that ties the snapshot to a particular step in your test case.

As a variation, if you require more control over the information that gets captured you can use the snapshot(step, type) method. When the test case is finished you can either load the data to the server programmatically (using the upload method) or manually.

Related Topics

Getting Started