blob: 9b2d10a40c74b1ea3e7954b06d763a3eb1563475 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
== Task Switch Benchmark
This benchmark measures the average time it takes the system to switch between
two independent and active tasks of equal priority. Task switching is synchronous
and non-preemptive.
=== Directives
* rtems_task_wake_after
=== Methodology
This benchmark utilizes rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ) to
achieve a synchronous, non-preemptive task switch. rtems_task_wake_after
used in this context is essentially just a yield.
As this is an average, we structure the benchmark code in a way that results
in some overhead being included that inflates the total elapsed time. This
overhead includes:
* the time it takes to iterate through the for loops (minimal
* overhead code in rtems_task_wake_after
We instantiate two tasks, and time how long it takes for them to switch back
and forth between themselves a total of BENCHMARKS * 2 times. We then use
the put_time call to divide this total elapsed time by BENCHMARKS * 2, giving
an average, and subtract out the overhead time we found earlier.
|