# Thread analyzer configuration options # Copyright (c) 2015 Wind River Systems, Inc. # SPDX-License-Identifier: Apache-2.0 menuconfig THREAD_ANALYZER bool "Thread analyzer" depends on !ARCH_POSIX select INIT_STACKS select THREAD_MONITOR select THREAD_STACK_INFO select THREAD_RUNTIME_STATS help Enable thread analyzer functionality and all the required modules. This module may be used to debug thread configuration issues, e.g. stack size configuration to find stack overflow or to find stacks which may be optimized. if THREAD_ANALYZER module = THREAD_ANALYZER module-str = thread analyzer source "subsys/logging/Kconfig.template.log_config" choice prompt "Thread analysis print mode" default THREAD_ANALYZER_USE_PRINTK config THREAD_ANALYZER_USE_LOG bool "Use logger output" select LOG help Use logger output to print thread information. config THREAD_ANALYZER_USE_PRINTK bool "Use printk function" help Use kernel printk function to print thread information. endchoice config THREAD_ANALYZER_ISR_STACK_USAGE bool "Analyze interrupt stacks usage" default y config THREAD_ANALYZER_PRIV_STACK_USAGE bool "Analyze privileged stacks usage" depends on USERSPACE depends on ARCH_HAS_THREAD_PRIV_STACK_SPACE_GET help Print privileged stack usage for user threads. config THREAD_ANALYZER_RUN_UNLOCKED bool "Run analysis with interrupts unlocked" default y help The thread analysis takes quite a long time. Every thread it finds is analyzed word by word to find any that does not match the magic number. Normally while thread are analyzed the k_thread_foreach function is used. While this is a safe run from the thread list perspective it may lock the interrupts for a long time - long enough to disconnect when Bluetooth communication is used. Setting this flag will force thread analyzer to use the k_thread_foreach_unlocked function. This will allow the interrupts to be processed while the thread is analyzed. For the limitation of such configuration see the k_thread_foreach documentation. config THREAD_ANALYZER_STACK_SAFETY bool "Thread analysis includes thread runtime stack safety check" default n select THREAD_RUNTIME_STACK_SAFETY help If enabled, the stack usage analysis is enhanced by calling a customizable handler when the unused stack space of a thread falls below its configured threshold. This customized handler may take actions such as logging warnings, suspending or even aborting threads. config THREAD_ANALYZER_AUTO bool "Run periodic thread analysis in a thread" help Run the thread analyzer automatically, without the need to add any code to the application. Thread analysis would be called periodically. if THREAD_ANALYZER_AUTO config THREAD_ANALYZER_AUTO_SEPARATE_CORES bool "Run thread analyzer separately on each core" default y if KERNEL_COHERENCE depends on SCHED_CPU_MASK help Run the thread analyzer auto thread on each core and report cores separately. This feature is needed for platforms running on cache-incoherent architectures. config THREAD_ANALYZER_AUTO_INTERVAL int "Thread analysis interval" default 60 range 5 3600 help The time in seconds to call thread analyzer periodic printing function. config THREAD_ANALYZER_AUTO_STACK_SIZE int "Stack size for the periodic thread analysis thread" default 2048 if THREAD_ANALYZER_USE_LOG && LOG_MODE_IMMEDIATE && NO_OPTIMIZATIONS default 1024 config THREAD_ANALYZER_AUTO_THREAD_PRIORITY_OVERRIDE bool "Override default thread analysis thread priority" help Option to change the default value of thread analysis thread priority. if THREAD_ANALYZER_AUTO_THREAD_PRIORITY_OVERRIDE config THREAD_ANALYZER_AUTO_THREAD_PRIORITY int "Thread analysis thread priority" default 0 help Set thread priority of the thread analysis endif # THREAD_ANALYZER_AUTO_THREAD_PRIORITY_OVERRIDE endif # THREAD_ANALYZER_AUTO config THREAD_ANALYZER_LONG_FRAME_PER_INTERVAL bool "Prints the longest frame since the last thread analyzer interval" depends on SCHED_THREAD_USAGE_ANALYSIS help Resets the thread longest frame field after printing so that the next print will show the longest frame during that interval. This enables observation of what long frames come after the initial startup of a thread. endif # THREAD_ANALYZER