Qt for Embedded Linux Performance Tuning
|
Creating a Static Build To compile Qt as a static library, use the -static option when running configure: ./configure -static To build the application suite as an all-in-one application, design each application as a stand-alone widget (or set of widgets) with only minimal code in the main() function. Then, write an application that provides a means of switching between the applications. The Qt Extended platform is an example using this approach: It can be built either as a set of dynamically linked executables, or as a single static application. Note that the application still should link dynamically against the standard C library and any other libraries which might be used by other applications on the target device. |
When installing end-user applications, this approach may not be an option, but when building a single application suite for a device with limited CPU power and memory, this option could be very beneficial.
The libraries shipped with some C++ compilers on some platforms have poor performance in the built-in "new" and "delete" operators. Improved memory allocation and performance may be gained by re-implementing these functions:
void *operator new[](size_t size) { return malloc(size); } void *operator new(size_t size) { return malloc(size); } void operator delete[](void *ptr) { free(ptr); } void operator delete[](void *ptr, size_t) { free(ptr); } void operator delete(void *ptr) { free(ptr); } void operator delete(void *ptr, size_t) { free(ptr); }
The example above shows the necessary code to switch to the plain C memory allocators.
When rendering, Qt uses the concept of a backing store; i.e., a paint buffer, to reduce flicker and to support graphics operations such as blending.
The default behavior is for each client to render its widgets into memory while the server is responsible for putting the contents of the memory onto the screen. But when the hardware is known and well defined, as is often the case with software for embedded devices, it might be useful to bypass the backing store, allowing the clients to manipulate the underlying hardware directly. There are two approaches to direct painting: The first approach is to set the Qt::WA_PaintOnScreen window attribute for each widget, the other is to use the QDirectPainter class to reserve a region of the framebuffer. For more information, see the direct painting section of the architecture documentation.
Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. | Qt qtextended4.4 | |
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD. | ||
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP ! |
Copyright © 2000-2012 - www.developpez.com