source: rtems/testsuites/rhealstone/rhtaskpreempt/rhtaskpreempt.adoc @ 564ce0f

Last change on this file since 564ce0f was b6c1578, checked in by Joel Sherrill <joel.sherrill@…>, on Jan 5, 2014 at 5:17:08 PM

rhealstone: Add rh prefix to all test names

This makes them easier to spot as a group in wildcard searches.

  • Property mode set to 100644
File size: 1.6 KB
1= Task Preemption Benchmark
3This benchmark measures the average time it takes the system to recognize
4a ready higher priority task and switch to it from a lower priority task.
5This differs from a task-switch in the sense that there is no explicit
6yield, the system forces the context switch.
8== Directives
10  * rtems_task_suspend
11  * rtems_task_resume
13== Methodology
15Preemption usually occurs in a program when a high priority task moves from
16a suspended or idle state to a ready state in response to an event. This is
17achieved in the benchmark by using rtems_task_suspend and rtems_task_resume
18to move the high priority task in between states.
20As this is an average, we structure the benchmark code in a way that results
21in some overhead being included that inflates the total elapsed time. This
22overhead includes:
23  * loop overhead (minimal)
24  * the time it takes to task-switch from the high priority task back to
25    the low priority task.
26  * The time it takes to change the state of a task (suspend/resume).
28We instantiate two tasks, one with a higher priority than the other. The
29benchmark starts with the high priority task suspended. The benchmark code
30has the lower priority task resume the high priority task, at which point
31the preemption we are seeking to time occurs. The high priority task, now
32executing, suspends it self, and a non-preemptive task switch back to the
33low priority task occurs. This is repeated a total of BENCHMARKS times.
35The average time is found by using put_time to divide the total elapsed time
36by the number of benchmarks, and subtracting out the overhead found earlier.
Note: See TracBrowser for help on using the repository browser.