Andrew Geissler | f034379 | 2020-11-18 10:42:21 -0600 | [diff] [blame] | 1 | .. SPDX-License-Identifier: CC-BY-SA-2.0-UK |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2 | |
| 3 | ****************************************** |
| 4 | Yocto Project Profiling and Tracing Manual |
| 5 | ****************************************** |
| 6 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 7 | Introduction |
| 8 | ============ |
| 9 | |
Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame] | 10 | Yocto Project bundles a number of tracing and profiling tools --- this manual |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 11 | describes their basic usage and shows by example how to make use of them |
Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame] | 12 | to analyze application and system behavior. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 13 | |
Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame] | 14 | The tools presented are, for the most part, completely open-ended and have |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 15 | quite good and/or extensive documentation of their own which can be used |
| 16 | to solve just about any problem you might come across in Linux. Each |
| 17 | section that describes a particular tool has links to that tool's |
| 18 | documentation and website. |
| 19 | |
Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame] | 20 | The purpose of this manual is to present a set of common and generally |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 21 | useful tracing and profiling idioms along with their application (as |
| 22 | appropriate) to each tool, in the context of a general-purpose |
| 23 | 'drill-down' methodology that can be applied to solving a large number |
Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame] | 24 | of problems. For help with more advanced usages and problems, |
| 25 | refer to the documentation and/or websites provided for each tool. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 26 | |
Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame] | 27 | The final section of this manual is a collection of real-world examples |
| 28 | which we'll be continually updating as we solve more problems using the |
| 29 | tools --- feel free to suggest additions to what you read here. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 30 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 31 | General Setup |
| 32 | ============= |
| 33 | |
Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame] | 34 | Most of the tools are available only in ``sdk`` images or in images built |
| 35 | after adding ``tools-profile`` to your ``local.conf`` file. So, in order to be able |
| 36 | to access all of the tools described here, you can build and boot |
| 37 | an ``sdk`` image, perhaps one of:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 38 | |
| 39 | $ bitbake core-image-sato-sdk |
Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame] | 40 | $ bitbake core-image-weston-sdk |
| 41 | $ bitbake core-image-rt-sdk |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 42 | |
Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame] | 43 | Alternatively, you can add ``tools-profile`` to the :term:`EXTRA_IMAGE_FEATURES` line in |
| 44 | your ``local.conf`` file:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 45 | |
| 46 | EXTRA_IMAGE_FEATURES = "debug-tweaks tools-profile" |
| 47 | |
Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame] | 48 | If you use the ``tools-profile`` method, you don't need to build an sdk image --- |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 49 | the tracing and profiling tools will be included in non-sdk images as well e.g.:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 50 | |
| 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 Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 60 | variable to "1" in your ``local.conf`` when you build the image:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 61 | |
| 62 | INHIBIT_PACKAGE_STRIP = "1" |
| 63 | |
| 64 | The above setting will noticeably increase the size of your image. |
| 65 | |
| 66 | If you've already built a stripped image, you can generate debug |
| 67 | packages (xxx-dbg) which you can manually install as needed. |
| 68 | |
Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame] | 69 | To generate debug info for packages, you can add ``dbg-pkgs`` to |
| 70 | :term:`EXTRA_IMAGE_FEATURES` in ``local.conf``. For example:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 71 | |
| 72 | EXTRA_IMAGE_FEATURES = "debug-tweaks tools-profile dbg-pkgs" |
| 73 | |
Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame] | 74 | Additionally, in order to generate the right type of debug info, we also need to |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 75 | set :term:`PACKAGE_DEBUG_SPLIT_STYLE` in the ``local.conf`` file:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 76 | |
| 77 | PACKAGE_DEBUG_SPLIT_STYLE = 'debug-file-directory' |