wdog: optimize a bit speed in wd_start

After these wdog refactor:
We conducted a latency measurement using the rt-tests/cyclictest (commit cadd661) on an x86_64 NUC12 equipped with an i7-1255U processor and 16GB of LPDDR5 memory. The specific command used for this microbenchmark was cyclictest -q -l 100000 -h 30000, which is designed to assess the responsiveness of the cyclic timer.

The findings from our benchmark are summarized below, highlighting the minimum, median, and maximum latency values for each operating system tested:

Operating System	Minimum Latency (us)	Median Latency (us)	Maximum Latency (us)
Linux	            48	                    53	                410
PreemptRT	        6	                    57	                148
Xenomai	            53	                    53	                64
NuttX	            64	                    626	                1212
NuttX (refactor)	1	                    1	                3
In this table, "Min" indicates the shortest latency observed, "Median" represents the middle value of the latency distribution, and "Max" denotes the longest latency encountered.

The systems tested were as follows:

Linux: ACRN version 6.1.80 (commit f528146)
PreemptRT: Linux kernel 5.4.251 with the 5.4.254-rt85 patch applied
Xenomai: Linux kernel 5.4.251 patched with ipipe-core-5.4.239-x86-13
These results clearly demonstrate the varying performance of different operating systems in terms of timer latency, the refactored NuttX showing particularly low latency values.

Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
ligd 2024-09-06 21:01:43 +08:00 committed by Xiang Xiao
parent cb5bab34f1
commit 7ff7f6ec21
1 changed files with 2 additions and 4 deletions

View File

@ -178,8 +178,6 @@ void wd_insert(FAR struct wdog_s *wdog, clock_t expired,
{
FAR struct wdog_s *curr;
DEBUGASSERT(wdog && wdentry);
/* Traverse the watchdog list */
list_for_every_entry(&g_wdactivelist, curr, struct wdog_s, node)
@ -295,8 +293,8 @@ int wd_start_absolute(FAR struct wdog_s *wdog, clock_t ticks,
wd_insert(wdog, ticks, wdentry, arg);
reassess |= list_is_head(&g_wdactivelist, &wdog->node);
if (!g_wdtimernested && reassess)
if (!g_wdtimernested &&
(reassess || list_is_head(&g_wdactivelist, &wdog->node)))
{
/* Resume the interval timer that will generate the next
* interval event. If the timer at the head of the list changed,