0001 # SPDX-License-Identifier: GPL-2.0-only
0002 menu "GCOV-based kernel profiling"
0003
0004 config GCOV_KERNEL
0005 bool "Enable gcov-based kernel profiling"
0006 depends on DEBUG_FS
0007 depends on !ARCH_WANTS_NO_INSTR || CC_HAS_NO_PROFILE_FN_ATTR
0008 select CONSTRUCTORS
0009 default n
0010 help
0011 This option enables gcov-based code profiling (e.g. for code coverage
0012 measurements).
0013
0014 If unsure, say N.
0015
0016 Additionally specify CONFIG_GCOV_PROFILE_ALL=y to get profiling data
0017 for the entire kernel. To enable profiling for specific files or
0018 directories, add a line similar to the following to the respective
0019 Makefile:
0020
0021 For a single file (e.g. main.o):
0022 GCOV_PROFILE_main.o := y
0023
0024 For all files in one directory:
0025 GCOV_PROFILE := y
0026
0027 To exclude files from being profiled even when CONFIG_GCOV_PROFILE_ALL
0028 is specified, use:
0029
0030 GCOV_PROFILE_main.o := n
0031 and:
0032 GCOV_PROFILE := n
0033
0034 Note that the debugfs filesystem has to be mounted to access
0035 profiling data.
0036
0037 config ARCH_HAS_GCOV_PROFILE_ALL
0038 def_bool n
0039
0040 config GCOV_PROFILE_ALL
0041 bool "Profile entire Kernel"
0042 depends on !COMPILE_TEST
0043 depends on GCOV_KERNEL
0044 depends on ARCH_HAS_GCOV_PROFILE_ALL
0045 default n
0046 help
0047 This options activates profiling for the entire kernel.
0048
0049 If unsure, say N.
0050
0051 Note that a kernel compiled with profiling flags will be significantly
0052 larger and run slower. Also be sure to exclude files from profiling
0053 which are not linked to the kernel image to prevent linker errors.
0054
0055 endmenu