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/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new d0a5489ac5 sched: explicitly select the cpuload clock source 
configuration
d0a5489ac5 is described below

commit d0a5489ac596c161f909c29564c810c4215c8558
Author: yinshengkai <[email protected]>
AuthorDate: Thu Oct 26 21:03:16 2023 +0800

    sched: explicitly select the cpuload clock source configuration
    
    Different configurations require different dependencies.
    Explicitly select dependencies to avoid automatically selecting 
inappropriate configurations.
    
    Signed-off-by: yinshengkai <[email protected]>
---
 .../imxrt1050-evk/configs/libcxxtest/defconfig     |  2 +-
 .../imxrt1060-evk/configs/libcxxtest/defconfig     |  2 +-
 .../imxrt1064-evk/configs/libcxxtest/defconfig     |  2 +-
 .../imxrt/teensy-4.x/configs/pikron-bb/defconfig   |  1 -
 .../arm/lpc17xx_40xx/lx_cpu/configs/nsh/defconfig  |  2 +-
 boards/arm/sam34/sam4s-xplained-pro/Kconfig        |  2 +-
 .../stm32/stm32butterfly2/configs/nsh/defconfig    |  2 +-
 .../stm32/stm32butterfly2/configs/nshnet/defconfig |  2 +-
 .../stm32butterfly2/configs/nshusbdev/defconfig    |  2 +-
 .../stm32butterfly2/configs/nshusbhost/defconfig   |  2 +-
 .../stm32h7/nucleo-h743zi2/configs/jumbo/defconfig |  2 +-
 .../risc-v/bl602/bl602evb/configs/timer/defconfig  |  2 +-
 crypto/random_pool.c                               |  4 ++--
 fs/procfs/Kconfig                                  |  2 +-
 fs/procfs/fs_procfs.c                              |  3 ++-
 fs/procfs/fs_procfscpuload.c                       |  3 ++-
 fs/procfs/fs_procfsproc.c                          | 16 +++++++-------
 include/nuttx/clock.h                              |  4 ++--
 include/nuttx/sched.h                              |  2 +-
 sched/Kconfig                                      | 25 +++++++++++-----------
 sched/misc/assert.c                                | 10 ++++-----
 sched/sched/CMakeLists.txt                         |  2 +-
 sched/sched/Make.defs                              |  2 +-
 sched/sched/sched.h                                |  2 +-
 sched/sched/sched_cpuload.c                        |  4 ----
 sched/sched/sched_cpuload_oneshot.c                |  4 ----
 sched/sched/sched_cpuload_period.c                 |  4 ----
 sched/sched/sched_releasetcb.c                     |  2 +-
 sched/sched/sched_sysinfo.c                        |  4 ++--
 29 files changed, 52 insertions(+), 64 deletions(-)

diff --git a/boards/arm/imxrt/imxrt1050-evk/configs/libcxxtest/defconfig 
b/boards/arm/imxrt/imxrt1050-evk/configs/libcxxtest/defconfig
index d6751fb604..e3af05261f 100644
--- a/boards/arm/imxrt/imxrt1050-evk/configs/libcxxtest/defconfig
+++ b/boards/arm/imxrt/imxrt1050-evk/configs/libcxxtest/defconfig
@@ -32,7 +32,7 @@ CONFIG_NSH_LINELEN=64
 CONFIG_NSH_READLINE=y
 CONFIG_RAM_SIZE=536870912
 CONFIG_RAM_START=0x20200000
-CONFIG_SCHED_CPULOAD=y
+CONFIG_SCHED_CPULOAD_SYSCLK=y
 CONFIG_START_DAY=14
 CONFIG_START_MONTH=3
 CONFIG_SYSTEM_NSH=y
diff --git a/boards/arm/imxrt/imxrt1060-evk/configs/libcxxtest/defconfig 
b/boards/arm/imxrt/imxrt1060-evk/configs/libcxxtest/defconfig
index dc26dcfd87..5c38fafdcb 100644
--- a/boards/arm/imxrt/imxrt1060-evk/configs/libcxxtest/defconfig
+++ b/boards/arm/imxrt/imxrt1060-evk/configs/libcxxtest/defconfig
@@ -32,7 +32,7 @@ CONFIG_NSH_LINELEN=64
 CONFIG_NSH_READLINE=y
 CONFIG_RAM_SIZE=1048576
 CONFIG_RAM_START=0x20200000
-CONFIG_SCHED_CPULOAD=y
+CONFIG_SCHED_CPULOAD_SYSCLK=y
 CONFIG_START_DAY=14
 CONFIG_START_MONTH=3
 CONFIG_SYSTEM_NSH=y
diff --git a/boards/arm/imxrt/imxrt1064-evk/configs/libcxxtest/defconfig 
b/boards/arm/imxrt/imxrt1064-evk/configs/libcxxtest/defconfig
index 817a01d802..9ac593e74a 100644
--- a/boards/arm/imxrt/imxrt1064-evk/configs/libcxxtest/defconfig
+++ b/boards/arm/imxrt/imxrt1064-evk/configs/libcxxtest/defconfig
@@ -32,7 +32,7 @@ CONFIG_NSH_LINELEN=64
 CONFIG_NSH_READLINE=y
 CONFIG_RAM_SIZE=1048576
 CONFIG_RAM_START=0x20200000
-CONFIG_SCHED_CPULOAD=y
+CONFIG_SCHED_CPULOAD_SYSCLK=y
 CONFIG_START_DAY=14
 CONFIG_START_MONTH=3
 CONFIG_SYSTEM_NSH=y
diff --git a/boards/arm/imxrt/teensy-4.x/configs/pikron-bb/defconfig 
b/boards/arm/imxrt/teensy-4.x/configs/pikron-bb/defconfig
index 230c687f4d..9eeb882f7b 100644
--- a/boards/arm/imxrt/teensy-4.x/configs/pikron-bb/defconfig
+++ b/boards/arm/imxrt/teensy-4.x/configs/pikron-bb/defconfig
@@ -143,7 +143,6 @@ CONFIG_RAM_SIZE=1048576
 CONFIG_RAM_START=0x20200000
 CONFIG_READLINE_CMD_HISTORY=y
 CONFIG_RR_INTERVAL=10
-CONFIG_SCHED_CPULOAD=y
 CONFIG_SCHED_LPWORK=y
 CONFIG_SCHED_TICKLESS=y
 CONFIG_SCHED_TICKLESS_ALARM=y
diff --git a/boards/arm/lpc17xx_40xx/lx_cpu/configs/nsh/defconfig 
b/boards/arm/lpc17xx_40xx/lx_cpu/configs/nsh/defconfig
index 900db1cfb1..0d23ad5f66 100644
--- a/boards/arm/lpc17xx_40xx/lx_cpu/configs/nsh/defconfig
+++ b/boards/arm/lpc17xx_40xx/lx_cpu/configs/nsh/defconfig
@@ -138,7 +138,7 @@ CONFIG_PTHREAD_STACK_MIN=1024
 CONFIG_RAM_SIZE=65536
 CONFIG_RAM_START=0x10000000
 CONFIG_RR_INTERVAL=200
-CONFIG_SCHED_CPULOAD=y
+CONFIG_SCHED_CPULOAD_SYSCLK=y
 CONFIG_SCHED_HPWORK=y
 CONFIG_SCHED_HPWORKPRIORITY=192
 CONFIG_SCHED_IRQMONITOR=y
diff --git a/boards/arm/sam34/sam4s-xplained-pro/Kconfig 
b/boards/arm/sam34/sam4s-xplained-pro/Kconfig
index f8150d2fe4..c087aa791b 100644
--- a/boards/arm/sam34/sam4s-xplained-pro/Kconfig
+++ b/boards/arm/sam34/sam4s-xplained-pro/Kconfig
@@ -18,7 +18,7 @@ config SAM4S_XPLAINED_PRO_SCHED_TIMER_DEVPATH
 config SAM4S_XPLAINED_PRO_CPULOAD_TIMER_DEVPATH
        string "CPU Load Timer Device Path"
        default "/dev/tc0"
-       depends on TIMER && SCHED_CPULOAD && SCHED_CPULOAD_EXTCLK
+       depends on TIMER && SCHED_CPULOAD_EXTCLK
 
 config SAM34_NAND_BLOCKMOUNT
        bool "NAND FLASH auto-mount"
diff --git a/boards/arm/stm32/stm32butterfly2/configs/nsh/defconfig 
b/boards/arm/stm32/stm32butterfly2/configs/nsh/defconfig
index 4dcc330ce0..2436642933 100644
--- a/boards/arm/stm32/stm32butterfly2/configs/nsh/defconfig
+++ b/boards/arm/stm32/stm32butterfly2/configs/nsh/defconfig
@@ -50,7 +50,7 @@ CONFIG_RAM_START=0x20000000
 CONFIG_RAW_BINARY=y
 CONFIG_READLINE_TABCOMPLETION=y
 CONFIG_RR_INTERVAL=100
-CONFIG_SCHED_CPULOAD=y
+CONFIG_SCHED_CPULOAD_SYSCLK=y
 CONFIG_SCHED_HPWORK=y
 CONFIG_SCHED_HPWORKPRIORITY=192
 CONFIG_SCHED_HPWORKSTACKSIZE=1024
diff --git a/boards/arm/stm32/stm32butterfly2/configs/nshnet/defconfig 
b/boards/arm/stm32/stm32butterfly2/configs/nshnet/defconfig
index e0b4efd790..d09176bee4 100644
--- a/boards/arm/stm32/stm32butterfly2/configs/nshnet/defconfig
+++ b/boards/arm/stm32/stm32butterfly2/configs/nshnet/defconfig
@@ -63,7 +63,7 @@ CONFIG_RAM_START=0x20000000
 CONFIG_RAW_BINARY=y
 CONFIG_READLINE_TABCOMPLETION=y
 CONFIG_RR_INTERVAL=100
-CONFIG_SCHED_CPULOAD=y
+CONFIG_SCHED_CPULOAD_SYSCLK=y
 CONFIG_SCHED_HPWORK=y
 CONFIG_SCHED_HPWORKPRIORITY=192
 CONFIG_SCHED_HPWORKSTACKSIZE=1024
diff --git a/boards/arm/stm32/stm32butterfly2/configs/nshusbdev/defconfig 
b/boards/arm/stm32/stm32butterfly2/configs/nshusbdev/defconfig
index 7c7070d5ce..1017fb2e5a 100644
--- a/boards/arm/stm32/stm32butterfly2/configs/nshusbdev/defconfig
+++ b/boards/arm/stm32/stm32butterfly2/configs/nshusbdev/defconfig
@@ -49,7 +49,7 @@ CONFIG_RAM_START=0x20000000
 CONFIG_RAW_BINARY=y
 CONFIG_READLINE_TABCOMPLETION=y
 CONFIG_RR_INTERVAL=100
-CONFIG_SCHED_CPULOAD=y
+CONFIG_SCHED_CPULOAD_SYSCLK=y
 CONFIG_SCHED_HPWORK=y
 CONFIG_SCHED_HPWORKPRIORITY=192
 CONFIG_SCHED_HPWORKSTACKSIZE=1024
diff --git a/boards/arm/stm32/stm32butterfly2/configs/nshusbhost/defconfig 
b/boards/arm/stm32/stm32butterfly2/configs/nshusbhost/defconfig
index 4dcc330ce0..2436642933 100644
--- a/boards/arm/stm32/stm32butterfly2/configs/nshusbhost/defconfig
+++ b/boards/arm/stm32/stm32butterfly2/configs/nshusbhost/defconfig
@@ -50,7 +50,7 @@ CONFIG_RAM_START=0x20000000
 CONFIG_RAW_BINARY=y
 CONFIG_READLINE_TABCOMPLETION=y
 CONFIG_RR_INTERVAL=100
-CONFIG_SCHED_CPULOAD=y
+CONFIG_SCHED_CPULOAD_SYSCLK=y
 CONFIG_SCHED_HPWORK=y
 CONFIG_SCHED_HPWORKPRIORITY=192
 CONFIG_SCHED_HPWORKSTACKSIZE=1024
diff --git a/boards/arm/stm32h7/nucleo-h743zi2/configs/jumbo/defconfig 
b/boards/arm/stm32h7/nucleo-h743zi2/configs/jumbo/defconfig
index e7a5b98dcc..ee5aaf9524 100644
--- a/boards/arm/stm32h7/nucleo-h743zi2/configs/jumbo/defconfig
+++ b/boards/arm/stm32h7/nucleo-h743zi2/configs/jumbo/defconfig
@@ -88,7 +88,7 @@ CONFIG_RAW_BINARY=y
 CONFIG_READLINE_CMD_HISTORY=y
 CONFIG_READLINE_TABCOMPLETION=y
 CONFIG_RR_INTERVAL=200
-CONFIG_SCHED_CPULOAD=y
+CONFIG_SCHED_CPULOAD_SYSCLK=y
 CONFIG_SCHED_HPWORK=y
 CONFIG_SCHED_HPWORKSTACKSIZE=2048
 CONFIG_SCHED_IRQMONITOR=y
diff --git a/boards/risc-v/bl602/bl602evb/configs/timer/defconfig 
b/boards/risc-v/bl602/bl602evb/configs/timer/defconfig
index 37632bde29..198ad9e46b 100644
--- a/boards/risc-v/bl602/bl602evb/configs/timer/defconfig
+++ b/boards/risc-v/bl602/bl602evb/configs/timer/defconfig
@@ -65,7 +65,7 @@ CONFIG_RAM_SIZE=134217728
 CONFIG_RAM_START=0xc0800000
 CONFIG_RAW_BINARY=y
 CONFIG_RR_INTERVAL=200
-CONFIG_SCHED_CPULOAD=y
+CONFIG_SCHED_CPULOAD_SYSCLK=y
 CONFIG_SCHED_WAITPID=y
 CONFIG_STACK_COLORATION=y
 CONFIG_START_DAY=20
diff --git a/crypto/random_pool.c b/crypto/random_pool.c
index 88b655d1ee..cdbcb0df4c 100644
--- a/crypto/random_pool.c
+++ b/crypto/random_pool.c
@@ -213,7 +213,7 @@ static void addentropy(FAR const uint32_t *buf, size_t n, 
bool inc_new)
 
 static void initentropy(FAR blake2s_state *S)
 {
-#ifdef CONFIG_SCHED_CPULOAD
+#ifndef CONFIG_SCHED_CPULOAD_NONE
   struct cpuload_s load;
 #endif
   uint32_t tmp;
@@ -231,7 +231,7 @@ static void initentropy(FAR blake2s_state *S)
 
   tmp = sizeof(entropy_pool.pool);
   tmp <<= 27;
-#ifdef CONFIG_SCHED_CPULOAD
+#ifndef CONFIG_SCHED_CPULOAD_NONE
   clock_cpuload(0, &load);
   tmp += load.total ^ ROTL_32(load.active, 23);
 #endif
diff --git a/fs/procfs/Kconfig b/fs/procfs/Kconfig
index d6113ded3d..9dc4e96ba0 100644
--- a/fs/procfs/Kconfig
+++ b/fs/procfs/Kconfig
@@ -45,7 +45,7 @@ config FS_PROCFS_EXCLUDE_CPUINFO
 
 config FS_PROCFS_EXCLUDE_CPULOAD
        bool "Exclude CPU load"
-       depends on SCHED_CPULOAD
+       depends on !SCHED_CPULOAD_NONE
        default DEFAULT_SMALL
 
 config FS_PROCFS_EXCLUDE_ENVIRON
diff --git a/fs/procfs/fs_procfs.c b/fs/procfs/fs_procfs.c
index 276204cd6f..340b04edc0 100644
--- a/fs/procfs/fs_procfs.c
+++ b/fs/procfs/fs_procfs.c
@@ -106,7 +106,8 @@ static const struct procfs_entry_s g_procfs_entries[] =
   { "cpuinfo",      &g_cpuinfo_operations,  PROCFS_FILE_TYPE   },
 #endif
 
-#if defined(CONFIG_SCHED_CPULOAD) && !defined(CONFIG_FS_PROCFS_EXCLUDE_CPULOAD)
+#if !defined(CONFIG_SCHED_CPULOAD_NONE) && \
+    !defined(CONFIG_FS_PROCFS_EXCLUDE_CPULOAD)
   { "cpuload",      &g_cpuload_operations,  PROCFS_FILE_TYPE   },
 #endif
 
diff --git a/fs/procfs/fs_procfscpuload.c b/fs/procfs/fs_procfscpuload.c
index eafc7d576f..4bd75ee84e 100644
--- a/fs/procfs/fs_procfscpuload.c
+++ b/fs/procfs/fs_procfscpuload.c
@@ -45,7 +45,8 @@
 #include <nuttx/fs/procfs.h>
 
 #if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_PROCFS)
-#if defined(CONFIG_SCHED_CPULOAD) && !defined(CONFIG_FS_PROCFS_EXCLUDE_CPULOAD)
+#if !defined(CONFIG_SCHED_CPULOAD_NONE) && \
+    !defined(CONFIG_FS_PROCFS_EXCLUDE_CPULOAD)
 
 /****************************************************************************
  * Pre-processor Definitions
diff --git a/fs/procfs/fs_procfsproc.c b/fs/procfs/fs_procfsproc.c
index a443e50b40..7e18d3b7e6 100644
--- a/fs/procfs/fs_procfsproc.c
+++ b/fs/procfs/fs_procfsproc.c
@@ -54,7 +54,7 @@
 #include <nuttx/fs/ioctl.h>
 #include <nuttx/mm/mm.h>
 
-#if defined(CONFIG_SCHED_CPULOAD) || defined(CONFIG_SCHED_CRITMONITOR)
+#if !defined(CONFIG_SCHED_CPULOAD_NONE) || defined(CONFIG_SCHED_CRITMONITOR)
 #  include <nuttx/clock.h>
 #endif
 
@@ -84,7 +84,7 @@ enum proc_node_e
   PROC_LEVEL0 = 0,                    /* The top-level directory */
   PROC_STATUS,                        /* Task/thread status */
   PROC_CMDLINE,                       /* Task command line */
-#ifdef CONFIG_SCHED_CPULOAD
+#ifndef CONFIG_SCHED_CPULOAD_NONE
   PROC_LOADAVG,                       /* Average CPU utilization */
 #endif
 #ifdef CONFIG_SCHED_CRITMONITOR
@@ -171,7 +171,7 @@ static ssize_t proc_status(FAR struct proc_file_s *procfile,
 static ssize_t proc_cmdline(FAR struct proc_file_s *procfile,
                  FAR struct tcb_s *tcb, FAR char *buffer, size_t buflen,
                  off_t offset);
-#ifdef CONFIG_SCHED_CPULOAD
+#ifndef CONFIG_SCHED_CPULOAD_NONE
 static ssize_t proc_loadavg(FAR struct proc_file_s *procfile,
                  FAR struct tcb_s *tcb, FAR char *buffer, size_t buflen,
                  off_t offset);
@@ -278,7 +278,7 @@ static const struct proc_node_s g_cmdline =
   "cmdline",      "cmdline", (uint8_t)PROC_CMDLINE,      DTYPE_FILE        /* 
Task command line */
 };
 
-#ifdef CONFIG_SCHED_CPULOAD
+#ifndef CONFIG_SCHED_CPULOAD_NONE
 static const struct proc_node_s g_loadavg =
 {
   "loadavg",       "loadavg", (uint8_t)PROC_LOADAVG,     DTYPE_FILE        /* 
Average CPU utilization */
@@ -340,7 +340,7 @@ static FAR const struct proc_node_s * const g_nodeinfo[] =
 {
   &g_status,       /* Task/thread status */
   &g_cmdline,      /* Task command line */
-#ifdef CONFIG_SCHED_CPULOAD
+#ifndef CONFIG_SCHED_CPULOAD_NONE
   &g_loadavg,      /* Average CPU utilization */
 #endif
 #ifdef CONFIG_SCHED_CRITMONITOR
@@ -369,7 +369,7 @@ static const struct proc_node_s * const g_level0info[] =
 {
   &g_status,       /* Task/thread status */
   &g_cmdline,      /* Task command line */
-#ifdef CONFIG_SCHED_CPULOAD
+#ifndef CONFIG_SCHED_CPULOAD_NONE
   &g_loadavg,      /* Average CPU utilization */
 #endif
 #ifdef CONFIG_SCHED_CRITMONITOR
@@ -706,7 +706,7 @@ static ssize_t proc_cmdline(FAR struct proc_file_s 
*procfile,
  * Name: proc_loadavg
  ****************************************************************************/
 
-#ifdef CONFIG_SCHED_CPULOAD
+#ifndef CONFIG_SCHED_CPULOAD_NONE
 static ssize_t proc_loadavg(FAR struct proc_file_s *procfile,
                             FAR struct tcb_s *tcb, FAR char *buffer,
                             size_t buflen, off_t offset)
@@ -1521,7 +1521,7 @@ static ssize_t proc_read(FAR struct file *filep, FAR char 
*buffer,
       ret = proc_cmdline(procfile, tcb, buffer, buflen, filep->f_pos);
       break;
 
-#ifdef CONFIG_SCHED_CPULOAD
+#ifndef CONFIG_SCHED_CPULOAD_NONE
     case PROC_LOADAVG: /* Average CPU utilization */
       ret = proc_loadavg(procfile, tcb, buffer, buflen, filep->f_pos);
       break;
diff --git a/include/nuttx/clock.h b/include/nuttx/clock.h
index 816126bb79..655210a530 100644
--- a/include/nuttx/clock.h
+++ b/include/nuttx/clock.h
@@ -274,7 +274,7 @@
 
 /* This structure is used to report CPU usage for a particular thread */
 
-#ifdef CONFIG_SCHED_CPULOAD
+#ifndef CONFIG_SCHED_CPULOAD_NONE
 struct cpuload_s
 {
   volatile uint32_t total;   /* Total number of clock ticks */
@@ -615,7 +615,7 @@ int clock_systime_timespec(FAR struct timespec *ts);
  *
  ****************************************************************************/
 
-#ifdef CONFIG_SCHED_CPULOAD
+#ifndef CONFIG_SCHED_CPULOAD_NONE
 int clock_cpuload(int pid, FAR struct cpuload_s *cpuload);
 #endif
 
diff --git a/include/nuttx/sched.h b/include/nuttx/sched.h
index 62263896d2..1f05ee161a 100644
--- a/include/nuttx/sched.h
+++ b/include/nuttx/sched.h
@@ -625,7 +625,7 @@ struct tcb_s
 
   /* CPU load monitoring support ********************************************/
 
-#ifdef CONFIG_SCHED_CPULOAD
+#ifndef CONFIG_SCHED_CPULOAD_NONE
   uint32_t ticks;                        /* Number of ticks on this thread */
 #endif
 
diff --git a/sched/Kconfig b/sched/Kconfig
index 5bdeb6de02..c3224699f5 100644
--- a/sched/Kconfig
+++ b/sched/Kconfig
@@ -914,9 +914,9 @@ config SCHED_CRITMONITOR_MAXTIME_PANIC
                If this option is enabled, a panic will be triggered when
                IRQ/WQUEUE/PREEMPTION execution time exceeds 
SCHED_CRITMONITOR_MAXTIME_xxx
 
-config SCHED_CPULOAD
-       bool "Enable CPU load monitoring"
-       default n
+choice
+       prompt "Select CPU load clock source"
+       default SCHED_CPULOAD_NONE
        ---help---
                If this option is selected, the timer interrupt handler will 
monitor
                if the system is IDLE or busy at the time of that the timer 
interrupt
@@ -932,12 +932,11 @@ config SCHED_CPULOAD
                possible unless you provide an alternative clock to drive the
                sampling and select SCHED_CPULOAD_EXTCLK.
 
-if SCHED_CPULOAD
-
-choice
-       prompt "Select CPU load clock source"
-       default SCHED_CPULOAD_EXTCLK if SCHED_TICKLESS
-       default SCHED_CPULOAD_CRITMONITOR if SCHED_CRITMONITOR
+config SCHED_CPULOAD_NONE
+       bool "None CPU load clock source"
+       ---help---
+               If this option is enabled, the system will not support CPU load
+               measurement.
 
 config SCHED_CPULOAD_SYSCLK
        bool "Use system clock"
@@ -955,8 +954,9 @@ config SCHED_CPULOAD_SYSCLK
                the CPU load attributed to these threads that run synchronously 
with
                they system timer may be grossly in error.
                The CPU load measurements are determined by sampling the active
-               tasks periodically at the occurrence to a timer expiration.  By
-               default, the system clock is used to do that sampling.
+               tasks periodically at the occurrence to a timer expiration.
+               If tickless is enabled, SYSCLK should not be used. Its error 
will be
+               very large, and using it for analysis will lead to wrong 
conclusions.
 
 config SCHED_CPULOAD_EXTCLK
        bool "Use external clock"
@@ -1068,14 +1068,13 @@ endif # SCHED_CPULOAD_EXTCLK
 
 config SCHED_CPULOAD_TIMECONSTANT
        int "CPU load time constant"
+       depends on !SCHED_CPULOAD_NONE
        default 2
        ---help---
                The accumulated CPU count is divided by two when the accumulated
                tick count exceeds this time constant.  This time constant is in
                units of seconds.
 
-endif # SCHED_CPULOAD
-
 menuconfig SCHED_INSTRUMENTATION
        bool "System performance monitor hooks"
        default n
diff --git a/sched/misc/assert.c b/sched/misc/assert.c
index 82467d46c4..f67c6b85b7 100644
--- a/sched/misc/assert.c
+++ b/sched/misc/assert.c
@@ -297,7 +297,7 @@ static void dump_task(FAR struct tcb_s *tcb, FAR void *arg)
   size_t stack_filled = 0;
   size_t stack_used;
 #endif
-#ifdef CONFIG_SCHED_CPULOAD
+#ifndef CONFIG_SCHED_CPULOAD_NONE
   struct cpuload_s cpuload;
   size_t fracpart = 0;
   size_t intpart = 0;
@@ -349,7 +349,7 @@ static void dump_task(FAR struct tcb_s *tcb, FAR void *arg)
 #ifdef CONFIG_STACK_COLORATION
          "   %7zu   %3zu.%1zu%%%c"
 #endif
-#ifdef CONFIG_SCHED_CPULOAD
+#ifndef CONFIG_SCHED_CPULOAD_NONE
          "   %3zu.%01zu%%"
 #endif
          "   %s%s\n"
@@ -375,7 +375,7 @@ static void dump_task(FAR struct tcb_s *tcb, FAR void *arg)
          , stack_filled / 10, stack_filled % 10
          , (stack_filled >= 10 * 80 ? '!' : ' ')
 #endif
-#ifdef CONFIG_SCHED_CPULOAD
+#ifndef CONFIG_SCHED_CPULOAD_NONE
          , intpart, fracpart
 #endif
 #if CONFIG_TASK_NAME_SIZE > 0
@@ -431,7 +431,7 @@ static void dump_tasks(void)
 #ifdef CONFIG_STACK_COLORATION
          "      USED   FILLED "
 #endif
-#ifdef CONFIG_SCHED_CPULOAD
+#ifndef CONFIG_SCHED_CPULOAD_NONE
          "      CPU"
 #endif
          "   COMMAND\n");
@@ -450,7 +450,7 @@ static void dump_tasks(void)
 #  ifdef CONFIG_STACK_COLORATION
          "   %7zu   %3zu.%1zu%%%c"
 #  endif
-#  ifdef CONFIG_SCHED_CPULOAD
+#  ifndef CONFIG_SCHED_CPULOAD_NONE
          "     ----"
 #  endif
          "   irq\n"
diff --git a/sched/sched/CMakeLists.txt b/sched/sched/CMakeLists.txt
index 90ac03e08a..f7616d9ece 100644
--- a/sched/sched/CMakeLists.txt
+++ b/sched/sched/CMakeLists.txt
@@ -91,7 +91,7 @@ elseif(CONFIG_SCHED_RESUMESCHEDULER)
   list(APPEND SRCS sched_resumescheduler.c)
 endif()
 
-if(CONFIG_SCHED_CPULOAD)
+if(NOT CONFIG_SCHED_CPULOAD_NONE)
   list(APPEND SRCS sched_cpuload.c)
   if(CONFIG_CPULOAD_ONESHOT)
     list(APPEND SRCS sched_cpuload_oneshot.c)
diff --git a/sched/sched/Make.defs b/sched/sched/Make.defs
index 0abd6c13ab..ddcb6c7580 100644
--- a/sched/sched/Make.defs
+++ b/sched/sched/Make.defs
@@ -68,7 +68,7 @@ else ifeq ($(CONFIG_SCHED_RESUMESCHEDULER),y)
 CSRCS += sched_resumescheduler.c
 endif
 
-ifeq ($(CONFIG_SCHED_CPULOAD),y)
+ifneq ($(CONFIG_SCHED_CPULOAD_NONE),y)
 CSRCS += sched_cpuload.c
 ifeq ($(CONFIG_CPULOAD_ONESHOT),y)
 CSRCS += sched_cpuload_oneshot.c
diff --git a/sched/sched/sched.h b/sched/sched/sched.h
index c8e42b9e54..79a5736b9b 100644
--- a/sched/sched/sched.h
+++ b/sched/sched/sched.h
@@ -235,7 +235,7 @@ extern volatile int g_npidhash;
 
 extern const struct tasklist_s g_tasklisttable[NUM_TASK_STATES];
 
-#ifdef CONFIG_SCHED_CPULOAD
+#ifndef CONFIG_SCHED_CPULOAD_NONE
 /* This is the total number of clock tick counts.  Essentially the
  * 'denominator' for all CPU load calculations.
  */
diff --git a/sched/sched/sched_cpuload.c b/sched/sched/sched_cpuload.c
index f5128e36c8..59cd5d88c2 100644
--- a/sched/sched/sched_cpuload.c
+++ b/sched/sched/sched_cpuload.c
@@ -32,8 +32,6 @@
 
 #include "sched/sched.h"
 
-#ifdef CONFIG_SCHED_CPULOAD
-
 /****************************************************************************
  * Pre-processor Definitions
  ****************************************************************************/
@@ -227,5 +225,3 @@ int clock_cpuload(int pid, FAR struct cpuload_s *cpuload)
   leave_critical_section(flags);
   return ret;
 }
-
-#endif /* CONFIG_SCHED_CPULOAD */
diff --git a/sched/sched/sched_cpuload_oneshot.c 
b/sched/sched/sched_cpuload_oneshot.c
index a7538af367..cbc64a46d9 100644
--- a/sched/sched/sched_cpuload_oneshot.c
+++ b/sched/sched/sched_cpuload_oneshot.c
@@ -44,10 +44,6 @@
 
 /* Configuration ************************************************************/
 
-#if !defined(CONFIG_SCHED_CPULOAD) || !defined(CONFIG_SCHED_CPULOAD_EXTCLK)
-#  error CONFIG_SCHED_CPULOAD and CONFIG_SCHED_CPULOAD_EXTCLK must be defined
-#endif
-
 /* CONFIG_SCHED_CPULOAD_TICKSPERSEC is the frequency of the external clock
  * source.
  */
diff --git a/sched/sched/sched_cpuload_period.c 
b/sched/sched/sched_cpuload_period.c
index b5e21b20e6..7bbb47cbf0 100644
--- a/sched/sched/sched_cpuload_period.c
+++ b/sched/sched/sched_cpuload_period.c
@@ -41,10 +41,6 @@
 
 /* Configuration ************************************************************/
 
-#if !defined(CONFIG_SCHED_CPULOAD) || !defined(CONFIG_SCHED_CPULOAD_EXTCLK)
-#  error CONFIG_SCHED_CPULOAD and CONFIG_SCHED_CPULOAD_EXTCLK must be defined
-#endif
-
 /* CONFIG_SCHED_CPULOAD_TICKSPERSEC is the frequency of the external clock
  * source.
  */
diff --git a/sched/sched/sched_releasetcb.c b/sched/sched/sched_releasetcb.c
index 5983ed7230..dc996af946 100644
--- a/sched/sched/sched_releasetcb.c
+++ b/sched/sched/sched_releasetcb.c
@@ -51,7 +51,7 @@ static void nxsched_releasepid(pid_t pid)
   irqstate_t flags = enter_critical_section();
   int hash_ndx = PIDHASH(pid);
 
-#ifdef CONFIG_SCHED_CPULOAD
+#ifndef CONFIG_SCHED_CPULOAD_NONE
   /* Decrement the total CPU load count held by this thread from the
    * total for all threads.
    */
diff --git a/sched/sched/sched_sysinfo.c b/sched/sched/sched_sysinfo.c
index 024fd605a7..de2dd017ca 100644
--- a/sched/sched/sched_sysinfo.c
+++ b/sched/sched/sched_sysinfo.c
@@ -46,7 +46,7 @@
 
 int sysinfo(FAR struct sysinfo *info)
 {
-#ifdef CONFIG_SCHED_CPULOAD
+#ifndef CONFIG_SCHED_CPULOAD_NONE
   struct cpuload_s cpuload;
 #endif
 #ifdef CONFIG_MM_PGALLOC
@@ -62,7 +62,7 @@ int sysinfo(FAR struct sysinfo *info)
 
   memset(info, 0, sizeof(*info));
 
-#ifdef CONFIG_SCHED_CPULOAD
+#ifndef CONFIG_SCHED_CPULOAD_NONE
   clock_cpuload(0, &cpuload);
 
   /* On the simulator, you may hit cpuload.total == 0, but probably never

Reply via email to