jmunit.framework.cldc11
Class TimedMeasurement

java.lang.Object
  extended by jmunit.framework.cldc11.TimedMeasurement
All Implemented Interfaces:
PerformanceMeasurement

public class TimedMeasurement
extends java.lang.Object
implements PerformanceMeasurement

The TimedMeasurement class monitors the running time of a test. A test fails if it takes too long to run.

Since:
JMUnit 1.2
Author:
C.A. Meijer

Constructor Summary
TimedMeasurement(long maxRunningTime)
          Constructor.
TimedMeasurement(long maxRunningTime, int clockResolution)
          Constructor that allows the clock resolution to be specified.
 
Method Summary
 void endMeasurement()
          Ends monitoring.
 void startMeasurement()
          Starts monitoring.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimedMeasurement

public TimedMeasurement(long maxRunningTime)
Constructor. This assumes that the clock resolution is 40 milliseconds which is the worst-case resolution on a JTWI-compliant device.

Parameters:
maxRunningTime - The maximum allowed running time for the test (in milliseconds).

TimedMeasurement

public TimedMeasurement(long maxRunningTime,
                        int clockResolution)
Constructor that allows the clock resolution to be specified. If the resolution is given as zero, the TimedMeasurement waits until the next clock tick before allowing a test to start running.

Parameters:
maxRunningTime - The maximum allowed running time for the test (in milliseconds).
clockResolution - The uncertainty associated with the system clock (in milliseconds).
Method Detail

startMeasurement

public void startMeasurement()
Starts monitoring.

Specified by:
startMeasurement in interface PerformanceMeasurement

endMeasurement

public void endMeasurement()
Ends monitoring.

Specified by:
endMeasurement in interface PerformanceMeasurement