Documentation/Maemo Eclipse Tutorial/Eclipse Performance Profiling
(wikify slightly, use ambox) |
(wikify slightly, reformat images, add links) |
||
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 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. | + | 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. |
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. | ||
Line 7: | Line 7: | ||
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 < | + | 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 | + | 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 == | ||
Line 15: | Line 15: | ||
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 < | + | 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 === | ||
Line 21: | Line 21: | ||
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 [[# | + | 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 === | === Profiling your Maemo application === | ||
- | At first, you must create a C/C++, Qt4 or Python project and select an < | + | 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 > 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. |
- | + | <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 [[# | + | 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. |
- | + | <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> | |
- | + | ||
- | + | ||
- | + | ||
{{ambox | {{ambox | ||
Line 71: | 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 | + | : Shows the symbol name. If the symbol name cannot be retrieved, the label (<code>no symbols</code>) is shown instead. |
- | On the following figure [[# | + | 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 < | + | 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. |
== 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.
[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.
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.
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:
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
- ↑ OProfile Manual. http://oprofile.sourceforge.net/doc/index.html
- ↑ OProfiling with Maemo. http://maemo.org/development/tools/doc/diablo/oprofile/
- This page was last modified on 5 November 2010, at 14:30.
- This page has been accessed 8,786 times.