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

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

commit 031b06aa01da2e3cf3a070584c02ac06387bd354
Author: yinshengkai <[email protected]>
AuthorDate: Wed Dec 11 16:43:50 2024 +0800

    sched: simplify Kconfig dependencies
    
    When enabling trace, you need to enable a lot of configuration items.
    This patch can reduce the number of configuration items required.
    
    Signed-off-by: yinshengkai <[email protected]>
---
 drivers/note/Kconfig   | 23 +++++++++++++++--------
 drivers/segger/Kconfig |  7 +++----
 sched/Kconfig          | 40 ++++++++++++++++++++++++++--------------
 3 files changed, 44 insertions(+), 26 deletions(-)

diff --git a/drivers/note/Kconfig b/drivers/note/Kconfig
index 9e79b425405..d73e36bd161 100644
--- a/drivers/note/Kconfig
+++ b/drivers/note/Kconfig
@@ -3,12 +3,12 @@
 # see the file kconfig-language.txt in the NuttX tools repository.
 #
 
-config DRIVERS_NOTE
-       bool "Note Driver Support"
-       depends on SCHED_INSTRUMENTATION
-       default n
+menu "Note Driver Support"
 
-if DRIVERS_NOTE
+config DRIVERS_NOTE
+       bool
+       ---help---
+               Note Driver Support, enable this option to enable note driver.
 
 config DRIVERS_NOTE_MAX
        int "Maximum number of sched_note drivers"
@@ -30,15 +30,16 @@ config DRIVERS_NOTE_TASKNAME_BUFSIZE
 
 config DRIVERS_NOTECTL
        bool "Scheduler instrumentation filter control driver"
-       default n
        depends on SCHED_INSTRUMENTATION_FILTER
+       default SCHED_INSTRUMENTATION_FILTER
        ---help---
                If this option is selected, the instrumentation filter control 
device
                /dev/notectl is provided.
 
 config DRIVERS_NOTERAM
        bool "Note RAM driver"
-       default y
+       select DRIVERS_NOTE
+       default n
        ---help---
                If this option is selected, then in-memory buffering logic is
                enabled to capture scheduler instrumentation data.  This has
@@ -99,6 +100,7 @@ config DRIVERS_NOTE_STRIP_FORMAT
 
 config DRIVERS_NOTELOWEROUT
        bool "Note lower output"
+       select DRIVERS_NOTE
        default n
        ---help---
                Note uses lower output.
@@ -119,6 +121,7 @@ config DRIVERS_NOTELOWEROUT_CPUSET
 
 config DRIVERS_NOTEFILE
        bool "Note file driver"
+       select DRIVERS_NOTE
        ---help---
                The Note driver output to file.
 
@@ -145,6 +148,7 @@ config DRIVERS_NOTEFILE_PATH
 
 config DRIVERS_NOTELOG
        bool "Note syslog driver"
+       select DRIVERS_NOTE
        ---help---
                The Note driver output to syslog.
 
@@ -164,6 +168,7 @@ config DRIVERS_NOTELOG_CPUSET
 
 config DRIVERS_NOTESNAP
        bool "Last scheduling information"
+       select DRIVERS_NOTE
        default n
        ---help---
                Record the last scheduling information.
@@ -193,6 +198,7 @@ endif
 
 config DRIVERS_NOTERPMSG_SERVER
        bool "Enable RPMSG server for NOTE"
+       select DRIVERS_NOTE
        default n
        depends on RPTUN
        ---help---
@@ -200,6 +206,7 @@ config DRIVERS_NOTERPMSG_SERVER
 
 config DRIVERS_NOTERPMSG
        bool "Note to RPMSG"
+       select DRIVERS_NOTE
        depends on RPTUN
        depends on SCHED_WORKQUEUE
        default n
@@ -284,4 +291,4 @@ config DRIVERS_NOTENET_WORK_DELAY
 
 endif
 
-endif # DRIVERS_NOTE
+endmenu # Note Driver Support
diff --git a/drivers/segger/Kconfig b/drivers/segger/Kconfig
index 85407d1c2df..6a3809d9f95 100644
--- a/drivers/segger/Kconfig
+++ b/drivers/segger/Kconfig
@@ -203,10 +203,10 @@ config SERIAL_RTT_CONSOLE_CHANNEL
                The buffer size of RTT channel 0 is configured by 
SEGGER_RTT_BUFFER_SIZE_UP/DOWN
                You need to turn off other console devices before using Segger 
RTT console
 
-if DRIVERS_NOTE
-
 config NOTE_RTT
        bool "Note RTT driver, write note into Segger J-Link RTTLog"
+       select DRIVERS_NOTE
+       select STREAM_RTT
        default n
        ---help---
                If this option is selected, then jlink rtt is enabled to capture
@@ -244,6 +244,7 @@ endif # NOTE_RTT
 
 config SEGGER_SYSVIEW
        bool "Note SEGGER SystemView driver"
+       select DRIVERS_NOTE
        select SEGGER_RTT
        ---help---
                SystemView is a real-time recording and visualization tool for 
embedded
@@ -295,6 +296,4 @@ config SEGGER_SYSVIEW_POST_MORTEM
 
 endif # SEGGER_SYSVIEW
 
-endif # DRIVERS_NOTE
-
 endmenu # Segger RTT drivers
diff --git a/sched/Kconfig b/sched/Kconfig
index 69f51fa5883..27352bbe37f 100644
--- a/sched/Kconfig
+++ b/sched/Kconfig
@@ -1263,9 +1263,10 @@ config SCHED_PROFILE_TICKSPERSEC
                This is the frequency at which the profil function will sample 
the
                running program. The default is 1000Hz.
 
-menuconfig SCHED_INSTRUMENTATION
-       bool "System performance monitor hooks"
-       default n
+menu "System performance monitor hooks"
+
+config SCHED_INSTRUMENTATION
+       bool
        ---help---
                Enables instrumentation in scheduler to monitor system 
performance.
                If enabled, then the board-specific logic must provide the 
following
@@ -1280,18 +1281,10 @@ menuconfig SCHED_INSTRUMENTATION
                        void sched_note_cpu_start(FAR struct tcb_s *tcb, int 
cpu);
                        void sched_note_cpu_started(FAR struct tcb_s *tcb);
 
-if SCHED_INSTRUMENTATION
-
-config SCHED_INSTRUMENTATION_CPUSET
-       hex "CPU bit set"
-       default 0xffff
-       depends on SMP && SCHED_INSTRUMENTATION_FILTER
-       ---help---
-               Monitor only CPUs in the bitset.  Bit 0=CPU0, Bit1=CPU1, etc.
-
 config SCHED_INSTRUMENTATION_FILTER
        bool "Instrumentation filter"
-       default n
+       depends on SCHED_INSTRUMENTATION
+       default y
        ---help---
                Enables the filter logic for the instrumentation. If this option
                is enabled, the instrumentation data passed to sched_note_add()
@@ -1312,9 +1305,17 @@ config SCHED_INSTRUMENTATION_FILTER_DEFAULT_MODE
                        Bit 4 = Enable dump instrumentation
                        Bit 5 = Enable collecting syscall arguments
 
+config SCHED_INSTRUMENTATION_CPUSET
+       hex "CPU bit set"
+       default 0xffff
+       depends on SMP && SCHED_INSTRUMENTATION_FILTER
+       ---help---
+               Monitor only CPUs in the bitset.  Bit 0=CPU0, Bit1=CPU1, etc.
+
 config SCHED_INSTRUMENTATION_SWITCH
        bool "Use note switch for instrumentation"
        default n
+       select SCHED_INSTRUMENTATION
        ---help---
                Use note switch for instrumentation.
 
@@ -1337,6 +1338,7 @@ config SCHED_INSTRUMENTATION_SWITCH
 config SCHED_INSTRUMENTATION_PREEMPTION
        bool "Preemption monitor hooks"
        default n
+       select SCHED_INSTRUMENTATION
        ---help---
                Enables additional hooks for changes to pre-emption state.  
Board-
                specific logic must provide this additional logic.
@@ -1346,6 +1348,7 @@ config SCHED_INSTRUMENTATION_PREEMPTION
 config SCHED_INSTRUMENTATION_CSECTION
        bool "Critical section monitor hooks"
        default n
+       select SCHED_INSTRUMENTATION
        select IRQCOUNT
        ---help---
                Enables additional hooks for entry and exit from critical 
sections.
@@ -1357,6 +1360,7 @@ config SCHED_INSTRUMENTATION_CSECTION
 config SCHED_INSTRUMENTATION_SPINLOCKS
        bool "Spinlock monitor hooks"
        default n
+       select SCHED_INSTRUMENTATION
        ---help---
                Enables additional hooks for spinlock state.  Board-specific 
logic
                must provide this additional logic.
@@ -1366,6 +1370,7 @@ config SCHED_INSTRUMENTATION_SPINLOCKS
 config SCHED_INSTRUMENTATION_SYSCALL
        bool "System call monitor hooks"
        default n
+       select SCHED_INSTRUMENTATION
        depends on ARCH_HAVE_SYSCALL_HOOKS
        ---help---
                Enables additional hooks for entry and exit from system call.
@@ -1377,6 +1382,7 @@ config SCHED_INSTRUMENTATION_SYSCALL
 config SCHED_INSTRUMENTATION_IRQHANDLER
        bool "Interrupt handler monitor hooks"
        default n
+       select SCHED_INSTRUMENTATION
        ---help---
                Enables additional hooks for interrupt handler. Board-specific 
logic
                must provide this additional logic.
@@ -1386,6 +1392,7 @@ config SCHED_INSTRUMENTATION_IRQHANDLER
 config SCHED_INSTRUMENTATION_HEAP
        bool "Heap monitor hooks"
        default n
+       select SCHED_INSTRUMENTATION
        ---help---
                Enables additional hooks for heap allocation.
 
@@ -1394,6 +1401,7 @@ config SCHED_INSTRUMENTATION_HEAP
 config SCHED_INSTRUMENTATION_WDOG
        bool "Watchdog timer monitor hooks"
        default n
+       select SCHED_INSTRUMENTATION
        ---help---
                Enables additional hooks for watchdog timer.
 
@@ -1402,6 +1410,7 @@ config SCHED_INSTRUMENTATION_WDOG
 config SCHED_INSTRUMENTATION_DUMP
        bool "Use note dump for instrumentation"
        default n
+       select SCHED_INSTRUMENTATION
        ---help---
                Use note dump for instrumentation.
 
@@ -1413,6 +1422,7 @@ config SCHED_INSTRUMENTATION_THREADTIME
        bool "Enable thread runtime instrumentation"
        depends on SCHED_INSTRUMENTATION_DUMP
        depends on SCHED_CRITMONITOR
+       select SCHED_INSTRUMENTATION
        default n
        ---help---
                Enable thread runtime instrumentation.
@@ -1427,6 +1437,7 @@ config SCHED_INSTRUMENTATION_THREAD_RUNTIME_DURATION
 config SCHED_INSTRUMENTATION_FUNCTION
        bool "Enable function auto-tracing"
        default n
+       select SCHED_INSTRUMENTATION
        ---help---
                After enabling this option, you can automatically trace the 
function instrumentation without adding tracepoint manually.
                This is similar to the Function Trace effect of the linux kernel
@@ -1438,7 +1449,8 @@ config SCHED_INSTRUMENTATION_FUNCTION
                For a more detailed description of compilation options,
                refer to the "Program Instrumentation Options" chapter in the 
gcc documentation
 
-endif # SCHED_INSTRUMENTATION
+endmenu # System performance monitor hooks
+
 endmenu # Performance Monitoring
 
 menu "System Auto Instrumentation"

Reply via email to