blob: 86310cf318411e8995e88ee2b71031887c9ab097 [file] [log] [blame]
Andrew Geisslerf0343792020-11-18 10:42:21 -06001.. SPDX-License-Identifier: CC-BY-SA-2.0-UK
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002
3******************************************
4Yocto Project Profiling and Tracing Manual
5******************************************
6
Andrew Geisslerc9f78652020-09-18 14:11:35 -05007Introduction
8============
9
Patrick Williamsac13d5f2023-11-24 18:59:46 -060010Yocto Project bundles a number of tracing and profiling tools --- this manual
Andrew Geisslerc9f78652020-09-18 14:11:35 -050011describes their basic usage and shows by example how to make use of them
Patrick Williamsac13d5f2023-11-24 18:59:46 -060012to analyze application and system behavior.
Andrew Geisslerc9f78652020-09-18 14:11:35 -050013
Patrick Williamsac13d5f2023-11-24 18:59:46 -060014The tools presented are, for the most part, completely open-ended and have
Andrew Geisslerc9f78652020-09-18 14:11:35 -050015quite good and/or extensive documentation of their own which can be used
16to solve just about any problem you might come across in Linux. Each
17section that describes a particular tool has links to that tool's
18documentation and website.
19
Patrick Williamsac13d5f2023-11-24 18:59:46 -060020The purpose of this manual is to present a set of common and generally
Andrew Geisslerc9f78652020-09-18 14:11:35 -050021useful tracing and profiling idioms along with their application (as
22appropriate) to each tool, in the context of a general-purpose
23'drill-down' methodology that can be applied to solving a large number
Patrick Williamsac13d5f2023-11-24 18:59:46 -060024of problems. For help with more advanced usages and problems,
25refer to the documentation and/or websites provided for each tool.
Andrew Geisslerc9f78652020-09-18 14:11:35 -050026
Patrick Williamsac13d5f2023-11-24 18:59:46 -060027The final section of this manual is a collection of real-world examples
28which we'll be continually updating as we solve more problems using the
29tools --- feel free to suggest additions to what you read here.
Andrew Geisslerc9f78652020-09-18 14:11:35 -050030
Andrew Geisslerc9f78652020-09-18 14:11:35 -050031General Setup
32=============
33
Patrick Williamsac13d5f2023-11-24 18:59:46 -060034Most of the tools are available only in ``sdk`` images or in images built
35after adding ``tools-profile`` to your ``local.conf`` file. So, in order to be able
36to access all of the tools described here, you can build and boot
37an ``sdk`` image, perhaps one of::
Andrew Geisslerc9f78652020-09-18 14:11:35 -050038
39 $ bitbake core-image-sato-sdk
Patrick Williamsac13d5f2023-11-24 18:59:46 -060040 $ bitbake core-image-weston-sdk
41 $ bitbake core-image-rt-sdk
Andrew Geisslerc9f78652020-09-18 14:11:35 -050042
Patrick Williamsac13d5f2023-11-24 18:59:46 -060043Alternatively, you can add ``tools-profile`` to the :term:`EXTRA_IMAGE_FEATURES` line in
44your ``local.conf`` file::
Andrew Geisslerc9f78652020-09-18 14:11:35 -050045
46 EXTRA_IMAGE_FEATURES = "debug-tweaks tools-profile"
47
Patrick Williamsac13d5f2023-11-24 18:59:46 -060048If you use the ``tools-profile`` method, you don't need to build an sdk image ---
Andrew Geisslerc926e172021-05-07 16:11:35 -050049the tracing and profiling tools will be included in non-sdk images as well e.g.::
Andrew Geisslerc9f78652020-09-18 14:11:35 -050050
51 $ bitbake core-image-sato
52
53.. note::
54
55 By default, the Yocto build system strips symbols from the binaries
56 it packages, which makes it difficult to use some of the tools.
57
58 You can prevent that by setting the
59 :term:`INHIBIT_PACKAGE_STRIP`
Andrew Geisslerc926e172021-05-07 16:11:35 -050060 variable to "1" in your ``local.conf`` when you build the image::
Andrew Geisslerc9f78652020-09-18 14:11:35 -050061
62 INHIBIT_PACKAGE_STRIP = "1"
63
64 The above setting will noticeably increase the size of your image.
65
66If you've already built a stripped image, you can generate debug
67packages (xxx-dbg) which you can manually install as needed.
68
Patrick Williamsac13d5f2023-11-24 18:59:46 -060069To generate debug info for packages, you can add ``dbg-pkgs`` to
70:term:`EXTRA_IMAGE_FEATURES` in ``local.conf``. For example::
Andrew Geisslerc9f78652020-09-18 14:11:35 -050071
72 EXTRA_IMAGE_FEATURES = "debug-tweaks tools-profile dbg-pkgs"
73
Patrick Williamsac13d5f2023-11-24 18:59:46 -060074Additionally, in order to generate the right type of debug info, we also need to
Andrew Geisslerc926e172021-05-07 16:11:35 -050075set :term:`PACKAGE_DEBUG_SPLIT_STYLE` in the ``local.conf`` file::
Andrew Geisslerc9f78652020-09-18 14:11:35 -050076
77 PACKAGE_DEBUG_SPLIT_STYLE = 'debug-file-directory'