Back to home page

LXR

 
 

    


Warning, /testsuites/rhealstone/rhtaskpreempt/rhtaskpreempt.adoc is written in an unsupported language. File is not indexed.

0001 = Task Preemption Benchmark
0002 
0003 This benchmark measures the average time it takes the system to recognize
0004 a ready higher priority task and switch to it from a lower priority task.
0005 This differs from a task-switch in the sense that there is no explicit
0006 yield, the system forces the context switch.
0007 
0008 == Directives
0009 
0010   * rtems_task_suspend
0011   * rtems_task_resume
0012 
0013 == Methodology
0014 
0015 Preemption usually occurs in a program when a high priority task moves from
0016 a suspended or idle state to a ready state in response to an event. This is
0017 achieved in the benchmark by using rtems_task_suspend and rtems_task_resume
0018 to move the high priority task in between states.
0019 
0020 As this is an average, we structure the benchmark code in a way that results
0021 in some overhead being included that inflates the total elapsed time. This
0022 overhead includes:
0023   * loop overhead (minimal)
0024   * the time it takes to task-switch from the high priority task back to
0025     the low priority task.
0026   * The time it takes to change the state of a task (suspend/resume).
0027 
0028 We instantiate two tasks, one with a higher priority than the other. The
0029 benchmark starts with the high priority task suspended. The benchmark code
0030 has the lower priority task resume the high priority task, at which point
0031 the preemption we are seeking to time occurs. The high priority task, now
0032 executing, suspends it self, and a non-preemptive task switch back to the
0033 low priority task occurs. This is repeated a total of BENCHMARKS times.
0034 
0035 The average time is found by using put_time to divide the total elapsed time
0036 by the number of benchmarks, and subtracting out the overhead found earlier.