Documentation/Maemo Eclipse Tutorial/Eclipse Performance Profiling

(wikify slightly, reformat images, add links)
 
(4 intermediate revisions not shown)
Line 1: Line 1:
-
 
+
To obtain high-quality applications to be deployed on user's mobile devices, making sure that your application is bug-free is not enough. Mobile devices have limited resources, mainly CPU processing and memory. Also the way that applications interact with system resources impacts directly on performance. It is very problematic if your application crashes during execution. However, it can be worse if the application freezes due to excessive CPU processing, for example. The [[Documentation/devtools/maemo5/oprofile|OProfile]] tool can be used to monitor your application and define bottle necks in real-world systems. In order to find problems in performance, Maemo SDK also provides OProfile packages so it can be used to profiling Maemo applications as well Internet Tablet environments.
-
= Eclipse Performance Profiling =
+
-
 
+
-
= Introduction =
+
-
 
+
-
To obtain high-quality applications to be deployed on user's mobile devices, making sure that your application is bug-free is not enough. Mobile devices have limited resources, mainly CPU processing and memory. Also the way that applications interact with system resources impacts directly on performance. It is very problematic if your application crashes during execution. However, it can be worse if the application freezes due to excessive CPU processing, for example. The OProfile tool can be used to monitor your application and define bottle necks in real-world systems. In order to find problems in performance, Maemo SDK also provides OProfile packages so it can be used to profiling Maemo applications as well Internet Tablet environments.
+
Maemo Eclipse IDE integration products (ESbox and PluThon) provide support to profiling applications by using OProfile profiling and monitoring tool. This tutorial starts with a quickly introduction to OProfile profiling and monitoring tool. After that, it demonstrates how you can profile C/C++, Qt4 and Python applications at ESbox and PluThon using the OProfile tool integration. Finally, you can see how to interpret OProfile output at ESbox and PluThon.
Maemo Eclipse IDE integration products (ESbox and PluThon) provide support to profiling applications by using OProfile profiling and monitoring tool. This tutorial starts with a quickly introduction to OProfile profiling and monitoring tool. After that, it demonstrates how you can profile C/C++, Qt4 and Python applications at ESbox and PluThon using the OProfile tool integration. Finally, you can see how to interpret OProfile output at ESbox and PluThon.
-
= OProfile =
+
== OProfile ==
OProfile is an open source project that helps you to identify common performance issues, such as loop unrolling, poor cache utilization, inefficient type conversion and redundant operations, branch mispredictions, and so on. OProfile collects information about different counters: interrupt handlers, shared libraries, and much more. OProfile generates different outputs, ranging from simple tables with numbers that describe the total of samples registered during monitoring, to call graphs with detailed information about shared libraries. You can also obtain detailed source annotation, instruction-level reports and call graphs.
OProfile is an open source project that helps you to identify common performance issues, such as loop unrolling, poor cache utilization, inefficient type conversion and redundant operations, branch mispredictions, and so on. OProfile collects information about different counters: interrupt handlers, shared libraries, and much more. OProfile generates different outputs, ranging from simple tables with numbers that describe the total of samples registered during monitoring, to call graphs with detailed information about shared libraries. You can also obtain detailed source annotation, instruction-level reports and call graphs.
-
To start collecting profiling data, it is necessary to start <span><font face="monospace">opcontrol</font></span> tool. It is OProfile tool that collects the information that is then used to generate profiling reports. After profiling information has been collected with <span><font face="monospace">opcontrol</font></span> tool you can generate the reports you want to with <span><font face="monospace">opreport</font></span> tool.
+
To start collecting profiling data, it is necessary to start <code>opcontrol</code> tool. It is OProfile tool that collects the information that is then used to generate profiling reports. After profiling information has been collected with <code>opcontrol</code> tool you can generate the reports you want to with <span><font face="monospace">opreport</font></span> tool.
-
You can use OProfile on Maemo devices. However, you need to enable it on the kernel, so OProfile can monitor the system and applications. For more information about this step, see chapter [[#Configuring your Maemo device]].
+
You can use OProfile on Maemo devices. However, you need to enable it on the kernel, so OProfile can monitor the system and applications. For more information about this step, see the  chapter on [[#Configuring your Maemo device|configuring your Maemo device]].
-
= OProfile and IDE Integration =
+
== OProfile and IDE Integration ==
Both Maemo Eclipse IDE integration products ESbox and PluThon provide support for OProfile tool for C/C++, Qt4 and Python projects only on Maemo device environments. It does make sense to profile Maemo applications on Scratchbox with OProfile: it would catch also host machine interruptions, signals and produce a lot of other useless information so the result would not be accurate.
Both Maemo Eclipse IDE integration products ESbox and PluThon provide support for OProfile tool for C/C++, Qt4 and Python projects only on Maemo device environments. It does make sense to profile Maemo applications on Scratchbox with OProfile: it would catch also host machine interruptions, signals and produce a lot of other useless information so the result would not be accurate.
-
OProfile support on ESbox and PluThon uses the command <span><font face="monospace">opreport -a -l -g</font></span> to generate profiling reports. In such cases, OProfile generates the report with source file and line for each symbol (<span><font face="monospace">-g</font></span>) and it also accumulates sample and percentage counts in the symbol list (<span><font face="monospace">-a</font></span>). This section shows how to profile your applications at ESbox and PluThon and how to analyse profiling results.
+
OProfile support on ESbox and PluThon uses the command <code>opreport -a -l -g</code> to generate profiling reports. In such cases, OProfile generates the report with source file and line for each symbol (<code>-g</code>) and it also accumulates sample and percentage counts in the symbol list (<code>-a</code>). This section shows how to profile your applications at ESbox and PluThon and how to analyse profiling results.
-
== Configuring your Maemo device ==
+
=== Configuring your Maemo device ===
If you want to configure your device to profile Maemo applications, you need to enable the Maemo device kernel to execute OProfile on it. For more information, see documentation from the OProfile site like ''OProfile Manual'' <ref name=r4>OProfile Manual. http://oprofile.sourceforge.net/doc/index.html</ref> and from maemo.org site like ''OProfiling with Maemo'' <ref name=r3>OProfiling with Maemo. http://maemo.org/development/tools/doc/diablo/oprofile/</ref>.
If you want to configure your device to profile Maemo applications, you need to enable the Maemo device kernel to execute OProfile on it. For more information, see documentation from the OProfile site like ''OProfile Manual'' <ref name=r4>OProfile Manual. http://oprofile.sourceforge.net/doc/index.html</ref> and from maemo.org site like ''OProfiling with Maemo'' <ref name=r3>OProfiling with Maemo. http://maemo.org/development/tools/doc/diablo/oprofile/</ref>.
-
ESbox and PluThon products can configure the OProfile environment for you. If the system detects that your Maemo device kernel is not properly configured, a dialog prompts the user (figure [[#fig:eclipse_performance_profiling_prompt_kernel|11.1]]) to configure the kernel for OProfile.
+
ESbox and PluThon products can configure the OProfile environment for you. If the system detects that your Maemo device kernel is not properly configured, a dialog prompts the user (figure [[#figure-eclipse_performance_profiling_prompt_kernel|11.1]]) to configure the kernel for OProfile.
 +
<div id="figure-eclipse_performance_profiling_prompt_kernel">
 +
[[Image:oprofile-04.png|frame|center|alt=Screenshot of oprofile profiling an application|Figure 11.1: Profiling application with OProfile]]
 +
</div>
 +
=== Profiling your Maemo application ===
-
{| summary="Profiling application with OProfile"
+
At first, you must create a C/C++, Qt4 or Python project and select an <code>ARMEL</code> Scratchbox target. To run OProfile, right-click on the application (binary for C/C++ and qt4 projects or the Python script for Python projects) and select '''Profile As &gt; Remote OProfile Profiler''', figure [[#figure-eclipse_performance_profiling_oprofile-menu|11.2]]. If the tool is not properly installed at the selected target, the system can automatically install it for you.
-
|+ align="BOTTOM" |'''Figure 11.1:''' Profiling application with OProfile
+
-
|-
+
-
|
+
-
[[Image:oprofile-04.png|Image oprofile-04]]
+
-
|}
+
 +
<div id="figure-eclipse_performance_profiling_oprofile-menu">
 +
[[Image:oprofile-01.png|frame|center|alt=Screenshot of OProfile launch menu|'''Figure 11.2:''' OProfile Launch Menu]]
 +
</div>
 +
ESbox and PluThon runs your application on the Maemo device and the result is shown in the OProfile view, figure [[#figure-eclipse_performance_profiling_oprofile-view-05|11.3]]. All statistics found by OProfile are shown in an OProfile viewer, see the chapter on [[#Analyzing results|analyzing results]] for more details.
-
== Profiling your Maemo application ==
+
<div id="figure-eclipse_performance_profiling_oprofile-view-05">
 +
[[Image:oprofile-05.png|frame|center|alt=Screenshot of OProfile viewer|Figure 11.3: OProfile View]]
 +
</div>
-
At first, you must create a C/C++, Qt4 or Python project and select an <span><font face="monospace">ARMEL</font></span> Scratchbox target. To run OProfile, right-click on the application (binary for C/C++ and qt4 projects or the Python script for Python projects) and select '''Profile As &gt; Remote OProfile Profiler''', figure [[#fig:eclipse_performance_profiling_oprofile-menu|11.2]]. If the tool is not properly installed at the selected target, the system can automatically install it for you.
+
{{ambox
 +
|text=If you are planning to run the OProfile profiler more than once, you will probably need to clear current OProfile view before running the current program. For that, you just need to click the '''Delete Current Sample''' button on the OProfile view toolbar. If you do not, current results are merged with the older ones.
 +
}}
-
 
+
=== Analyzing results ===
-
 
+
-
{| summary="OProfile Launch Menu"
+
-
|+ align="BOTTOM" |'''Figure 11.2:''' OProfile Launch Menu
+
-
|-
+
-
|
+
-
[[Image:oprofile-01.png|Image oprofile-01]]
+
-
|}
+
-
 
+
-
 
+
-
 
+
-
ESbox and PluThon runs your application on the Maemo device and the result is shown in the OProfile view, figure [[#fig:eclipse_performance_profiling_oprofile-view-05|11.3]]. All statistics found by OProfile are shown in an OProfile viewer, see chapter [[#Analyzing results]] for more details.
+
-
 
+
-
 
+
-
 
+
-
{| summary="OProfile View"
+
-
|+ align="BOTTOM" |'''Figure 11.3:''' OProfile View
+
-
|-
+
-
|
+
-
[[Image:oprofile-05.png|Image oprofile-05]]
+
-
|}
+
-
 
+
-
 
+
-
 
+
-
{|
+
-
|-
+
-
| [[Image:dialog-information.png]]
+
-
| '''Note:'''  If you are planning to run the OProfile profiler more than once, you will probably need to clear current OProfile view before running the current program. For that, you just need to click the '''Delete Current Sample''' button on the OProfile view toolbar. If you do not, current results are merged with the older ones.
+
-
|}
+
-
 
+
-
== Analyzing results ==
+
Each line of OProfile viewer contains the following information:
Each line of OProfile viewer contains the following information:
Line 90: Line 62:
: Shows the name of binary image.
: Shows the name of binary image.
; '''Symbol name'''
; '''Symbol name'''
-
: Shows the symbol name. If the symbol name cannot be retrived, the label (<span><font face="monospace">no symbols</font></span>) is shown instead.
+
: Shows the symbol name. If the symbol name cannot be retrieved, the label (<code>no symbols</code>) is shown instead.
-
On the following figure [[#fig:eclipse_performance_profiling_oprofile-view-08|11.4]], there is an example of OProfile chapter from a Maemo C project:
+
On the following figure [[#figure-eclipse_performance_profiling_oprofile-view-08|11.4]], there is an example of OProfile chapter from a Maemo C project:
 +
<div id="figure-eclipse_performance_profiling_oprofile-view-08">
 +
[[Image:oprofile-08.png|frame|center|alt=Screenshot of OProfile view|Figure 11.4: OProfile View]]
 +
</div>
 +
In this example, we used a very simple GTK application, which only contains a simple label. On the third line (the selected line), information about library <code>ld-2.5.so</code> is shown in the table. For example, in about 12.030 samples (column '''Cum. Samples'''), the library was used on 10.879 samples (4.59%). Its symbol name is known as <code>/lib/ld-2.5.so</code> (column '''Symbol Name'''). This library does provides source file, so no information can be shown on '''Line Info''' columm.
-
{| summary="OProfile View"
+
== References ==
-
|+ align="BOTTOM" |'''Figure 11.4:''' OProfile View
+
-
|-
+
-
|
+
-
[[Image:oprofile-08.png|Image oprofile-08]]
+
-
|}
+
 +
<references />
-
 
+
[[Category:Documentation]]
-
In this example, we used a very simple GTK application, which only contains a simple label. On the third line (the selected line), information about library <span><font face="monospace">ld-2.5.so</font></span> is shown in the table. For example, in about 12.030 samples (columm '''Cum. Samples'''), the library was used on 10.879 samples (4.59%). Its symbol name is known as <span><font face="monospace">/lib/ld-2.5.so</font></span> (columm '''Symbol Name'''). This library does provides source file, so no information can be shown on '''Line Info''' columm.
+
[[Category:Eclipse]]
-
 
+
-
 
+
-
 
+
-
== References ==
+
-
<references />
+

Latest revision as of 14:30, 5 November 2010

To obtain high-quality applications to be deployed on user's mobile devices, making sure that your application is bug-free is not enough. Mobile devices have limited resources, mainly CPU processing and memory. Also the way that applications interact with system resources impacts directly on performance. It is very problematic if your application crashes during execution. However, it can be worse if the application freezes due to excessive CPU processing, for example. The OProfile tool can be used to monitor your application and define bottle necks in real-world systems. In order to find problems in performance, Maemo SDK also provides OProfile packages so it can be used to profiling Maemo applications as well Internet Tablet environments.

Maemo Eclipse IDE integration products (ESbox and PluThon) provide support to profiling applications by using OProfile profiling and monitoring tool. This tutorial starts with a quickly introduction to OProfile profiling and monitoring tool. After that, it demonstrates how you can profile C/C++, Qt4 and Python applications at ESbox and PluThon using the OProfile tool integration. Finally, you can see how to interpret OProfile output at ESbox and PluThon.

Contents

[edit] OProfile

OProfile is an open source project that helps you to identify common performance issues, such as loop unrolling, poor cache utilization, inefficient type conversion and redundant operations, branch mispredictions, and so on. OProfile collects information about different counters: interrupt handlers, shared libraries, and much more. OProfile generates different outputs, ranging from simple tables with numbers that describe the total of samples registered during monitoring, to call graphs with detailed information about shared libraries. You can also obtain detailed source annotation, instruction-level reports and call graphs.

To start collecting profiling data, it is necessary to start opcontrol tool. It is OProfile tool that collects the information that is then used to generate profiling reports. After profiling information has been collected with opcontrol tool you can generate the reports you want to with opreport tool.

You can use OProfile on Maemo devices. However, you need to enable it on the kernel, so OProfile can monitor the system and applications. For more information about this step, see the chapter on configuring your Maemo device.

[edit] OProfile and IDE Integration

Both Maemo Eclipse IDE integration products ESbox and PluThon provide support for OProfile tool for C/C++, Qt4 and Python projects only on Maemo device environments. It does make sense to profile Maemo applications on Scratchbox with OProfile: it would catch also host machine interruptions, signals and produce a lot of other useless information so the result would not be accurate.

OProfile support on ESbox and PluThon uses the command opreport -a -l -g to generate profiling reports. In such cases, OProfile generates the report with source file and line for each symbol (-g) and it also accumulates sample and percentage counts in the symbol list (-a). This section shows how to profile your applications at ESbox and PluThon and how to analyse profiling results.

[edit] Configuring your Maemo device

If you want to configure your device to profile Maemo applications, you need to enable the Maemo device kernel to execute OProfile on it. For more information, see documentation from the OProfile site like OProfile Manual [1] and from maemo.org site like OProfiling with Maemo [2].

ESbox and PluThon products can configure the OProfile environment for you. If the system detects that your Maemo device kernel is not properly configured, a dialog prompts the user (figure 11.1) to configure the kernel for OProfile.

File:Oprofile-04.png
Figure 11.1: Profiling application with OProfile

[edit] Profiling your Maemo application

At first, you must create a C/C++, Qt4 or Python project and select an ARMEL Scratchbox target. To run OProfile, right-click on the application (binary for C/C++ and qt4 projects or the Python script for Python projects) and select Profile As > Remote OProfile Profiler, figure 11.2. If the tool is not properly installed at the selected target, the system can automatically install it for you.

File:Oprofile-01.png
Figure 11.2: OProfile Launch Menu

ESbox and PluThon runs your application on the Maemo device and the result is shown in the OProfile view, figure 11.3. All statistics found by OProfile are shown in an OProfile viewer, see the chapter on analyzing results for more details.

File:Oprofile-05.png
Figure 11.3: OProfile View
Image:Ambox_notice.png
If you are planning to run the OProfile profiler more than once, you will probably need to clear current OProfile view before running the current program. For that, you just need to click the Delete Current Sample button on the OProfile view toolbar. If you do not, current results are merged with the older ones.

[edit] Analyzing results

Each line of OProfile viewer contains the following information:

Samples
Shows the number of samples for each symbol.
Acummulate samples
Outputs accumulate sample.
Percentage
Shows the percentage regarding to total samples for each binary image.
Acummulate percentage
Shows the accumulate percentage.
Line info
Provides source file and line for each symbol. If the source file is not provided, the label (no location information) is shown instead.
Application name
Shows the name of binary image.
Symbol name
Shows the symbol name. If the symbol name cannot be retrieved, the label (no symbols) is shown instead.

On the following figure 11.4, there is an example of OProfile chapter from a Maemo C project:

File:Oprofile-08.png
Figure 11.4: OProfile View

In this example, we used a very simple GTK application, which only contains a simple label. On the third line (the selected line), information about library ld-2.5.so is shown in the table. For example, in about 12.030 samples (column Cum. Samples), the library was used on 10.879 samples (4.59%). Its symbol name is known as /lib/ld-2.5.so (column Symbol Name). This library does provides source file, so no information can be shown on Line Info columm.

[edit] References

  1. OProfile Manual. http://oprofile.sourceforge.net/doc/index.html
  2. OProfiling with Maemo. http://maemo.org/development/tools/doc/diablo/oprofile/