Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. High CPU consumption with QTcpSocket::waitForReadyRead on OSX?
Qt 6.11 is out! See what's new in the release blog

High CPU consumption with QTcpSocket::waitForReadyRead on OSX?

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 772 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.
  • N Offline
    N Offline
    nirslsk
    wrote on last edited by
    #1

    Update: This isn't a problem with waitForReadyRead but rather with QProgressBar. I've added more info in my next post.

    Hi there,

    I have a file sharing client application written with Qt that I build on both Windows and OSX. I've just now noticed that when downloading on OSX, CPU consumption is quite high (around % 30 CPU per active download in Activity Meter), whereas on Windows CPU consumption for the client is very low at all times. Each download is handled in a separate QThread to which the socket is moved using moveToThread (preceded by setParent(0) to enable the move), and waitForReadyRead is used whenever bytesAvailable() returns 0. I tried eliminating virtually all other activity in the thread to see if anything else might be causing this consumption, but it certainly seems as if waitForReadyRead is the culprit. Is this normal for OSX? Is there anything I might be able to do to improve on this?

    Thanks, Nir

    1 Reply Last reply
    0
    • N Offline
      N Offline
      nirslsk
      wrote on last edited by
      #2

      So this appears to have nothing to do with waitForReadyRead. CPU consumption whenever the download's QProgress bar is in view and active (animated) goes way up. This is true regardless of how frequently I update it. Googling for QProgressBar and CPU comes up with a lot of relevant information, including this bug report from 2011:

      https://bugreports.qt-project.org/browse/QTBUG-20880

      I guess it was never fixed.

      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