Important: Please read the Qt Code of Conduct -

Way to measure a programs idle time.

  • Hi everyone.

    Im working on a program thats supposed to listen a UdpSocket, TcpSocket, an USB connection and insert a high amount of data on SQL. The thing is, that Id like to know my program performance, and if im able to add more code or I would be risking not having enough time to process the incoming data.

    My question... Is there a way to measure how much time my program is idle? I mean, how much time it spends on any of the threads it has, and how much time is simply waiting for an interruption.
    Ive read that with QElapsedTimer I can know with detail the amount a time a method or an operation takes, but what I would like to know is the exact opposite, how much time is doing nothing.

    Im running on Windows, so I cant use the QML Profiler, (or at least thats what Ive understood from the documentation... Can QML profiler be used on Windows?)

    Thanks in advance!

  • Lifetime Qt Champion

    I don't think idle time is useful. What is really important is the question whether your application is able to handle everything under high load. I mean, even if most of the time your application is idle it can still be too slow if later you get input from your sockets, USB connection and write something to the database.

Log in to reply