[bootlin/training-materials updates] master: labs: debugging: add more informations to use perf report (20067529)

Clément Léger clement.leger at bootlin.com
Thu Mar 23 10:14:13 CET 2023


Repository : https://github.com/bootlin/training-materials
On branch  : master
Link       : https://github.com/bootlin/training-materials/commit/20067529d8792f788662b6edec27e09ceccb00ac

>---------------------------------------------------------------

commit 20067529d8792f788662b6edec27e09ceccb00ac
Author: Clément Léger <clement.leger at bootlin.com>
Date:   Thu Mar 23 10:14:13 2023 +0100

    labs: debugging: add more informations to use perf report
    
    Signed-off-by: Clément Léger <clement.leger at bootlin.com>


>---------------------------------------------------------------

20067529d8792f788662b6edec27e09ceccb00ac
 .../debugging-application-profiling.tex            | 27 +++++++++++++++++-----
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/labs/debugging-application-profiling/debugging-application-profiling.tex b/labs/debugging-application-profiling/debugging-application-profiling.tex
index 95eed340..eef51efe 100644
--- a/labs/debugging-application-profiling/debugging-application-profiling.tex
+++ b/labs/debugging-application-profiling/debugging-application-profiling.tex
@@ -132,11 +132,19 @@ $ perf record ./png_convert tux_small.png out.png
 
 Once recorded, a \code{perf.data} file will be generated. This file will
 contain the traces that have been recorded. These traces can be analyzed using
-\code{perf report}. You will quickly notice that the output is not the same as
-valgrind because it displays a time spent per function (excluding function
-calls inside them). This allows to find which function takes most of the
-execution time. In order to compare this output to the valgrind one, we can
-run perf and also record the callgraph using the \code{--call-graph} option.
+\code{perf report} on the development platform:
+
+\begin{bashinput}
+$ sudo chown $USER:$USER perf.data
+$ perf report --symfs=/home/$USER/debugging-labs/buildroot/output/staging/
+    -k /home/$USER/debugging-labs/buildroot/output/build/linux-5.13/vmlinux
+\end{bashinput}
+
+You will quickly notice that the output is not the same as valgrind because it
+displays the time spent per function (excluding function calls inside them).
+This allows to find which function takes most of the execution time. In order to
+compare this output to the valgrind one, we can run perf and also record the
+callgraph using the \code{--call-graph} option.
 
 \begin{bashinput}
 $ perf record --call-graph dwarf ./png_convert tux_small.png out.png
@@ -145,9 +153,16 @@ $ perf record --call-graph dwarf ./png_convert tux_small.png out.png
 We specify that we want to record the call graph using the DWARF information
 that are contained in ELF file (compiled with \code{-g}). Once recorded, on the
 desktop platform, display the results with \code{perf report} and compare them
-with callgrind ones:
+with callgrind ones on your development platform:
 
 \begin{bashinput}
+$ sudo chown $USER:$USER perf.data
 $ perf report --symfs=/home/$USER/debugging-labs/buildroot/output/staging/
    -k /home/$USER/debugging-labs/buildroot/output/build/linux-5.13/vmlinux
 \end{bashinput}
+
+{\em NOTE: the vmlinux file used for the \code{-k} option must match the kernel
+build id that is running on the board or perf will not use it.}
+
+{\em NOTE: in order to annotate the dissasembled code and display the time spent,
+for each instruction, \code{CROSS_COMPILE} must be set.}




More information about the training-materials-updates mailing list