You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/05/10 13:21:33 UTC

[incubator-nuttx] 07/07: cpuload: Support the internal computation in the tickless mode

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit b907a1fec7af1749d8221f1de50007822c9398d8
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sat Apr 23 09:18:44 2022 +0800

    cpuload: Support the internal computation in the tickless mode
    
    just like how the same thing done in nxsched_process_timer
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 sched/sched/sched_timerexpiration.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/sched/sched/sched_timerexpiration.c b/sched/sched/sched_timerexpiration.c
index 3eae452ca4..4ce08f1bac 100644
--- a/sched/sched/sched_timerexpiration.c
+++ b/sched/sched/sched_timerexpiration.c
@@ -385,6 +385,19 @@ static unsigned int nxsched_timer_process(unsigned int ticks,
   clock_update_wall_time();
 #endif
 
+#if defined(CONFIG_SCHED_CPULOAD) && !defined(CONFIG_SCHED_CPULOAD_EXTCLK)
+  /* Perform CPU load measurements (before any timer-initiated context
+   * switches can occur)
+   */
+
+#ifdef CONFIG_HAVE_WEAKFUNCTIONS
+  if (nxsched_process_cpuload_ticks != NULL)
+#endif
+    {
+      nxsched_process_cpuload_ticks(ticks);
+    }
+#endif
+
   /* Process watchdogs */
 
   tmp = nxsched_process_wdtimer(ticks, noswitches);