... | ... | @@ -77,7 +77,10 @@ The ISR will use k_thread_priority_set to take back the control thread priority |
|
|
<th>Total overhead in % (Ctrl thread @20kHz)</th>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td>No optimizations</td>
|
|
|
<td>
|
|
|
|
|
|
Timing with GpioApi<br>No optimizations
|
|
|
</td>
|
|
|
<td>11 us</td>
|
|
|
<td>14 us</td>
|
|
|
<td>25 us</td>
|
... | ... | @@ -90,6 +93,8 @@ The ISR will use k_thread_priority_set to take back the control thread priority |
|
|
|
|
|
<div>
|
|
|
|
|
|
Timing with GpioApi
|
|
|
|
|
|
<span dir="">CONFIG_SPEED_OPTIMIZATIONS</span>=y
|
|
|
|
|
|
</div>
|
... | ... | @@ -99,6 +104,21 @@ The ISR will use k_thread_priority_set to take back the control thread priority |
|
|
<td>23 us</td>
|
|
|
<td>46 %</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td>Timing with LL_GPIO instead of GpioApi</td>
|
|
|
<td>
|
|
|
|
|
|
</td>
|
|
|
<td>
|
|
|
|
|
|
</td>
|
|
|
<td>
|
|
|
|
|
|
</td>
|
|
|
<td>
|
|
|
|
|
|
</td>
|
|
|
</tr>
|
|
|
</table>
|
|
|
|
|
|
En pratique le timing du temps passé dans l'interruption est observé par un GPIO tandis que le temps passé dans le contexte switch est visualisé par un second gpio (voir capture d'écran ci-dessous).
|
... | ... | @@ -119,7 +139,10 @@ only |
|
|
</th>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td>No optimizations</td>
|
|
|
<td>
|
|
|
|
|
|
Timing with GpioApi <br>No optimizations
|
|
|
</td>
|
|
|
<td>4.4 us</td>
|
|
|
</tr>
|
|
|
<tr>
|
... | ... | @@ -129,6 +152,7 @@ only |
|
|
|
|
|
<div>
|
|
|
|
|
|
Timing with GpioApi\
|
|
|
<span dir="">CONFIG_SPEED_OPTIMIZATIONS</span>=y
|
|
|
|
|
|
</div>
|
... | ... | @@ -137,3 +161,27 @@ only |
|
|
</tr>
|
|
|
</table>
|
|
|
|
|
|
|
|
|
## Timing the OS overhead with an EDF scheduler
|
|
|
|
|
|
The Earliest Deadline First (EDF) algorithm is a dynamic scheduling rule that selects tasks according to their absolute deadlines. Specifically, tasks with earlier deadlines will be executed at higher priorities. Since the absolute deadline of a periodic task depends on the current nth instance, EDF is a dynamic priority assignment. It is typically executed in preemptive mode, thus the currently executing task is preempted whenever another periodic instance with earlier deadline becomes active. \
|
|
|
\
|
|
|
Note that EDF does not make any specific assumption on the periodicity of the tasks; hence, it can be used for scheduling periodic as ell as aperiodic tasks. EDF is proved to be an optimal scheduling algorithm both for periodic and aperiodic tasks.
|
|
|
|
|
|
In zephyr EDF could be implemented using
|
|
|
|
|
|
<dl>
|
|
|
<dt>
|
|
|
|
|
|
<span dir="">void k_thread_deadline_set(k_tid_t thread</span>, <span dir="">int deadline)</span>[¶](https://docs.zephyrproject.org/3.1.0/kernel/services/threads/index.html#c.k_thread_deadline_set "Permalink to this definition")
|
|
|
|
|
|
</dt>
|
|
|
<dd>
|
|
|
|
|
|
Set deadline expiration time for scheduler.
|
|
|
|
|
|
This sets the “deadline” expiration as a time delta from the current time, in the same units used by [<span dir="">k_cycle_get_32()</span>](https://docs.zephyrproject.org/3.1.0/kernel/services/timing/clocks.html#group__clock__apis_1ga208687de625e0036558343b4e66143d3). The scheduler (when deadline scheduling is enabled) **will choose the next expiring thread when selecting between threads at the same static priority**. Threads at different priorities will be scheduled according to their static priority.
|
|
|
|
|
|
</dd>
|
|
|
</dl>
|
|
|
|