^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) # SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) menu "GCOV-based kernel profiling"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) config GCOV_KERNEL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) bool "Enable gcov-based kernel profiling"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) depends on DEBUG_FS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) select CONSTRUCTORS if !UML
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) default n
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) help
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) This option enables gcov-based code profiling (e.g. for code coverage
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) measurements).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) If unsure, say N.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) Additionally specify CONFIG_GCOV_PROFILE_ALL=y to get profiling data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) for the entire kernel. To enable profiling for specific files or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) directories, add a line similar to the following to the respective
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) Makefile:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) For a single file (e.g. main.o):
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) GCOV_PROFILE_main.o := y
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) For all files in one directory:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) GCOV_PROFILE := y
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) To exclude files from being profiled even when CONFIG_GCOV_PROFILE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) is specified, use:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) GCOV_PROFILE_main.o := n
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) and:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) GCOV_PROFILE := n
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) Note that the debugfs filesystem has to be mounted to access
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) profiling data.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) config ARCH_HAS_GCOV_PROFILE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) def_bool n
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) config GCOV_PROFILE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) bool "Profile entire Kernel"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) depends on !COMPILE_TEST
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) depends on GCOV_KERNEL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) depends on ARCH_HAS_GCOV_PROFILE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) default n
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) help
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) This options activates profiling for the entire kernel.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) If unsure, say N.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) Note that a kernel compiled with profiling flags will be significantly
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) larger and run slower. Also be sure to exclude files from profiling
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) which are not linked to the kernel image to prevent linker errors.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) endmenu