18c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0-only 28c2ecf20Sopenharmony_cimenu "GCOV-based kernel profiling" 38c2ecf20Sopenharmony_ci 48c2ecf20Sopenharmony_ciconfig GCOV_KERNEL 58c2ecf20Sopenharmony_ci bool "Enable gcov-based kernel profiling" 68c2ecf20Sopenharmony_ci depends on DEBUG_FS 78c2ecf20Sopenharmony_ci select CONSTRUCTORS if !UML 88c2ecf20Sopenharmony_ci default n 98c2ecf20Sopenharmony_ci help 108c2ecf20Sopenharmony_ci This option enables gcov-based code profiling (e.g. for code coverage 118c2ecf20Sopenharmony_ci measurements). 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci If unsure, say N. 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci Additionally specify CONFIG_GCOV_PROFILE_ALL=y to get profiling data 168c2ecf20Sopenharmony_ci for the entire kernel. To enable profiling for specific files or 178c2ecf20Sopenharmony_ci directories, add a line similar to the following to the respective 188c2ecf20Sopenharmony_ci Makefile: 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci For a single file (e.g. main.o): 218c2ecf20Sopenharmony_ci GCOV_PROFILE_main.o := y 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ci For all files in one directory: 248c2ecf20Sopenharmony_ci GCOV_PROFILE := y 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci To exclude files from being profiled even when CONFIG_GCOV_PROFILE_ALL 278c2ecf20Sopenharmony_ci is specified, use: 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci GCOV_PROFILE_main.o := n 308c2ecf20Sopenharmony_ci and: 318c2ecf20Sopenharmony_ci GCOV_PROFILE := n 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ci Note that the debugfs filesystem has to be mounted to access 348c2ecf20Sopenharmony_ci profiling data. 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ciconfig ARCH_HAS_GCOV_PROFILE_ALL 378c2ecf20Sopenharmony_ci def_bool n 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ciconfig GCOV_PROFILE_ALL 408c2ecf20Sopenharmony_ci bool "Profile entire Kernel" 418c2ecf20Sopenharmony_ci depends on !COMPILE_TEST 428c2ecf20Sopenharmony_ci depends on GCOV_KERNEL 438c2ecf20Sopenharmony_ci depends on ARCH_HAS_GCOV_PROFILE_ALL 448c2ecf20Sopenharmony_ci default n 458c2ecf20Sopenharmony_ci help 468c2ecf20Sopenharmony_ci This options activates profiling for the entire kernel. 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci If unsure, say N. 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ci Note that a kernel compiled with profiling flags will be significantly 518c2ecf20Sopenharmony_ci larger and run slower. Also be sure to exclude files from profiling 528c2ecf20Sopenharmony_ci which are not linked to the kernel image to prevent linker errors. 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ciendmenu 55