1*4882a593Smuzhiyun.. SPDX-License-Identifier: CC-BY-SA-2.0-UK 2*4882a593Smuzhiyun 3*4882a593Smuzhiyun****************************************** 4*4882a593SmuzhiyunYocto Project Profiling and Tracing Manual 5*4882a593Smuzhiyun****************************************** 6*4882a593Smuzhiyun 7*4882a593SmuzhiyunIntroduction 8*4882a593Smuzhiyun============ 9*4882a593Smuzhiyun 10*4882a593SmuzhiyunYocto bundles a number of tracing and profiling tools - this 'HOWTO' 11*4882a593Smuzhiyundescribes their basic usage and shows by example how to make use of them 12*4882a593Smuzhiyunto examine application and system behavior. 13*4882a593Smuzhiyun 14*4882a593SmuzhiyunThe tools presented are for the most part completely open-ended and have 15*4882a593Smuzhiyunquite good and/or extensive documentation of their own which can be used 16*4882a593Smuzhiyunto solve just about any problem you might come across in Linux. Each 17*4882a593Smuzhiyunsection that describes a particular tool has links to that tool's 18*4882a593Smuzhiyundocumentation and website. 19*4882a593Smuzhiyun 20*4882a593SmuzhiyunThe purpose of this 'HOWTO' is to present a set of common and generally 21*4882a593Smuzhiyunuseful tracing and profiling idioms along with their application (as 22*4882a593Smuzhiyunappropriate) to each tool, in the context of a general-purpose 23*4882a593Smuzhiyun'drill-down' methodology that can be applied to solving a large number 24*4882a593Smuzhiyun(90%?) of problems. For help with more advanced usages and problems, 25*4882a593Smuzhiyunplease see the documentation and/or websites listed for each tool. 26*4882a593Smuzhiyun 27*4882a593SmuzhiyunThe final section of this 'HOWTO' is a collection of real-world examples 28*4882a593Smuzhiyunwhich we'll be continually adding to as we solve more problems using the 29*4882a593Smuzhiyuntools - feel free to add your own examples to the list! 30*4882a593Smuzhiyun 31*4882a593SmuzhiyunGeneral Setup 32*4882a593Smuzhiyun============= 33*4882a593Smuzhiyun 34*4882a593SmuzhiyunMost of the tools are available only in 'sdk' images or in images built 35*4882a593Smuzhiyunafter adding 'tools-profile' to your local.conf. So, in order to be able 36*4882a593Smuzhiyunto access all of the tools described here, please first build and boot 37*4882a593Smuzhiyunan 'sdk' image e.g. :: 38*4882a593Smuzhiyun 39*4882a593Smuzhiyun $ bitbake core-image-sato-sdk 40*4882a593Smuzhiyun 41*4882a593Smuzhiyunor alternatively by adding 'tools-profile' to the EXTRA_IMAGE_FEATURES line in 42*4882a593Smuzhiyunyour local.conf:: 43*4882a593Smuzhiyun 44*4882a593Smuzhiyun EXTRA_IMAGE_FEATURES = "debug-tweaks tools-profile" 45*4882a593Smuzhiyun 46*4882a593SmuzhiyunIf you use the 'tools-profile' method, you don't need to build an sdk image - 47*4882a593Smuzhiyunthe tracing and profiling tools will be included in non-sdk images as well e.g.:: 48*4882a593Smuzhiyun 49*4882a593Smuzhiyun $ bitbake core-image-sato 50*4882a593Smuzhiyun 51*4882a593Smuzhiyun.. note:: 52*4882a593Smuzhiyun 53*4882a593Smuzhiyun By default, the Yocto build system strips symbols from the binaries 54*4882a593Smuzhiyun it packages, which makes it difficult to use some of the tools. 55*4882a593Smuzhiyun 56*4882a593Smuzhiyun You can prevent that by setting the 57*4882a593Smuzhiyun :term:`INHIBIT_PACKAGE_STRIP` 58*4882a593Smuzhiyun variable to "1" in your ``local.conf`` when you build the image:: 59*4882a593Smuzhiyun 60*4882a593Smuzhiyun INHIBIT_PACKAGE_STRIP = "1" 61*4882a593Smuzhiyun 62*4882a593Smuzhiyun The above setting will noticeably increase the size of your image. 63*4882a593Smuzhiyun 64*4882a593SmuzhiyunIf you've already built a stripped image, you can generate debug 65*4882a593Smuzhiyunpackages (xxx-dbg) which you can manually install as needed. 66*4882a593Smuzhiyun 67*4882a593SmuzhiyunTo generate debug info for packages, you can add dbg-pkgs to 68*4882a593SmuzhiyunEXTRA_IMAGE_FEATURES in local.conf. For example:: 69*4882a593Smuzhiyun 70*4882a593Smuzhiyun EXTRA_IMAGE_FEATURES = "debug-tweaks tools-profile dbg-pkgs" 71*4882a593Smuzhiyun 72*4882a593SmuzhiyunAdditionally, in order to generate the right type of debuginfo, we also need to 73*4882a593Smuzhiyunset :term:`PACKAGE_DEBUG_SPLIT_STYLE` in the ``local.conf`` file:: 74*4882a593Smuzhiyun 75*4882a593Smuzhiyun PACKAGE_DEBUG_SPLIT_STYLE = 'debug-file-directory' 76