for all these features you'll need qt 5.14 · 2020. 1. 31. · how to profile a qt app on...
TRANSCRIPT
![Page 1: For all these features you'll need Qt 5.14 · 2020. 1. 31. · How to profile a Qt app on Android p.25 build your Qt 5.14 app (in release mode) using QtCreator pre Qt 5.14 strips](https://reader036.vdocuments.us/reader036/viewer/2022081523/5fefd5f9ea3bb63c080e06c2/html5/thumbnails/1.jpg)
Testing&ProfilingQtonAndroid
BogDanVatră,ProgrammeratKDAB
![Page 2: For all these features you'll need Qt 5.14 · 2020. 1. 31. · How to profile a Qt app on Android p.25 build your Qt 5.14 app (in release mode) using QtCreator pre Qt 5.14 strips](https://reader036.vdocuments.us/reader036/viewer/2022081523/5fefd5f9ea3bb63c080e06c2/html5/thumbnails/2.jpg)
It'sallaboutQt5.14!
p.2
Forallthesefeaturesyou'llneedQt5.14!
![Page 3: For all these features you'll need Qt 5.14 · 2020. 1. 31. · How to profile a Qt app on Android p.25 build your Qt 5.14 app (in release mode) using QtCreator pre Qt 5.14 strips](https://reader036.vdocuments.us/reader036/viewer/2022081523/5fefd5f9ea3bb63c080e06c2/html5/thumbnails/3.jpg)
What'snewonQt5.14forAndroid?
What'snewonQt5.14forAndroid? p.3
What'snewonQt5.14forAndroid?
HowtouseQtTestonAndroid
HowtouseAVDsforrunningtests
HowtoprofileaQtapponAndroid
HowtouseaddresssanitizeronAndroid
![Page 4: For all these features you'll need Qt 5.14 · 2020. 1. 31. · How to profile a Qt app on Android p.25 build your Qt 5.14 app (in release mode) using QtCreator pre Qt 5.14 strips](https://reader036.vdocuments.us/reader036/viewer/2022081523/5fefd5f9ea3bb63c080e06c2/html5/thumbnails/4.jpg)
Androidmultiarchbuildinonego
What'snewonQt5.14forAndroid? p.4
thebiggestfeatureaddedsinceImadetheQtonAndroidport
bydefaultallABIs(armeabi-v7a,arm64-v8,x86&x86_64)arebuilt
allowsyoutodecidewhichABI(s)youwanttobuildfor:
fromcommandline:$qmakeANDROID_ABIS="armeabi-v7aarm64-v8a"
![Page 5: For all these features you'll need Qt 5.14 · 2020. 1. 31. · How to profile a Qt app on Android p.25 build your Qt 5.14 app (in release mode) using QtCreator pre Qt 5.14 strips](https://reader036.vdocuments.us/reader036/viewer/2022081523/5fefd5f9ea3bb63c080e06c2/html5/thumbnails/5.jpg)
AndroidAppBundles(aab)
What'snewonQt5.14forAndroid? p.5
AndroidAppBundles(aab)isthenew(preferred)waytodistributeyourappsonGooglePlay
generatesandservesoptimizedAPKsforeachuser’sdeviceconfiguration
supportsdynamicfeaturemodules,viaplaycorelibrary
fromcommandline:$makeaab
Seehttps://developer.android.com/guide/app-bundleformoreinfo
![Page 6: For all these features you'll need Qt 5.14 · 2020. 1. 31. · How to profile a Qt app on Android p.25 build your Qt 5.14 app (in release mode) using QtCreator pre Qt 5.14 strips](https://reader036.vdocuments.us/reader036/viewer/2022081523/5fefd5f9ea3bb63c080e06c2/html5/thumbnails/6.jpg)
QtonAndroid5.14bringsmore
What'snewonQt5.14forAndroid? p.6
Sameasfor.aabyoucannowcreatean.apkfilefromcommandline:$makeapk
reworkedassetssupport:nowitlistsallthefilesandfolders.
loadQtpluginsdirectlyfromandroidlibsfolder
afewmore,checkhttps://www.kdab.com/qt-for-android-better-than-ever-before/formoreinfo
![Page 7: For all these features you'll need Qt 5.14 · 2020. 1. 31. · How to profile a Qt app on Android p.25 build your Qt 5.14 app (in release mode) using QtCreator pre Qt 5.14 strips](https://reader036.vdocuments.us/reader036/viewer/2022081523/5fefd5f9ea3bb63c080e06c2/html5/thumbnails/7.jpg)
HowtouseQtTestonAndroid
HowtouseQtTestonAndroid p.7
What'snewonQt5.14forAndroid?
HowtouseQtTestonAndroid
HowtouseAVDsforrunningtests
HowtoprofileaQtapponAndroid
HowtouseaddresssanitizeronAndroid
![Page 8: For all these features you'll need Qt 5.14 · 2020. 1. 31. · How to profile a Qt app on Android p.25 build your Qt 5.14 app (in release mode) using QtCreator pre Qt 5.14 strips](https://reader036.vdocuments.us/reader036/viewer/2022081523/5fefd5f9ea3bb63c080e06c2/html5/thumbnails/8.jpg)
Howdoweruntestsondesktop?
HowtouseQtTestonAndroid p.8
howdoweruntestsondesktop?$makecheck
![Page 9: For all these features you'll need Qt 5.14 · 2020. 1. 31. · How to profile a Qt app on Android p.25 build your Qt 5.14 app (in release mode) using QtCreator pre Qt 5.14 strips](https://reader036.vdocuments.us/reader036/viewer/2022081523/5fefd5f9ea3bb63c080e06c2/html5/thumbnails/9.jpg)
HowdidweusedtoruntestsonAndroid?
HowtouseQtTestonAndroid p.9
usuallywedidn't
therewere(atleast?)twoscriptswhichusedtohelp
thesescriptsneverworkedproperly;(
![Page 10: For all these features you'll need Qt 5.14 · 2020. 1. 31. · How to profile a Qt app on Android p.25 build your Qt 5.14 app (in release mode) using QtCreator pre Qt 5.14 strips](https://reader036.vdocuments.us/reader036/viewer/2022081523/5fefd5f9ea3bb63c080e06c2/html5/thumbnails/10.jpg)
Okayokay,but...
HowtouseQtTestonAndroid p.10
howshouldweruntestsonAndroid?$makecheck
![Page 11: For all these features you'll need Qt 5.14 · 2020. 1. 31. · How to profile a Qt app on Android p.25 build your Qt 5.14 app (in release mode) using QtCreator pre Qt 5.14 strips](https://reader036.vdocuments.us/reader036/viewer/2022081523/5fefd5f9ea3bb63c080e06c2/html5/thumbnails/11.jpg)
...
HowtouseQtTestonAndroid p.11
ThisishowwearegoingtoruntestsonAndroidusingQt5.14:$makecheck
Yes,nowit'sthateasy!
![Page 12: For all these features you'll need Qt 5.14 · 2020. 1. 31. · How to profile a Qt app on Android p.25 build your Qt 5.14 app (in release mode) using QtCreator pre Qt 5.14 strips](https://reader036.vdocuments.us/reader036/viewer/2022081523/5fefd5f9ea3bb63c080e06c2/html5/thumbnails/12.jpg)
Areyoukidding?!?!
HowtouseQtTestonAndroid p.12
25minutesjusttellustorun:$makecheck
![Page 13: For all these features you'll need Qt 5.14 · 2020. 1. 31. · How to profile a Qt app on Android p.25 build your Qt 5.14 app (in release mode) using QtCreator pre Qt 5.14 strips](https://reader036.vdocuments.us/reader036/viewer/2022081523/5fefd5f9ea3bb63c080e06c2/html5/thumbnails/13.jpg)
Holdyourhorses...:)
HowtouseQtTestonAndroid p.13
ThereareafewAndroidspecificthingswhichyoureallyneedtoknow:
sayhellotoandroidtestrunner
howtobuild&runyourtestsefficiently
howtorunyourtestsonaspecificdevice/emulator
howtopassargumentstoandroidtestrunner
howtopassargumentstoyourtest
![Page 14: For all these features you'll need Qt 5.14 · 2020. 1. 31. · How to profile a Qt app on Android p.25 build your Qt 5.14 app (in release mode) using QtCreator pre Qt 5.14 strips](https://reader036.vdocuments.us/reader036/viewer/2022081523/5fefd5f9ea3bb63c080e06c2/html5/thumbnails/14.jpg)
Sayhellotoandroidtestrunner
HowtouseQtTestonAndroid p.14
androidtestrunnerisanewtooladdedtoQt5.14which:
createsthe.apk(ifit'snotalreadycreated)
installsthe.apk
runsthefirstActivityfromAndroidManifest.xmluse--activityparametertospecifyanotherone
checksthetestresults
ifspecified,pullsthetestsoutputfilesinthebuildfolder
Beaware:multipleinstanceswillwaitforeachothertocomplete!
![Page 15: For all these features you'll need Qt 5.14 · 2020. 1. 31. · How to profile a Qt app on Android p.25 build your Qt 5.14 app (in release mode) using QtCreator pre Qt 5.14 strips](https://reader036.vdocuments.us/reader036/viewer/2022081523/5fefd5f9ea3bb63c080e06c2/html5/thumbnails/15.jpg)
Howtobuild&runyourtestsefficiently
HowtouseQtTestonAndroid p.15
buildonlytheneededABIs
buildyourAPKsinparallel!
runthetests
1 $qmakeANDROID_ABIS="x86_64"2 $make-j$(nproc)apk3 $makecheck
![Page 16: For all these features you'll need Qt 5.14 · 2020. 1. 31. · How to profile a Qt app on Android p.25 build your Qt 5.14 app (in release mode) using QtCreator pre Qt 5.14 strips](https://reader036.vdocuments.us/reader036/viewer/2022081523/5fefd5f9ea3bb63c080e06c2/html5/thumbnails/16.jpg)
Howtorunyourtestsonaspecificdevice
HowtouseQtTestonAndroid p.16
UseANDROID_DEVICE_SERIALenvironmentvariable
$ANDROID_DEVICE_SERIAL="emulator-5554"makecheck
![Page 17: For all these features you'll need Qt 5.14 · 2020. 1. 31. · How to profile a Qt app on Android p.25 build your Qt 5.14 app (in release mode) using QtCreator pre Qt 5.14 strips](https://reader036.vdocuments.us/reader036/viewer/2022081523/5fefd5f9ea3bb63c080e06c2/html5/thumbnails/17.jpg)
Howtopassargumentstoandroidtestrunner
HowtouseQtTestonAndroid p.17
UseTESTARGSvariabletopassparamstoandroidtestrunner
$makeTESTARGS="--timeout600"check
![Page 18: For all these features you'll need Qt 5.14 · 2020. 1. 31. · How to profile a Qt app on Android p.25 build your Qt 5.14 app (in release mode) using QtCreator pre Qt 5.14 strips](https://reader036.vdocuments.us/reader036/viewer/2022081523/5fefd5f9ea3bb63c080e06c2/html5/thumbnails/18.jpg)
Howtopassargumentstoyourtest
HowtouseQtTestonAndroid p.18
useTESTARGSvariabletopassparamstoandroidtestrunner
use--paramtopassparamstothetestitself
$makeTESTARGS="---oout.xml,xml-oout.txt,txt-o-,tap-vs"check
--followingparamswillbepasseddirectlytotestapp
-oout.xml,xmlstoresthetestsresultsinout.xml
-oout.txt,txtstoresthetestsresultsinout.txt
-o-,tapprints(tostdout)tapformat
-vsenablesloggingofeverysignalemission
out.xmlandout.txtarepulledbyandroidtestrunnertotestbuildfolder
![Page 19: For all these features you'll need Qt 5.14 · 2020. 1. 31. · How to profile a Qt app on Android p.25 build your Qt 5.14 app (in release mode) using QtCreator pre Qt 5.14 strips](https://reader036.vdocuments.us/reader036/viewer/2022081523/5fefd5f9ea3bb63c080e06c2/html5/thumbnails/19.jpg)
HowtouseAVDsforrunningtests
HowtouseAVDsforrunningtests p.19
What'snewonQt5.14forAndroid?
HowtouseQtTestonAndroid
HowtouseAVDsforrunningtests
HowtoprofileaQtapponAndroid
HowtouseaddresssanitizeronAndroid
![Page 20: For all these features you'll need Qt 5.14 · 2020. 1. 31. · How to profile a Qt app on Android p.25 build your Qt 5.14 app (in release mode) using QtCreator pre Qt 5.14 strips](https://reader036.vdocuments.us/reader036/viewer/2022081523/5fefd5f9ea3bb63c080e06c2/html5/thumbnails/20.jpg)
Plumbing
HowtouseAVDsforrunningtests p.20
usesdkmanagertoinstalltheemulatorandasystemimage$.../tools/bin/sdkmanager"emulator""system-images;android-29;default;x86_64"
useavdmanagertocreateanAVD$.../tools/bin/avdmanagercreateavd-ntest-k"system-images;android-29;default;x86_64"
choosecustomhardwareprofilechooseyesforhw.gpu.enabled
![Page 21: For all these features you'll need Qt 5.14 · 2020. 1. 31. · How to profile a Qt app on Android p.25 build your Qt 5.14 app (in release mode) using QtCreator pre Qt 5.14 strips](https://reader036.vdocuments.us/reader036/viewer/2022081523/5fefd5f9ea3bb63c080e06c2/html5/thumbnails/21.jpg)
StartanAVD
HowtouseAVDsforrunningtests p.21
useemulatortool$.../tools/emulator-avdtest
pass--no-windowparamtoemulatorfordockerhosts
![Page 22: For all these features you'll need Qt 5.14 · 2020. 1. 31. · How to profile a Qt app on Android p.25 build your Qt 5.14 app (in release mode) using QtCreator pre Qt 5.14 strips](https://reader036.vdocuments.us/reader036/viewer/2022081523/5fefd5f9ea3bb63c080e06c2/html5/thumbnails/22.jpg)
HowtoprofileaQtapponAndroid
HowtoprofileaQtapponAndroid p.22
What'snewonQt5.14forAndroid?
HowtouseQtTestonAndroid
HowtouseAVDsforrunningtests
HowtoprofileaQtapponAndroid
HowtouseaddresssanitizeronAndroid
![Page 23: For all these features you'll need Qt 5.14 · 2020. 1. 31. · How to profile a Qt app on Android p.25 build your Qt 5.14 app (in release mode) using QtCreator pre Qt 5.14 strips](https://reader036.vdocuments.us/reader036/viewer/2022081523/5fefd5f9ea3bb63c080e06c2/html5/thumbnails/23.jpg)
HowtouseGoogletoolstodoprofiling
HowtoprofileaQtapponAndroid p.23
Whatwearegoingtocover:
howtouseNDKtoolstodoC/C++profiling
WhatweareNOTgoingtocover:
howtodoQMLprofiling
howtodoJavaprofiling
![Page 24: For all these features you'll need Qt 5.14 · 2020. 1. 31. · How to profile a Qt app on Android p.25 build your Qt 5.14 app (in release mode) using QtCreator pre Qt 5.14 strips](https://reader036.vdocuments.us/reader036/viewer/2022081523/5fefd5f9ea3bb63c080e06c2/html5/thumbnails/24.jpg)
Steps:
HowtoprofileaQtapponAndroid p.24
build&installtheapplicationusingQtCreator
useNDKtoolstostartprofilerecording
starttheapplication
stoptheapplication
generateareportusingtheNDKtools
![Page 25: For all these features you'll need Qt 5.14 · 2020. 1. 31. · How to profile a Qt app on Android p.25 build your Qt 5.14 app (in release mode) using QtCreator pre Qt 5.14 strips](https://reader036.vdocuments.us/reader036/viewer/2022081523/5fefd5f9ea3bb63c080e06c2/html5/thumbnails/25.jpg)
Build&installtheapplication
HowtoprofileaQtapponAndroid p.25
buildyourQt5.14app(inreleasemode)usingQtCreatorpreQt5.14stripsthe.sofilesinyourandroid-builddir,whichwillcasethereportsteptonotshowyouanysymbols
doNOTsignyourapplicationsigningtheapplicationwillremovethedebugablemanifestflag.
installtheapplicationonthetargetdevice
![Page 26: For all these features you'll need Qt 5.14 · 2020. 1. 31. · How to profile a Qt app on Android p.25 build your Qt 5.14 app (in release mode) using QtCreator pre Qt 5.14 strips](https://reader036.vdocuments.us/reader036/viewer/2022081523/5fefd5f9ea3bb63c080e06c2/html5/thumbnails/26.jpg)
UseNDKtoolstostartprofilerecording
HowtoprofileaQtapponAndroid p.26
gotondk_folder/simpleperffolder
run./app_profiler.pytostartrecordingtheprofilingdata.Passatleast:--appparametertospecifythepackagename--libparametertospecifywhereisthebuilddirofyourapplicationformoreparameterspleasecheckhttps://android.googlesource.com/platform/system/extras/+/master/simpleperf/doc/android_application_profiling.md
$./app_profiler.py--apporg.qtproject.example.profile\--lib/home/bogdan/projects/build-profile-Release/android-build
Waitabituntiltheprofilerisreadyforrecording.
![Page 27: For all these features you'll need Qt 5.14 · 2020. 1. 31. · How to profile a Qt app on Android p.25 build your Qt 5.14 app (in release mode) using QtCreator pre Qt 5.14 strips](https://reader036.vdocuments.us/reader036/viewer/2022081523/5fefd5f9ea3bb63c080e06c2/html5/thumbnails/27.jpg)
Start&stoptheapplication
HowtoprofileaQtapponAndroid p.27
starttheapplication
stoptheapplication
waituntil./app_profiler.pypullstherecordedprofiledata
![Page 28: For all these features you'll need Qt 5.14 · 2020. 1. 31. · How to profile a Qt app on Android p.25 build your Qt 5.14 app (in release mode) using QtCreator pre Qt 5.14 strips](https://reader036.vdocuments.us/reader036/viewer/2022081523/5fefd5f9ea3bb63c080e06c2/html5/thumbnails/28.jpg)
GenerateareportusingtheNDKtools
HowtoprofileaQtapponAndroid p.28
Thereareacoupleofreportingtoolsinthatfolder,themostimportantonesare:
report.pyisawrapperoftheperfreportcommandonthehost#Reportcallgraph$./report.py-g
report_html.pygeneratesreport.htmlfilebasedontheprofilingdata#Generateinteractivechartstatistics,sampletableandflamegraphs,basedonperf.data$./report_html.py
![Page 29: For all these features you'll need Qt 5.14 · 2020. 1. 31. · How to profile a Qt app on Android p.25 build your Qt 5.14 app (in release mode) using QtCreator pre Qt 5.14 strips](https://reader036.vdocuments.us/reader036/viewer/2022081523/5fefd5f9ea3bb63c080e06c2/html5/thumbnails/29.jpg)
Whattolookfor
HowtoprofileaQtapponAndroid p.29
qtMainLoopThreaisthethreadthatcallsyourmainfunctionusuallythisisthethreadthatyou'relookingfor
QtThread,QQmlThreadareQtinternalthreadsusedbyQmlEngine(Renderer)
RenderThread,Binder:XXXXXXareAndroidinternalthreads
unnamedthreadsusuallyareAndroidinternalthreads,butmightbeapplication'stoo
It'shighlyrecommendedtoexplicitlynameallyourapplicationthreads(useQThread::setObjectNamebeforeyoustartit)
![Page 30: For all these features you'll need Qt 5.14 · 2020. 1. 31. · How to profile a Qt app on Android p.25 build your Qt 5.14 app (in release mode) using QtCreator pre Qt 5.14 strips](https://reader036.vdocuments.us/reader036/viewer/2022081523/5fefd5f9ea3bb63c080e06c2/html5/thumbnails/30.jpg)
HowtouseaddresssanitizeronAndroid
HowtouseaddresssanitizeronAndroid p.30
What'snewonQt5.14forAndroid?
HowtouseQtTestonAndroid
HowtouseAVDsforrunningtests
HowtoprofileaQtapponAndroid
HowtouseaddresssanitizeronAndroid
![Page 31: For all these features you'll need Qt 5.14 · 2020. 1. 31. · How to profile a Qt app on Android p.25 build your Qt 5.14 app (in release mode) using QtCreator pre Qt 5.14 strips](https://reader036.vdocuments.us/reader036/viewer/2022081523/5fefd5f9ea3bb63c080e06c2/html5/thumbnails/31.jpg)
SamesupportasyoufindonGNU/Linux
HowtouseaddresssanitizeronAndroid p.31
firstclasssupportforaddresssanitizeronAndroidinQt5.14$qmakeCONFIG+=sanitizerCONFIG+=sanitize_address$makeapk
Yep,that'sallyouneedtodo!
Caveats:
itseemsitworksonlyonarm64-v8
itseemsitworksonlyonAndroid9+
itworkedformeonlyonGoogle'sPixel3