suramadu.tests.latency
Class InterruptLatency

java.lang.Object
  extended bysuramadu.tests.latency.InterruptLatency
All Implemented Interfaces:
java.lang.Runnable

public class InterruptLatency
extends java.lang.Object
implements java.lang.Runnable

The InterruptLatency class measures the minimum reaction time of the VM to corrective actions and clean-up when an AsynchronousInterruptedException is activated. The InterruptLatency class measures the latency of the activation of the interruptAction() method of an Interruptible when running as the target of an AsychronouslyInterruptedException.doInterruptible() method.

PURPOSE: Measure the time it takes to activate the interruptAction() method when an AIE.doInterruptible() is interrupted.

DESIGN: A Timed AIE is created within the context of an RT or NHRT thread and desired memory type. The start of the Timed is recorded and it polls for the current time until it exceeds its deadline and an asynchronous transfer of control (ATC) occurs and the interruptAction() method is activated. The interruptAction start time is recorded as well as the latest polled time from the Timed.run().

A variable number of background threads can be run. Each background thread produces a random amount of garbage (an array of integers with a random length).

ASSUMPTIONS: None.

INPUTS:
The following parameters may be specified in a properties file whose name is of the form suramadu.tests.latency.InterruptLatency.properties .

Property Default Value Description
"memtype" "IMMORTAL" Memory type of the thread. Options are HEAP, SCOPE and IMMORTAL
"threadtype" "NHRT" Type of thread to use. Valid options are RT and NHRT
"iterations" "100" Number of samples to take
"priority" "200" Priority of the thread
"period" "200" Period of the thread
"idelay" "750" Initial delay of the thread
"bgthreads" "0" Number of background threads
"bgpriority" "100" Priority of the background threads
"bgperiod" "100" Period of the background threads
"bgidelay" "400" Maximum value of random initial delay for background threads
"histbins" "50"
"costmillis" "10" Cost of the thread, in milliseconds, added to costnanos
"costnanos" "0" Cost of the thread, in nanoseconds, added to constmillis
"deadlinemillis" "10" Deadline of the thread, in milliseconds, added to deadlinenanos
"deadlinenanos" "0" Deadline of the thread, in nanoseconds, added to deadlinemillis
"waste" "11000000" Amount of time for the thread to waste each period, in nanoseconds

OUTPUTS: The following output files will be produced. The file name prefix follows standard Suramadu output file naming conventions.

File suffix Description
latencyFromStartPlusDeadline Calculated latency: start time of handler - (start time of thread + deadline). This gives an idea how precise the interrupt mechanism is in an absolute (theoretical) sense.
latencyFromStop Direct latency: start time of handler - last polled time of thread. This is a relative latency, indicating how quickly the process happens, but does not provide an absolute time reference (i.e. was the fault detected in a timely fashion?).
handlerJitter Relative jitter of handler start times
primaryStartJitter Relative jitter of the thread start time
primaryStopJitter Relative jitter of the thread's last polled time
actualCost The difference between the start time of the thread and the last polled time. The expectation is that this should be equal to the value of the deadline property. With the latencyFromStop this should provide information on the overall deterministic nature of the interrupt mechanism.
SUMMARY Overall latency statistics

EXAMPLES:

ORIGINS:

Version:
$Revision: 1.1 $
Author:
Joseph Hutcherson

Nested Class Summary
static class InterruptLatency.TestProps
           
 
Field Summary
static int counter
          iteration counter
static long[] handlerStart
           
 MemoryType mt
          Memory type to use
static javax.realtime.PeriodicParameters params
           
static java.lang.Thread primary
          Keep this declaration fairly high level, and cast to appropriate class when necessary
static long[] primaryStart
           
static long[] primaryStop
          Timestamp arrays
static javax.realtime.RelativeTime rtCost
          Handlers and parameters
static javax.realtime.RelativeTime rtDeadline
           
static javax.realtime.RelativeTime rtPeriod
           
static javax.realtime.RelativeTime rtStart
           
static InterruptLatency.TestProps testProps
          Test properties for this run
 ThreadType tt
          Thread type to use.
 
Constructor Summary
InterruptLatency()
          constructor for test class Instantiates testProperties.
InterruptLatency(InterruptLatency.TestProps props)
           
 
Method Summary
static void main(java.lang.String[] args)
           
 void run()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

testProps

public static InterruptLatency.TestProps testProps
Test properties for this run


tt

public ThreadType tt
Thread type to use.


mt

public MemoryType mt
Memory type to use


primaryStop

public static long[] primaryStop
Timestamp arrays


primaryStart

public static long[] primaryStart

handlerStart

public static long[] handlerStart

counter

public static int counter
iteration counter


rtCost

public static javax.realtime.RelativeTime rtCost
Handlers and parameters


rtDeadline

public static javax.realtime.RelativeTime rtDeadline

rtStart

public static javax.realtime.RelativeTime rtStart

rtPeriod

public static javax.realtime.RelativeTime rtPeriod

params

public static javax.realtime.PeriodicParameters params

primary

public static java.lang.Thread primary
Keep this declaration fairly high level, and cast to appropriate class when necessary

Constructor Detail

InterruptLatency

public InterruptLatency()
                 throws java.lang.Exception
constructor for test class Instantiates testProperties.

Throws:
java.lang.Throwable
java.lang.IllegalAccessException
java.lang.InstantiationException
java.lang.Exception

InterruptLatency

public InterruptLatency(InterruptLatency.TestProps props)
                 throws java.lang.Exception
Method Detail

main

public static void main(java.lang.String[] args)
Parameters:
args - the command line arguments

run

public void run()
Specified by:
run in interface java.lang.Runnable