bugfreeblog.duckdns.org Open in urlscan Pro
82.57.208.228  Public Scan

URL: https://bugfreeblog.duckdns.org/2021/09/measure-framerate-qt.html
Submission: On October 25 via manual from IN — Scanned from IT

Form analysis 3 forms found in the DOM

GET https://bugfreeblog.duckdns.org/

<form method="get" class="search-form" action="https://bugfreeblog.duckdns.org/">
  <label>
    <span class="screen-reader-text">Search for:</span>
    <input type="search" class="search-field" placeholder="Search" value="" name="s">
  </label>
  <input type="submit" class="search-submit" value="Search">
</form>

POST https://bugfreeblog.duckdns.org/wp-comments-post.php

<form action="https://bugfreeblog.duckdns.org/wp-comments-post.php" method="post" id="commentform" class="comment-form" novalidate="">
  <p class="comment-notes"><span id="email-notes">Your email address will not be published.</span> <span class="required-field-message" aria-hidden="true">Required fields are marked <span class="required" aria-hidden="true">*</span></span></p>
  <p class="comment-form-comment"><label for="comment">Comment <span class="required" aria-hidden="true">*</span></label> <textarea id="comment" name="comment" cols="45" rows="8" maxlength="65525" required=""></textarea></p>
  <p class="comment-form-author"><label for="author">Name <span class="required" aria-hidden="true">*</span></label> <input id="author" name="author" type="text" value="" size="30" maxlength="245" required=""></p>
  <p class="comment-form-email"><label for="email">Email <span class="required" aria-hidden="true">*</span></label> <input id="email" name="email" type="email" value="" size="30" maxlength="100" aria-describedby="email-notes" required=""></p>
  <p class="comment-form-url"><label for="url">Website</label> <input id="url" name="url" type="url" value="" size="30" maxlength="200"></p>
  <p class="comment-form-cookies-consent"><input id="wp-comment-cookies-consent" name="wp-comment-cookies-consent" type="checkbox" value="yes"> <label for="wp-comment-cookies-consent">Save my name, email, and website in this browser for the next time
      I comment.</label></p>
  <p class="comment-form-comment-subscribe"><label for="cren_subscribe_to_comment"><input id="cren_subscribe_to_comment" name="cren_subscribe_to_comment" type="checkbox" value="on" checked="">Notify me via e-mail if anyone answers my comment.</label>
  </p>
  <p class="form-submit"><input name="submit" type="submit" id="submit" class="submit" value="Post Comment"> <input type="hidden" name="comment_post_ID" value="978" id="comment_post_ID">
    <input type="hidden" name="comment_parent" id="comment_parent" value="0">
  </p>
  <p style="display: none;"><input type="hidden" id="akismet_comment_nonce" name="akismet_comment_nonce" value="786c1c555b"></p>
  <p style="display: none !important;"><label>Δ<textarea name="ak_hp_textarea" cols="45" rows="8" maxlength="100"></textarea></label><input type="hidden" id="ak_js_1" name="ak_js" value="1666699675496">
    <script>
      document.getElementById("ak_js_1").setAttribute("value", (new Date()).getTime());
    </script>
  </p>
</form>

GET https://bugfreeblog.duckdns.org/

<form method="get" class="search-form" action="https://bugfreeblog.duckdns.org/">
  <label>
    <span class="screen-reader-text">Search for:</span>
    <input type="search" class="search-field" placeholder="Search" value="" name="s">
  </label>
  <input type="submit" class="search-submit" value="Search">
</form>

Text Content

The Bugfree Blog ;-)

A blog about anything related to engineering, proudly hosted on a Raspberry Pi.

Search for:


Close Menu



MEASURING THE FRAME RATE IN QT/QML

September 19, 2021September 19, 2021 lucaMeasuring the Frame Rate in Qt/QML 0
Comment


--------------------------------------------------------------------------------

Tags: QML, Qt

I frequently need to measure the frame rate in a Qt/QML application to have an
idea of how heavy the changes I’m making are. In the past, I found two
approaches that seemed to answer the question: one is using a simple QML item,
measuring the frequency of changes of a property. The other is using a custom
QQuickItem, measuring the frequency of the calls received to refresh it. I never
used the first approach because it did not feel safe, while I typically used the
second.

Instead of copy/pasting code into my projects repeatedly, I thought I could add
it to my collection of simple procedures in
https://github.com/carlonluca/lqtutils, making it simple to integrate when
needed. I therefore asked myself which one to include.

By thinking a bit about it, I thought of a different simpler approach using the
signal QQuickWindow::frameSwapped(). This is what Qt doc says about it:

> This signal is emitted when a frame has been queued for presenting. With
> vertical synchronization enabled the signal is emitted at most once per vsync
> interval in a continuously animating scene. This signal will be emitted from
> the scene graph rendering thread.

This seemed a reasonable approach, simple to implement, very concise and
lightweight. The resulting code is in the repo. Doc is in:
https://github.com/carlonluca/lqtutils#lqtutils_uih.


IS THIS CORRECT?

I was wondering if my approach was correct, so I thought I could compare with
the other approaches. I took the snippets from this SO question. I tried the
three techniques separately and also tried to add them together in the same code
for a comparison of the values. For the test I used my QML app here:
https://github.com/carlonluca/Fall. In the branch
https://github.com/carlonluca/Fall/tree/fps_comparison I added all the
components to compare. This is the result:



As it can be seen, the method based on the QQuickPaintedItem gives the same
result of the one based on the frameSwapped() signal. The other one is very
different. The explanation for this is probably based on the fact that the Qt
scene graph on Linux renders through the threaded render mode. In fact, forcing
a single-threaded render mode makes the three techniques agree on the
measurement (second run in the video).

Compared to a custom QQuickPaintedItem, the frameSwapped() technique seems to be
more lightweight, so it is the one I implemented in my repo.

Bye!


POST NAVIGATION

Previous page Previous post: Using requirejs in WordPress posts
Next page Next post: Docker Image for the Awesome MLDonkey Service



LEAVE A REPLY CANCEL REPLY

Your email address will not be published. Required fields are marked *

Comment *

Name *

Email *

Website

Save my name, email, and website in this browser for the next time I comment.

Notify me via e-mail if anyone answers my comment.





Δ

Search for:

Author Info
Acer (1) Allwinner (2) Alma (1) Android (10) Android NDK (6) ARM (1) B-Spline
(2) Bezier (4) BLE (1) Bluetooth (2) C/C++ (14) Chromium (1) CI (1) continuous
integration (1) cross-build (6) Cygwin (2) docker (6) DVB-S (1) DVB-T (1) EGL
(9) FEM (2) ffmpeg (7) Finite Element Method (2) gcc (3) git (1) gitea (1)
gitlab (1) gitlab-runner (1) gstreamer (1) Hardware-acceleration (1)
Hardware-decoding (1) HTTP (2) i.MX 6 (1) ICU (1) IGA (7) Intel HD (1) iOS (4)
Islam (1) Isogeometric Analysis (8) iTunes (1) jenkins (1) JNI (4) jquery (1)
KDE (1) kernel (1) Lagrange Polynomials (1) Linux (16) logcat (3) logging (3)
MacBook (1) Mac OS (5) macports (1) Manjaro (2) mediawiki (1) meld (1) mldonkey
(1) Multimedia (46) Necessitas (2) Nexus (1) NURBS (2) nVidia (1) Octave (5)
OpenGL (11) OpenMAX (36) PiOmxTextures (33) Plasma (1) polr (1) Power Basis (1)
QML (31) Qt (60) Qt6 (3) Qt Creator (4) QtMultimedia (41) QtWayland (2)
QtWebEngine (7) QtWebKit (13) Raspberry Pi (58) raspbian (10) requirejs (1) Rust
(2) SQLCipher (1) Streaming (3) subversion (1) SVN (1) taglib (1) TypeScript (4)
ubuntu (1) v4l2 (1) vc4 (1) VLC (2) vmware (1) Wayland (2) WebKit (6) Windows
(2) Windows 8 (1) Windows Phone (1) WinRT (1) wordpress (2) xcode (1) Xubuntu
(1) Yocto (1) YouTube (5)


PAGES

 * Home
 * About Me
 * Approximation, Finite Elements and Isogeometric Analysis (with Matlab
   implementation)
 * Using POT Builds
 * Build Procedure for PiOmxTextures


ISOGEOMETRIC ANALYSIS

 * Isogeometric Analysis and Finite Element Method
 * Isogeometric Analysis: Bezier Curves and Surfaces in Octave and TypeScript
 * Isogeometric Analysis: B-spline Curves and Surfaces in Octave and TypeScript
 * Isogeometric Analysis: NURBS curves and surfaces in Octave and TypeScript
 * Isogeometric Analysis: Knot Insertion for NURBS
 * Isogeometric Analysis: Bézier Curves and Surfaces in Rust


POPULAR POSTS

 * Qt 6 on the Raspberry Pi on eglfs 39 views
 * Hardware Accelerated Video with Qt 6 on the Raspberry Pi 19 views
 * Accelerated Video Playback on the Raspberry Pi in Qt 6 on eglfs KMS 17 views
 * Hardware Accelerated QtMultimedia Backend for Raspberry Pi and OpenGL Shaders
   on Video 9 views
 * Docker Image for Qt Development and Continuous Integration on x64 and arm64 8
   views
 * Render yuv420p Frames in OpenGL with GPU-accelerated conversion 8 views
 * QML Components for Video Decoding and Rendering POC Code Available 7 views
 * Measuring the Frame Rate in Qt/QML 7 views
 * Raspberry OS Bullseye and Cross Toolchain for Linux and Mac OS 10.2.1 6 views
 * Isogeometric Analysis: Bézier Curves and Surfaces in Rust 6 views


RECENT POSTS

 * Formatting Generic Text in the Terminal September 12, 2022
 * Linux on the Acer Aspire 3810T August 31, 2022
 * Accelerated Video Playback on the Raspberry Pi in Qt 6 on eglfs KMS August
   16, 2022
 * The Utah Teapot in Rust with Bézier Surfaces February 22, 2022
 * Rational Bézier Curves and Circles in Rust February 17, 2022


RECENT COMMENTS

 * luca on Docker Image for Qt Development and Continuous Integration on x64 and
   arm64
 * Dask on Docker Image for Qt Development and Continuous Integration on x64 and
   arm64
 * luca on Docker Image for Qt Development and Continuous Integration on x64 and
   arm64
 * Dask on Docker Image for Qt Development and Continuous Integration on x64 and
   arm64
 * luca on Qt 6 on the Raspberry Pi on eglfs


ARCHIVE

 * 2022 (7)
 * 2021 (18)
 * 2020 (3)
 * 2019 (1)
 * 2018 (2)
 * 2017 (4)
 * 2016 (10)
 * 2015 (18)
 * 2014 (11)
 * 2013 (12)
 * 2012 (9)


META

 * Log in
 * Entries feed
 * Comments feed
 * WordPress.org



Scroll Up

The Bugfree Theme is a fork of Ultimate Blogger by Buywptemplate

Copyright (c) 2021 Luca Carlon. All rights reserved.