xref: /linux/kernel/gcov/Kconfig (revision 03ab8e6297acd1bc0eedaa050e2a1635c576fd11)
1ec8f24b7SThomas Gleixner# SPDX-License-Identifier: GPL-2.0-only
22521f2c2SPeter Oberparleitermenu "GCOV-based kernel profiling"
32521f2c2SPeter Oberparleiter
42521f2c2SPeter Oberparleiterconfig GCOV_KERNEL
52521f2c2SPeter Oberparleiter	bool "Enable gcov-based kernel profiling"
6d2c32258SJosh Triplett	depends on DEBUG_FS
7*51c2ee6dSNick Desaulniers	depends on !ARCH_WANTS_NO_INSTR || CC_HAS_NO_PROFILE_FN_ATTR
855b6f763SJohannes Berg	select CONSTRUCTORS
92521f2c2SPeter Oberparleiter	default n
10a7f7f624SMasahiro Yamada	help
112521f2c2SPeter Oberparleiter	This option enables gcov-based code profiling (e.g. for code coverage
122521f2c2SPeter Oberparleiter	measurements).
132521f2c2SPeter Oberparleiter
142521f2c2SPeter Oberparleiter	If unsure, say N.
152521f2c2SPeter Oberparleiter
162521f2c2SPeter Oberparleiter	Additionally specify CONFIG_GCOV_PROFILE_ALL=y to get profiling data
172521f2c2SPeter Oberparleiter	for the entire kernel. To enable profiling for specific files or
182521f2c2SPeter Oberparleiter	directories, add a line similar to the following to the respective
192521f2c2SPeter Oberparleiter	Makefile:
202521f2c2SPeter Oberparleiter
212521f2c2SPeter Oberparleiter	For a single file (e.g. main.o):
222521f2c2SPeter Oberparleiter	        GCOV_PROFILE_main.o := y
232521f2c2SPeter Oberparleiter
242521f2c2SPeter Oberparleiter	For all files in one directory:
252521f2c2SPeter Oberparleiter	        GCOV_PROFILE := y
262521f2c2SPeter Oberparleiter
272521f2c2SPeter Oberparleiter	To exclude files from being profiled even when CONFIG_GCOV_PROFILE_ALL
282521f2c2SPeter Oberparleiter	is specified, use:
292521f2c2SPeter Oberparleiter
302521f2c2SPeter Oberparleiter	        GCOV_PROFILE_main.o := n
312521f2c2SPeter Oberparleiter	and:
322521f2c2SPeter Oberparleiter	        GCOV_PROFILE := n
332521f2c2SPeter Oberparleiter
342521f2c2SPeter Oberparleiter	Note that the debugfs filesystem has to be mounted to access
352521f2c2SPeter Oberparleiter	profiling data.
362521f2c2SPeter Oberparleiter
37957e3facSRiku Voipioconfig ARCH_HAS_GCOV_PROFILE_ALL
38957e3facSRiku Voipio	def_bool n
39957e3facSRiku Voipio
402521f2c2SPeter Oberparleiterconfig GCOV_PROFILE_ALL
412521f2c2SPeter Oberparleiter	bool "Profile entire Kernel"
42cc622420SArnd Bergmann	depends on !COMPILE_TEST
432521f2c2SPeter Oberparleiter	depends on GCOV_KERNEL
44957e3facSRiku Voipio	depends on ARCH_HAS_GCOV_PROFILE_ALL
452521f2c2SPeter Oberparleiter	default n
46a7f7f624SMasahiro Yamada	help
472521f2c2SPeter Oberparleiter	This options activates profiling for the entire kernel.
482521f2c2SPeter Oberparleiter
492521f2c2SPeter Oberparleiter	If unsure, say N.
502521f2c2SPeter Oberparleiter
512521f2c2SPeter Oberparleiter	Note that a kernel compiled with profiling flags will be significantly
522521f2c2SPeter Oberparleiter	larger and run slower. Also be sure to exclude files from profiling
532521f2c2SPeter Oberparleiter	which are not linked to the kernel image to prevent linker errors.
542521f2c2SPeter Oberparleiter
552521f2c2SPeter Oberparleiterendmenu
56