Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. How to monitor GUI event loop busy and idle time length

How to monitor GUI event loop busy and idle time length

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
3 Posts 3 Posters 2.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    samuelzeng
    wrote on last edited by
    #1

    I am working on how to monitor GUI event loop work load. I suppose there is a block of time frame in GUI event loop between which GUI is busy handling event, then there is also a block of time frame that is idle. My question is how to measure the length of busy and idle time? I searched the forum and some one suggests using singleShot, but don't know how. We have override QCoreApplication::notify and handle events.

    raven-worxR 1 Reply Last reply
    0
    • S samuelzeng

      I am working on how to monitor GUI event loop work load. I suppose there is a block of time frame in GUI event loop between which GUI is busy handling event, then there is also a block of time frame that is idle. My question is how to measure the length of busy and idle time? I searched the forum and some one suggests using singleShot, but don't know how. We have override QCoreApplication::notify and handle events.

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @samuelzeng
      there is actually no idle time. You can think of the event loop as a infinite loop which just processes all inserted events in each iteration.
      Using the singleShot approach lets you roughly measure the time each iteration takes. A singleShot queues an method-invokation-event for the next iteration. Thus you can measure the time each iteration took to process the posted events.

      So either use QTimer::singleShot(0, this, SLOT(measureTime())) or QMetaObject::invokeMethod(this, "measureTime", Qt::QueuedConnection)

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      J.HilkJ 1 Reply Last reply
      0
      • raven-worxR raven-worx

        @samuelzeng
        there is actually no idle time. You can think of the event loop as a infinite loop which just processes all inserted events in each iteration.
        Using the singleShot approach lets you roughly measure the time each iteration takes. A singleShot queues an method-invokation-event for the next iteration. Thus you can measure the time each iteration took to process the posted events.

        So either use QTimer::singleShot(0, this, SLOT(measureTime())) or QMetaObject::invokeMethod(this, "measureTime", Qt::QueuedConnection)

        J.HilkJ Offline
        J.HilkJ Offline
        J.Hilk
        Moderators
        wrote on last edited by
        #3

        @raven-worx said in How to monitor GUI event loop busy and idle time length:

        So either use QTimer::singleShot(0, this, SLOT(measureTime())) or QMetaObject::invokeMethod(this, "measureTime", Qt::QueuedConnection)

        Just to mention it, since Qt 5.10 you can also write:
        QMetaObject::invokeMethod(this, &MyClass::measureTime, Qt::QueuedConnection)


        Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


        Q: What's that?
        A: It's blue light.
        Q: What does it do?
        A: It turns blue.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved