How To Profile QML App on Embedded Device: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 1: Line 1:
=How to profile <span class="caps">QML</span> app on embedded device=
[[Category:HowTo]]<br />[[Category:HowTo::Qt_Embedded]]


Information on profiling <span class="caps">QML</span> app is scattered in places so I thought of putting it together in one place.
[toc align_right=&quot;yes&amp;quot; depth=&quot;2&amp;quot;]


==Prerequisite==
= How to profile QML app on embedded device =


<span class="caps">NOTE</span>: Assumption is that Linux PC is used as development environment
Information on profiling QML app is scattered in places so I thought of putting it together in one place.


* Qt for host PC is installed. This is required to launch QtCreator
== Prerequisite ==
* Make sure that option “-no-declarative-debug” was <span class="caps">NOT</span> specified when configuring Qt for target device
* if Qt for target was configured with ''-prefix &lt;installation-path&gt;'' then make sure that same installation path exists on target<br /> e.g. ''-prefix /usr/local/qt-48x-emb'' is specified then copy contents of ''/usr/local/qt-48x-emb'' from host to target at ''/usr/local/qt-48x-emb''
* Make sure Qt for target was built using same toolchain that will be used to build the app
* Host PC (which will be running QtCreator) and target should be on same network<br /><span class="caps">NOTE</span>:


==Profiling==
NOTE: Assumption is that Linux PC is used as development environment<br />* Qt for host PC is installed. This is required to launch QtCreator<br />* Make sure that option &quot;-no-declarative-debug&amp;quot; was NOT specified when configuring Qt for target device<br />* if Qt for target was configured with ''-prefix &lt;installation-path&amp;gt;'' then make sure that same installation path exists on target<br />e.g. ''-prefix /usr/local/qt-48x-emb'' is specified then copy contents of ''/usr/local/qt-48x-emb'' from host to target at ''/usr/local/qt-48x-emb''<br />* Make sure Qt for target was built using same toolchain that will be used to build the app<br />* Host PC (which will be running QtCreator) and target should be on same network<br />NOTE:


At high level, to profile a <span class="caps">QML</span> app one will require to carry out following steps,
== Profiling ==


# Build the <span class="caps">QML</span> app to be profiled for target device
At high level, to profile a QML app one will require to carry out following steps,<br /># Build the QML app to be profiled for target device<br /># Launch QML Profiler (external) from QtCreator on host<br /># Launch QML app on target with commandline options to enable remote profiling
# Launch <span class="caps">QML</span> Profiler (external) from QtCreator on host
# Launch <span class="caps">QML</span> app on target with commandline options to enable remote profiling


===Steps for building app===
=== Steps for building app ===


# Make sure that following options are added to the application’s .pro file<br />
# Make sure that following options are added to the application's .pro file<br /><code>DEFINES ''= QMLJSDEBUGGER<br />DEFINES''= QT_DECLARATIVE_DEBUG<br />CONFIG += declarative_debug</code>
# Ensure <span class="caps">QTDIR</span> refers to the installation path of QT for target as specified in ''-prefix''<br />
# Ensure QTDIR refers to the installation path of QT for target as specified in _<s>prefix_<br /><code>e.g. QTDIR=/usr/local/qt-48x-emb<code><br /># Ensure PATH contains path of ''bin'' folder from installation path of Qt for target<br /></code>e.g. PATH=/usr/local/qt-48x-emb/bin:$PATH</code><br /># Generate make file using the .pro<br /><code>host-cmd-prmt&amp;gt; qmake app.pro<code><br /># Build the app<br /></code>host-cmd-prmt&amp;gt; make</code><br /># Transfer the app binaries and necessary app files to the target
# Ensure <span class="caps">PATH</span> contains path of ''bin'' folder from installation path of Qt for target<br />
<br />h3. Launch QML Profiler (external) on host
# Generate make file using the .pro<br />
<br /># Launch QtCreator on host PC<br /># From the menu bar in QtCreator, select menu item '''''Analyze'''''</s>&gt; '''''QML Profiler (External)'''''; this will popup a small dialog
# Build the app<br />
# Transfer the app binaries and necessary app files to the target
 
===Launch <span class="caps">QML</span> Profiler (external) on host===
 
# Launch QtCreator on host PC
# From the menu bar in QtCreator, select menu item '''''Analyze''''' -&gt; '''''<span class="caps">QML</span> Profiler (External)'''''; this will popup a small dialog
# Note the '''''port''''' value. It will be passed on as command line option when launching the app
# Note the '''''port''''' value. It will be passed on as command line option when launching the app
# Detail instructions on profiling and interpreting the results can be found [http://doc.qt.io/qtcreator-2.7/creator-qml-performance-monitor.html here] ''[qt.io]''
# Detail instructions on profiling and interpreting the results can be found &quot;here&amp;quot;:http://doc.qt.io/qtcreator-2.7/creator-qml-performance-monitor.html
# Hit the ''OK'' button after you launch the app on target
# Hit the ''OK'' button after you launch the app on target


===Launch the app to be profiled on the target===
=== Launch the app to be profiled on the target ===


# Start the app on the target as,<br />
# Start the app on the target as,<br /><code>target-prmt&amp;gt; app -platform eglfs -qmljsdebugger=port:3456<code>


* Port value shall be same as that in the <span class="caps">QML</span> Profiler (External) Dialog
* Port value shall be same as that in the QML Profiler (External) Dialog
* the app is run against eglfs platform plugin but it could run against any other platform plugin if that is tested to be run on the target.
* the app is run against eglfs platform plugin but it could run against any other platform plugin if that is tested to be run on the target.


==Troubleshooting==
== Troubleshooting ==


===Qt libraries not found===
=== Qt libraries not found ===


* Make sure Qt libraries are copied on the target
* Make sure Qt libraries are copied on the target
* export LD_LIBRARY_PATH to refer to the path where Qt libraries are copied<br />
* export LD_LIBRARY_PATH to refer to the path where Qt libraries are copied<br /></code>e.g. LD_LIBRARY_PATH=/usr/local/qt-48x-emb/lib:$LD_LIBRARY_PATH</code>


===Remote debugger plugin <span class="caps">NOT</span> found===
=== Remote debugger plugin NOT found ===


* Confirm if following libraries were built for target,<br />
* Confirm if following libraries were built for target,<br /><code>libqmldbg_tcp.so<br />libqmldbg_inspector.so</code>
* On target, these libraries should be present in /usr/local/qt-48x-emb/plugins/qmltooling
* On target, these libraries should be present in /usr/local/qt-48x-emb/plugins/qmltooling
* export LD_LIBRARY_PATH to refer to the path where Qt plugin libraries are copied<br />
* export LD_LIBRARY_PATH to refer to the path where Qt plugin libraries are copied<br /><code>e.g. LD_LIBRARY_PATH=/usr/local/qt-48x-emb/plugins/qmltooling:$LD_LIBRARY_PATH<code>


===Cannot capture the logs on host in <span class="caps">QML</span> profiler===
=== Cannot capture the logs on host in QML profiler ===


* Make sure you synchronize launching of the app on target and starting the profiling on host PC.
* Make sure you synchronize launching of the app on target and starting the profiling on host PC.
* This could be achieved by adding some piece of code that starts the app on target after few seconds or on key press.
===Categories:===
* [[:Category:HowTo|HowTo]]
** [[:Category:HowTo::Qt Embedded|Qt_Embedded]]

Revision as of 10:20, 24 February 2015


[toc align_right="yes&quot; depth="2&quot;]

How to profile QML app on embedded device

Information on profiling QML app is scattered in places so I thought of putting it together in one place.

Prerequisite

NOTE: Assumption is that Linux PC is used as development environment
* Qt for host PC is installed. This is required to launch QtCreator
* Make sure that option "-no-declarative-debug&quot; was NOT specified when configuring Qt for target device
* if Qt for target was configured with -prefix <installation-path&gt; then make sure that same installation path exists on target
e.g. -prefix /usr/local/qt-48x-emb is specified then copy contents of /usr/local/qt-48x-emb from host to target at /usr/local/qt-48x-emb
* Make sure Qt for target was built using same toolchain that will be used to build the app
* Host PC (which will be running QtCreator) and target should be on same network
NOTE:

Profiling

At high level, to profile a QML app one will require to carry out following steps,
# Build the QML app to be profiled for target device
# Launch QML Profiler (external) from QtCreator on host
# Launch QML app on target with commandline options to enable remote profiling

Steps for building app

  1. Make sure that following options are added to the application's .pro file
    DEFINES ''= QMLJSDEBUGGER<br />DEFINES''= QT_DECLARATIVE_DEBUG<br />CONFIG += declarative_debug
    
  2. Ensure QTDIR refers to the installation path of QT for target as specified in _prefix_
    e.g. QTDIR=/usr/local/qt-48x-emb<code><br /># Ensure PATH contains path of ''bin'' folder from installation path of Qt for target<br />
    
    e.g. PATH=/usr/local/qt-48x-emb/bin:$PATH
    # Generate make file using the .pro
    host-cmd-prmt&amp;gt; qmake app.pro<code><br /># Build the app<br />
    
    host-cmd-prmt&gt; make
    # Transfer the app binaries and necessary app files to the target


h3. Launch QML Profiler (external) on host
# Launch QtCreator on host PC
# From the menu bar in QtCreator, select menu item Analyze
> QML Profiler (External); this will popup a small dialog

  1. Note the port value. It will be passed on as command line option when launching the app
  2. Detail instructions on profiling and interpreting the results can be found "here&quot;:http://doc.qt.io/qtcreator-2.7/creator-qml-performance-monitor.html
  3. Hit the OK button after you launch the app on target

Launch the app to be profiled on the target

  1. Start the app on the target as,
    target-prmt&amp;gt; app -platform eglfs -qmljsdebugger=port:3456<code>
    
    * Port value shall be same as that in the QML Profiler (External) Dialog
    * the app is run against eglfs platform plugin but it could run against any other platform plugin if that is tested to be run on the target.
    
    == Troubleshooting ==
    
    === Qt libraries not found ===
    
    * Make sure Qt libraries are copied on the target
    * export LD_LIBRARY_PATH to refer to the path where Qt libraries are copied<br />
    
    e.g. LD_LIBRARY_PATH=/usr/local/qt-48x-emb/lib:$LD_LIBRARY_PATH

Remote debugger plugin NOT found

  • Confirm if following libraries were built for target,
    libqmldbg_tcp.so<br />libqmldbg_inspector.so
    
  • On target, these libraries should be present in /usr/local/qt-48x-emb/plugins/qmltooling
  • export LD_LIBRARY_PATH to refer to the path where Qt plugin libraries are copied
    e.g. LD_LIBRARY_PATH=/usr/local/qt-48x-emb/plugins/qmltooling:$LD_LIBRARY_PATH

Cannot capture the logs on host in QML profiler

  • Make sure you synchronize launching of the app on target and starting the profiling on host PC.