suramadu.tests.latency
Class MissedDeadline

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

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

The MissedDeadline class measures the latency from the missing of a deadline to the invocation of its handler. This latency is calculated by subtracting the start time of the thread plus its deadline from the start time of the handler.

PURPOSE: Measure the time it takes to get to the handler when a real-time thread's deadline is missed.

DESIGN: An RT or NHRT thread with desired memory type will record the time at which it is run. It will then sample the current time in a loop for a configurable duration. The VM will at some point detect a missed deadline and activate the handler. The handler will record its start time, and restart the thread for the next iteration. The handler will also record the current loop time of the thread. This time is only valid on single CPU workstations because the thread will continue to execute in the presence of the handler, i.e. it will not be pre-empted.

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: The latency definition is rather simplistic as it does not account for possibilities such as the VM triggering the handler too early but then is slow to activate the handler. This is due to the fact that the thread is not pre-empted (and we could obtain the last timestamp taken) and we have no further insight into the workings of the VM.

INPUTS:
The following parameters may be specified in a properties file whose name is of the form suramadu.tests.latency.MissedDeadline.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
"handlerpriority" "250" Priority of the missed deadline handler
"handlertype" "BOUND" Type of handler, either BOUND or UNBOUND
"handlernonheap" "TRUE" If the handler should have NHRT properties. Other possible value is 'FALSE'. If handlertype is UNBOUND this value should be FALSE.

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

File suffix Description
latency Start time of handler - (start time of thread + deadline)
handlerJitter Relative jitter of handler start times
primaryJitter Relative jitter of the thread start time
preempted Time at which the thread was preempted by the handler. Only valid for single CPU workstations
SUMMARY Overall latency statistics

EXAMPLES:

ORIGINS:

Version:
$Revision: 1.1 $
Author:
Joseph Hutcherson

Nested Class Summary
static class MissedDeadline.TestProps
           
 
Field Summary
static boolean active
           
static int counter
          iteration counter
static long currentTime
          Globals used by the primary thread and handler
static long[] handlerStart
           
 MemoryType mt
          Memory type to use
static javax.realtime.PeriodicParameters params
           
static javax.realtime.RealtimeThread 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
           
static javax.realtime.RelativeTime rtDeadline
           
static javax.realtime.AsyncEventHandler rtMissHandler
          Handlers and parameters
static javax.realtime.RelativeTime rtPeriod
           
static javax.realtime.RelativeTime rtStart
           
static MissedDeadline.TestProps testProps
          Test properties for this run
 ThreadType tt
          Thread type to use.
 
Constructor Summary
MissedDeadline()
          constructor for test class Instantiates testProperties.
MissedDeadline(MissedDeadline.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 MissedDeadline.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

currentTime

public static long currentTime
Globals used by the primary thread and handler


active

public static boolean active

counter

public static int counter
iteration counter


rtMissHandler

public static javax.realtime.AsyncEventHandler rtMissHandler
Handlers and parameters


rtCost

public static javax.realtime.RelativeTime rtCost

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 javax.realtime.RealtimeThread primary
Keep this declaration fairly high level, and cast to appropriate class when necessary

Constructor Detail

MissedDeadline

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

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

MissedDeadline

public MissedDeadline(MissedDeadline.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