sched/wdog: Replace periodcial timer with the wd_start_next.

This commit replaced periodical timer with the wd_start_next to improve the timing accuracy.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
This commit is contained in:
ouyangxiangzhen 2025-05-29 14:42:45 +08:00 committed by Alan C. Assis
parent 9d1b958524
commit efe2af643f
5 changed files with 5 additions and 5 deletions

View file

@ -135,7 +135,7 @@ static int adjtime_start(long long adjust_usec)
if (g_adjtime_ppb != 0) if (g_adjtime_ppb != 0)
{ {
wd_start(&g_adjtime_wdog, MSEC2TICK(CONFIG_CLOCK_ADJTIME_PERIOD_MS), wd_start(&g_adjtime_wdog, MSEC2TICK(CONFIG_CLOCK_ADJTIME_PERIOD_MS),
adjtime_wdog_callback, 0); adjtime_wdog_callback, 0);
} }
else else
{ {

View file

@ -64,7 +64,7 @@ static void perf_update(wdparm_t arg)
clock_t tick = (clock_t)LONG_MAX * TICK_PER_SEC / up_perf_getfreq(); clock_t tick = (clock_t)LONG_MAX * TICK_PER_SEC / up_perf_getfreq();
perf_gettime(); perf_gettime();
wd_start((FAR struct wdog_s *)arg, tick, perf_update, arg); wd_start_next((FAR struct wdog_s *)arg, tick, perf_update, arg);
} }
/**************************************************************************** /****************************************************************************

View file

@ -118,7 +118,7 @@ static void cpuload_callback(wdparm_t arg)
{ {
FAR struct wdog_s *wdog = (FAR struct wdog_s *)arg; FAR struct wdog_s *wdog = (FAR struct wdog_s *)arg;
nxsched_process_cpuload_ticks(CPULOAD_SAMPLING_PERIOD); nxsched_process_cpuload_ticks(CPULOAD_SAMPLING_PERIOD);
wd_start(wdog, CPULOAD_SAMPLING_PERIOD, cpuload_callback, arg); wd_start_next(wdog, CPULOAD_SAMPLING_PERIOD, cpuload_callback, arg);
} }
#endif #endif

View file

@ -102,7 +102,7 @@ static void profil_timer_handler(wdparm_t arg)
#endif #endif
profil_timer_handler_cpu(prof); profil_timer_handler_cpu(prof);
wd_start(&prof->timer, PROFTICK, profil_timer_handler, arg); wd_start_next(&prof->timer, PROFTICK, profil_timer_handler, arg);
} }
/**************************************************************************** /****************************************************************************

View file

@ -128,7 +128,7 @@ static inline void timer_restart(FAR struct posix_timer_s *timer,
*/ */
frame = (delay + timer->pt_delay) / timer->pt_delay; frame = (delay + timer->pt_delay) / timer->pt_delay;
timer->pt_overrun = frame - 1; timer->pt_overrun = frame - 1;
timer->pt_expected += frame * timer->pt_delay; timer->pt_expected += frame * timer->pt_delay;
wd_start_abstick(&timer->pt_wdog, timer->pt_expected, wd_start_abstick(&timer->pt_wdog, timer->pt_expected,