Slow startup of QWS
My application is very slow on first startup.
My board is a 400MHz ARM9 (iMX27) running from NAND flash.
When I first try to start my application (with -qws) the screen remains blank for about 20s.
I then briefly get a green background and a mouse pointer before my application starts and hides the mouse.
If I quite my application and start it again, it start instantly (again with brief green screen and mouse pointer).
Any ideas why the first start would take so long!
I also tried with a simple 'Hello World' test and it does the same.
..edit .... I'm using Qt 4.7.1
I have the same problems on an other board (Freescale 5121e PPC). I have the following software config: gcc 4.3.2, Linux Kernel 22.214.171.124, Qt everrywhere open source 4.7.2
I tried with Qt static and dynamic, the results do not differ significantly.
I tried the following app-types:
Qt Gui application with QApplication, size about 11 Megs (static linked), first run takes about >20 secs
Qt Console App with QCoreApplication, which just prints out a "Hello", size stripped about 2 Megs, takes about 10 secs for the first run.
A "Hello World" C-Programm with printf needs just a few millisecs.
As described from Jinxxy, quitting the application and starting again, has almost no delays.
Any suggestions, what causes the delay or where to begin looking for the causes?
I've seen this caused by very slow onboard flash devices in the past. If subsequent startups are much quicker (due to files being cached) then take a look at the IO performance of your storage device.
Oh another idea, make sure that all the necessary kernel drivers are loaded and have had time to initialise before you start your app for the first time.
The device boots from network and mounts its rootfs over nfs. To avoid network and io delays, I copied the app before starting into /tmp, which is tmpfs residing in ram, meaning the delay should be very minimal compared to any flash or network drive. All the kernel drives are compiled into the kernel and not as modules. I also tested the following:
I start a qt-based app, which is staticly linked with qt-libs. The start is delayed as described above. Then I quit the app and start another qt-based app, which is also staticly linked. Also the second app shows the huge delay. All apps are always copied into /tmp before executing.
OK so you need to profile to see what is going on but since you say a simple hello world app takes 10s to start up it sounds as if the problem is within Qt. I would suggest building a debug version of your app and remotely debugging it on your target device (you should be able to spot a 10s delay as you step through the code). Also worth running some profiling tool too to see if that gives any clues.
Any updates? I am running into the exact same issue (long load time on first run) on my ARM device. I am using QT 4.7.3
Btw, Jinxyy, you can minimize the amount of time the mouse stays on the screen by calling "QWSServer::setCursorVisible(false)" immediately after constructing your QApplication. I haven't found a way to eliminate it completely, however.
Please, someone has solved the problem. I have the same problem on a Freescale ARM.
The first time I run the program works very slow. I close the program and run it back and working properly.
Here is my latest update regarding startup:
I had the same issues. Than, I enabled in the linux kernel fs-caching. After that, my qt app starts up in about 8-9 secs.
I changed nothing in qt-code. qt-libs are static-compiled. the app is about 7MB static and stripped. After all these changes, the app starts up at least with the same delay on the first and other runs.
By the way, the app uses directfb. When switched to LinuxFB, it starts up slightly faster (about 5-6 secs), but than blitting performance is bad.
So, I believe startup problem was due to kernel config. On the other side, still, the whole system is far far away from the "1 second linux", where you can find a demo-video on internet, on which they boot linux+qt app in 1 sec....
I have been experiencing the same issue on Qt 4.7 and Qt 4.8. I am running a JFFS2 filesystem and my total boot time is broken down by ~10 seconds to get LCD splashed, Kernel copied from NAND, uncompressed and running in LPDDR, ~6 seconds of init stuff, ~10 seconds of JFFS2 file system mounting, and around ~24 seconds to get my App / Qt to main menu. 400 MHz ARM 9 with 95 MHz LPDDR. I am going to try the above idea with fs-caching.
So, we decided to switch from JFFS2 to UBI and the boot time changed from a total of 52 seconds down to 22 seconds with no other change. Apparently JFFS2 is not a good choice as these NAND's are getting larger and the embedded devices are using more and more files.