|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.test.performance.PerformanceMeter
public abstract class PerformanceMeter
A PerformanceMeter
is used for doing repeated measurements of
an arbitrary operation.
The kind of measurement and the retrieval of the results remain internal to
the implementation. Measurements can include time, CPU cycle and memory
consumption.
A PerformanceMeter
is created using the method
Performance.createPerformanceMeter(String)
. An operation is measured
by calling start()
before and
stop()
after that operation. The measurement can be
repeated, for example, to let the VM warm up and to allow for statistical
analysis afterwards.
After measurements are done and before an analysis of the results can be made
commit()
has to be called. This allows for example
to prepare the measurements for analysis or persist them.
Performance.assertPerformance(PerformanceMeter)
provides a default
analysis of the measurements. After the PerformanceMeter
is no
longer used dispose()
must be called.
Example usage in a test case:
public void testOpenEditor() { Performance perf= Performance.getDefault(); PerformanceMeter performanceMeter= perf.createPerformanceMeter(perf.getDefaultScenarioId(this)); try { for (int i= 0; i < 10; i++) { performanceMeter.start(); openEditor(); performanceMeter.stop(); closeEditor(); } performanceMeter.commit(); perf.assertPerformance(performanceMeter); } finally { performanceMeter.dispose(); } }This class is not intended to be subclassed by clients.
Constructor Summary | |
---|---|
PerformanceMeter()
|
Method Summary | |
---|---|
abstract void |
commit()
Called exactly once after repeated measurements are done and before their analysis. |
abstract void |
dispose()
Dispose associated resources. |
abstract void |
start()
Called immediately before the operation to measure. |
abstract void |
stop()
Called immediately after the operation to measure. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PerformanceMeter()
Method Detail |
---|
public abstract void start()
stop()
before subsequent calls
to this method or commit()
.
public abstract void stop()
start()
, that follows any
previous call to this method.
public abstract void commit()
start()
and
stop()
must not be called.
public abstract void dispose()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |