Documentation/Maemo Eclipse Tutorial/Eclipse Tracing

(wikify slightly, use ambox)
(wikify slightly, reformat images, add links)
 
Line 1: Line 1:
IDE Integration provides support for Ltrace library call monitor profiling, available for ESbox and PluThon products. This tutorial presents a brief introduction to Ltrace and shows how to profile your applications at ESbox and PluThon using the Ltrace. Furthermore, it helps you understand how to interpret Ltrace debugging results.
IDE Integration provides support for Ltrace library call monitor profiling, available for ESbox and PluThon products. This tutorial presents a brief introduction to Ltrace and shows how to profile your applications at ESbox and PluThon using the Ltrace. Furthermore, it helps you understand how to interpret Ltrace debugging results.
-
In some cases, it might be useful to verify which are system calls and signals involved during a certain application execution. Ltrace is a profiling tool, which runs a specified command until it exits. While the command is executing, Ltrace intercepts and records the dynamic library calls, which are called by the executed process and the signals received by that process. It can also monitor system calls used by a program.
+
In some cases, it might be useful to verify which are system calls and signals involved during a certain application execution. [[Documentation/devtools/maemo5/ltrace|Ltrace]] is a profiling tool, which runs a specified command until it exits. While the command is executing, Ltrace intercepts and records the dynamic library calls, which are called by the executed process and the signals received by that process. It can also monitor system calls used by a program.
== Ltrace and Eclipse IDE Integration ==
== Ltrace and Eclipse IDE Integration ==
-
Maemo Eclipse IDE integration products (ESbox and PluThon) provide support for Ltrace tool for C/C++, Qt4 and Python projects on Maemo SDK and device environments. ESbox and PluThon use the command <span><font face="monospace">ltrace -S -T</font></span> to run Ltrace: <span><font face="monospace">-S</font></span> option to display system calls as well as library calls and <span><font face="monospace">-T</font></span> option to show the time spent inside each call. There are other options for Ltrace not used at IDE Integration, they can be found at <ref name=r1>Ltrace Man Page. http://linux.die.net/man/1/ltrace</ref>. This section shows how to profile your applications at ESbox and PluThon and how to analyse profiling results.
+
Maemo Eclipse IDE integration products (ESbox and PluThon) provide support for Ltrace tool for C/C++, Qt4 and Python projects on Maemo SDK and device environments. ESbox and PluThon use the command <code>ltrace -S -T</code> to run Ltrace: <code>-S</code> option to display system calls as well as library calls and <code>-T</code> option to show the time spent inside each call. There are other options for Ltrace not used at IDE Integration, they can be found at <ref name=r1>Ltrace Man Page. http://linux.die.net/man/1/ltrace</ref>. This section shows how to profile your applications at ESbox and PluThon and how to analyse profiling results.
=== Profiling your Maemo application with Ltrace ===
=== Profiling your Maemo application with Ltrace ===
Line 13: Line 13:
==== Local Ltrace Profiling ====
==== Local Ltrace Profiling ====
-
To locally run LTrace on ESbox, right-click on the application (binary for C/C++ and Qt4 projects or the Python script for Python projects) and select '''Profile As &gt; Local Ltrace Profiler''', figure [[#fig:eclipse_tracing_ltrace-menu-local|9.1]]. If the <span><font face="monospace">ltrace</font></span> tool is not properly installed at the selected target, the system can automatically install it, figure [[#fig:eclipse_tracing_install-ltrace|9.2]].
+
To locally run LTrace on ESbox, right-click on the application (binary for C/C++ and Qt4 projects or the Python script for Python projects) and select '''Profile As &gt; Local Ltrace Profiler''', figure [[#figure-eclipse_tracing_ltrace-menu-local|9.1]]. If the <code>ltrace</code> tool is not properly installed at the selected target, the system can automatically install it, figure [[#figure-eclipse_tracing_install-ltrace|9.2]].
-
{| summary="Locally Profiling application with Ltrace"
+
<div id="figure-eclipse_tracing_ltrace-menu-local">
-
|+ align="BOTTOM" |'''Figure 9.1:''' Locally Profiling application with Ltrace
+
[[Image:ltrace-menu-local.png|frame|center|alt=Screenshot of ltrace profling an application|Figure 9.1: Locally Profiling application with Ltrace]]
-
|-
+
</div>
-
|
+
-
[[Image:ltrace-menu-local.png|Image ltrace-menu-local]]
+
-
|}
+
-
{| summary="Installing Ltrace at target"
+
<div id="">
-
|+ align="BOTTOM" |'''Figure 9.2:''' Installing Ltrace at target
+
[[Image:install-ltrace.png|frame|center|alt=Screenshot of ltrace installation|'''Figure 9.2:''' Installing Ltrace in the target]]
-
|-
+
</div>
-
|
+
-
[[Image:install-ltrace.png|Image install-ltrace]]
+
-
|}
+
-
After Ltrace starts, ESbox launches your application on the SDK target and the result is shown in the Ltrace view, figure [[#fig:eclipse_tracing_ltrace-view-local|9.3]].
+
After Ltrace starts, ESbox launches your application on the SDK target and the result is shown in the Ltrace view, figure [[#figure-eclipse_tracing_ltrace-view-local|9.3]].
-
{| summary="Local Ltrace View"
+
<div id="figure-eclipse_tracing_ltrace-view-local">
-
|+ align="BOTTOM" |'''Figure 9.3:''' Local Ltrace View
+
[[Image:ltrace-view-local.png|frame|center|alt=Screenshot of local ltrace view|'''Figure 9.3:''' Local Ltrace View]]
-
|-
+
</div>
-
|
+
-
[[Image:ltrace-view-local.png|Image ltrace-view-local]]
+
-
|}
+
All library and system calls are shown as a table tree: parent nodes representing initial library or system calls and child nodes for each new nested call. Each node or line has four columns: Order, Call, Exit code and Time. By clicking on any column headers you can sort the lines by that column, and if you click again on the same column the sorter direction is inverted. Column '''Order''' is used as default sorter column.
All library and system calls are shown as a table tree: parent nodes representing initial library or system calls and child nodes for each new nested call. Each node or line has four columns: Order, Call, Exit code and Time. By clicking on any column headers you can sort the lines by that column, and if you click again on the same column the sorter direction is inverted. Column '''Order''' is used as default sorter column.
Line 42: Line 33:
==== Remote Ltrace Profiling ====
==== Remote Ltrace Profiling ====
-
To remotely run LTrace on PluThon (or ESbox), right-click on the Python project and select '''Profile As &gt; PluThon Remote Ltrace Python Profiler''', figure [[#fig:eclipse_tracing_ltrace-menu-remote|9.4]].
+
To remotely run LTrace on PluThon (or ESbox), right-click on the Python project and select '''Profile As &gt; PluThon Remote Ltrace Python Profiler''', figure [[#figure-eclipse_tracing_ltrace-menu-remote|9.4]].
-
{| summary="Remotely Profiling application with Ltrace"
+
<div id="figure-eclipse_tracing_ltrace-menu-remote">
-
|+ align="BOTTOM" |'''Figure 9.4:''' Remotely Profiling application with Ltrace
+
[[Image:ltrace-menu-remote.png|frame|center|alt=Screenshot of ltrace remotely profiling an application|'''Figure 9.4:''' Remotely Profiling application with Ltrace]]
-
|-
+
</div>
-
|
+
-
[[Image:ltrace-menu-remote.png|Image ltrace-menu-remote]]
+
-
|}
+
-
After Ltrace starts, PluThon launches your application on the Device and the result is shown in the Ltrace view as described before, figure [[#fig:eclipse_tracing_ltrace-view-remote|9.5]].
+
After Ltrace starts, PluThon launches your application on the Device and the result is shown in the Ltrace view as described before, figure [[#figure-eclipse_tracing_ltrace-view-remote|9.5]].
-
{| summary="Remote Ltrace View"
+
<div id="figure-eclipse_tracing_ltrace-view-remote">
-
|+ align="BOTTOM" |'''Figure 9.5:''' Remote Ltrace View
+
[[Image:ltrace-view-remote.png|frame|center|alt=Screenshot of remote ltrace view|'''Figure 9.5:''' Remote Ltrace View]]
-
|-
+
</div>
-
|
+
-
[[Image:ltrace-view-remote.png|Image ltrace-view-remote]]
+
-
|}
+
{{ambox
{{ambox
Line 73: Line 58:
* Time: the time spent inside the call. This records the time difference between the beginning and the end of the call.
* Time: the time spent inside the call. This records the time difference between the beginning and the end of the call.
-
Let us analyse an Ltrace profiling using a Python Project at target <code>DIABLO_X86</code>. After running the Python project with Ltrace you see the following results at Ltrace view, figure [[#fig:eclipse_tracing_ltrace-results-1|9.6]].
+
Let us analyse an Ltrace profiling using a Python Project at target <code>DIABLO_X86</code>. After running the Python project with Ltrace you see the following results at Ltrace view, figure [[#figure-eclipse_tracing_ltrace-results-1|9.6]].
-
{| summary="Ltrace results - initial lines"
+
<div id="figure-eclipse_tracing_ltrace-results-1">
-
|+ align="BOTTOM" |'''Figure 9.6:''' Ltrace results - initial lines
+
[[Image:ltrace-results-1.png|frame|center|alt=Screenshot of initial lines of ltrace result|Figure 9.6: Ltrace results - initial lines]]
-
|-
+
</div>
-
|
+
-
[[Image:ltrace-results-1.png|Image ltrace-results-1]]
+
-
|}
+
First, on the initial lines, we can see some system calls indicating that the program is being linked and loaded. For example, line 6 represents a system call named <code>SYS_open</code> that exited with code -2 and took 0.000018 seconds to finish.
First, on the initial lines, we can see some system calls indicating that the program is being linked and loaded. For example, line 6 represents a system call named <code>SYS_open</code> that exited with code -2 and took 0.000018 seconds to finish.
-
{| summary="Ltrace results - program&#39;s main statement"
+
<div id="figure-eclipse_tracing_ltrace-results-2">
-
|+ align="BOTTOM" |'''Figure 9.7:''' Ltrace results - program's main statement
+
[[Image:ltrace-results-2.png|frame|center|alt=Screenshot of ltrace results|'''Figure 9.7:''' Ltrace results - program's main statement]]
-
|-
+
</div>
-
|
+
-
[[Image:ltrace-results-2.png|Image ltrace-results-2]]
+
-
|}
+
-
From the latest Ltrace lines (figure [[#fig:eclipse_tracing_ltrace-results-2|9.7]]) we can see at line 85 that the program reached the main statement, called <code>__libc_start_main</code>. Notice also that the main statement has children nodes, that is, it has called another nested call (<code>PY_Main</code>) that has called another nested calls, and so on.
+
From the latest Ltrace lines (figure [[#figure-eclipse_tracing_ltrace-results-2|9.7]]) we can see at line 85 that the program reached the main statement, called <code>__libc_start_main</code>. Notice also that the main statement has children nodes, that is, it has called another nested call (<code>PY_Main</code>) that has called another nested calls, and so on.
== References ==
== References ==

Latest revision as of 13:20, 5 November 2010

IDE Integration provides support for Ltrace library call monitor profiling, available for ESbox and PluThon products. This tutorial presents a brief introduction to Ltrace and shows how to profile your applications at ESbox and PluThon using the Ltrace. Furthermore, it helps you understand how to interpret Ltrace debugging results.

In some cases, it might be useful to verify which are system calls and signals involved during a certain application execution. Ltrace is a profiling tool, which runs a specified command until it exits. While the command is executing, Ltrace intercepts and records the dynamic library calls, which are called by the executed process and the signals received by that process. It can also monitor system calls used by a program.

Contents

[edit] Ltrace and Eclipse IDE Integration

Maemo Eclipse IDE integration products (ESbox and PluThon) provide support for Ltrace tool for C/C++, Qt4 and Python projects on Maemo SDK and device environments. ESbox and PluThon use the command ltrace -S -T to run Ltrace: -S option to display system calls as well as library calls and -T option to show the time spent inside each call. There are other options for Ltrace not used at IDE Integration, they can be found at [1]. This section shows how to profile your applications at ESbox and PluThon and how to analyse profiling results.

[edit] Profiling your Maemo application with Ltrace

At first, you must create a C/C++, Qt4 or Python Maemo Project and select the target. After that, run the application with the Ltrace tool. The running can be local and remote for ESbox projects and remote for PluThon projects, as shown below.

[edit] Local Ltrace Profiling

To locally run LTrace on ESbox, right-click on the application (binary for C/C++ and Qt4 projects or the Python script for Python projects) and select Profile As > Local Ltrace Profiler, figure 9.1. If the ltrace tool is not properly installed at the selected target, the system can automatically install it, figure 9.2.

File:Ltrace-menu-local.png
Figure 9.1: Locally Profiling application with Ltrace
File:Install-ltrace.png
Figure 9.2: Installing Ltrace in the target

After Ltrace starts, ESbox launches your application on the SDK target and the result is shown in the Ltrace view, figure 9.3.

File:Ltrace-view-local.png
Figure 9.3: Local Ltrace View

All library and system calls are shown as a table tree: parent nodes representing initial library or system calls and child nodes for each new nested call. Each node or line has four columns: Order, Call, Exit code and Time. By clicking on any column headers you can sort the lines by that column, and if you click again on the same column the sorter direction is inverted. Column Order is used as default sorter column.

[edit] Remote Ltrace Profiling

To remotely run LTrace on PluThon (or ESbox), right-click on the Python project and select Profile As > PluThon Remote Ltrace Python Profiler, figure 9.4.

File:Ltrace-menu-remote.png
Figure 9.4: Remotely Profiling application with Ltrace

After Ltrace starts, PluThon launches your application on the Device and the result is shown in the Ltrace view as described before, figure 9.5.

File:Ltrace-view-remote.png
Figure 9.5: Remote Ltrace View
Image:Ambox_notice.png
If you are planning to run the Ltrace profiler more than once, you do not have to worry about cleaning current Ltrace view results, because this is done automatically before each new profiling. However, if you need to clean the Ltrace view during the profiling, you just need to click Delete Current ltrace lines button on the Ltrace view toolbar, so the view is reset and keeps receiving current ltrace results.

[edit] Analyzing results

During Ltrace profiling, all library and system calls are monitored and listed as a new node/line at Ltrace view. Each line has four columns:

  • Order: the position of the call in the table tree view. This column restarts for each nested call.
  • Description: the description of the library or system call.
  • Exit: exit code of the call.
  • Time: the time spent inside the call. This records the time difference between the beginning and the end of the call.

Let us analyse an Ltrace profiling using a Python Project at target DIABLO_X86. After running the Python project with Ltrace you see the following results at Ltrace view, figure 9.6.

File:Ltrace-results-1.png
Figure 9.6: Ltrace results - initial lines

First, on the initial lines, we can see some system calls indicating that the program is being linked and loaded. For example, line 6 represents a system call named SYS_open that exited with code -2 and took 0.000018 seconds to finish.

File:Ltrace-results-2.png
Figure 9.7: Ltrace results - program's main statement

From the latest Ltrace lines (figure 9.7) we can see at line 85 that the program reached the main statement, called __libc_start_main. Notice also that the main statement has children nodes, that is, it has called another nested call (PY_Main) that has called another nested calls, and so on.

[edit] References

  1. Ltrace Man Page. http://linux.die.net/man/1/ltrace