[bootlin/training-materials updates] master: Boot time slides: mention ltrace too (e0545aeb)
Michael Opdenacker
michael.opdenacker at bootlin.com
Fri Oct 22 16:08:22 CEST 2021
Repository : https://github.com/bootlin/training-materials
On branch : master
Link : https://github.com/bootlin/training-materials/commit/e0545aeb3ff4d03d86bbc6c7da4f53172eb7adf7
>---------------------------------------------------------------
commit e0545aeb3ff4d03d86bbc6c7da4f53172eb7adf7
Author: Michael Opdenacker <michael.opdenacker at bootlin.com>
Date: Fri Oct 22 16:08:22 2021 +0200
Boot time slides: mention ltrace too
The description is shared with the embedded Linux course
Signed-off-by: Michael Opdenacker <michael.opdenacker at bootlin.com>
>---------------------------------------------------------------
e0545aeb3ff4d03d86bbc6c7da4f53172eb7adf7
agenda/boot-time-agenda.tex | 2 +-
agenda/boot-time-fr-agenda.tex | 2 +-
agenda/boot-time-online-agenda.tex | 2 +-
agenda/boot-time-online-fr-agenda.tex | 2 +-
common/ltrace.tex | 68 ++++++++++++++++++++++
.../boot-time-application.tex | 1 +
.../sysdev-application-development.tex | 1 +
7 files changed, 74 insertions(+), 4 deletions(-)
diff --git a/agenda/boot-time-agenda.tex b/agenda/boot-time-agenda.tex
index c5d0c3b2..cd2ed0a8 100644
--- a/agenda/boot-time-agenda.tex
+++ b/agenda/boot-time-agenda.tex
@@ -174,7 +174,7 @@
{Lecture - Application optimization}
{
\begin{itemize}
- \item Using \code{strace}
+ \item Using \code{strace} and \code{ltrace}
\item Other profiling techniques
\end{itemize}
}
diff --git a/agenda/boot-time-fr-agenda.tex b/agenda/boot-time-fr-agenda.tex
index 3d400953..0e2bc063 100644
--- a/agenda/boot-time-fr-agenda.tex
+++ b/agenda/boot-time-fr-agenda.tex
@@ -197,7 +197,7 @@
{Cours - Optimisation de l'application}
{
\begin{itemize}
- \item Utilisation de \code{strace}
+ \item Utilisation de \code{strace} et \code{ltrace}
\item Autres techniques de profiling
\end{itemize}
}
diff --git a/agenda/boot-time-online-agenda.tex b/agenda/boot-time-online-agenda.tex
index 0aee1847..fe6d5a9b 100644
--- a/agenda/boot-time-online-agenda.tex
+++ b/agenda/boot-time-online-agenda.tex
@@ -169,7 +169,7 @@
{Lecture - Application optimization}
{
\begin{itemize}
- \item Using \code{strace}
+ \item Using \code{strace} and \code{ltrace}
\item Other profiling techniques
\end{itemize}
}
diff --git a/agenda/boot-time-online-fr-agenda.tex b/agenda/boot-time-online-fr-agenda.tex
index 939b56fb..2824954e 100644
--- a/agenda/boot-time-online-fr-agenda.tex
+++ b/agenda/boot-time-online-fr-agenda.tex
@@ -183,7 +183,7 @@
{Cours - Optimisation de l'application}
{
\begin{itemize}
- \item Utilisation de \code{strace}
+ \item Utilisation de \code{strace} et \code{ltrace}
\item Autres techniques de profiling
\end{itemize}
}
diff --git a/common/ltrace.tex b/common/ltrace.tex
new file mode 100644
index 00000000..3d6db8b5
--- /dev/null
+++ b/common/ltrace.tex
@@ -0,0 +1,68 @@
+\begin{frame}
+ \frametitle{ltrace}
+ A tool to trace library calls used by a program and all the signals
+ it receives
+ \begin{itemize}
+ \item Very useful complement to \code{strace}, which shows only system
+ calls. Library calls include system calls too!
+ \item Of course, works even if you don't have the sources
+ \item Allows to filter library calls with regular expressions, or
+ just by a list of function names.
+ \item Manual page: \url{https://linux.die.net/man/1/ltrace}
+ \item Works better with {\em glibc}. \code{ltrace} was broken
+ with {\em uClibc} and may still be.
+ \end{itemize}
+ See \url{https://en.wikipedia.org/wiki/Ltrace} for details
+\end{frame}
+
+\begin{frame}[fragile]
+ \frametitle{ltrace example output}
+ \small
+ \begin{block}{}
+\begin{verbatim}
+ltrace nedit index.html
+sscanf(0x8274af1, 0x8132618, 0x8248640, 0xbfaadfe8, 0) = 1
+sprintf("const 0", "const %d", 0) = 7
+strcmp("startScan", "const 0") = 1
+strcmp("ScanDistance", "const 0") = -1
+strcmp("const 200", "const 0") = 1
+strcmp("$list_dialog_button", "const 0") = -1
+strcmp("$shell_cmd_status", "const 0") = -1
+strcmp("$read_status", "const 0") = -1
+strcmp("$search_end", "const 0") = -1
+strcmp("$string_dialog_button", "const 0") = -1
+strcmp("$rangeset_list", "const 0") = -1
+strcmp("$calltip_ID", "const 0") = -1
+\end{verbatim}
+\end{block}
+\end{frame}
+
+\begin{frame}[fragile]
+ \frametitle{ltrace summary}
+ Example summary at the end of the ltrace output (\code{-c} option)
+ \scriptsize
+ \begin{block}{}
+\begin{verbatim}
+Process 17019 detached
+% time seconds usecs/call calls errors syscall
+------ ----------- ----------- --------- --------- ----------------
+100.00 0.000050 50 1 set_thread_area
+ 0.00 0.000000 0 48 read
+ 0.00 0.000000 0 44 write
+ 0.00 0.000000 0 80 63 open
+ 0.00 0.000000 0 19 close
+ 0.00 0.000000 0 1 execve
+ 0.00 0.000000 0 2 2 access
+ 0.00 0.000000 0 3 brk
+ 0.00 0.000000 0 1 munmap
+ 0.00 0.000000 0 1 uname
+ 0.00 0.000000 0 1 mprotect
+ 0.00 0.000000 0 19 mmap2
+ 0.00 0.000000 0 50 46 stat64
+ 0.00 0.000000 0 18 fstat64
+------ ----------- ----------- --------- --------- ----------------
+100.00 0.000050 288 111 total
+\end{verbatim}
+ \end{block}
+\end{frame}
+
diff --git a/slides/boot-time-application/boot-time-application.tex b/slides/boot-time-application/boot-time-application.tex
index 39f59df6..ab670fc1 100644
--- a/slides/boot-time-application/boot-time-application.tex
+++ b/slides/boot-time-application/boot-time-application.tex
@@ -24,6 +24,7 @@
\end{frame}
\input{../common/strace.tex}
+\input{../common/ltrace.tex}
\begin{frame}
\frametitle{oprofile}
diff --git a/slides/sysdev-application-development/sysdev-application-development.tex b/slides/sysdev-application-development/sysdev-application-development.tex
index bc6fbb18..ae6ce471 100644
--- a/slides/sysdev-application-development/sysdev-application-development.tex
+++ b/slides/sysdev-application-development/sysdev-application-development.tex
@@ -494,6 +494,7 @@
\subsection{System analysis}
\input{../common/strace.tex}
+\input{../common/ltrace.tex}
\begin{frame}
\frametitle{ltrace}
More information about the training-materials-updates
mailing list