Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-23590

High CPU Usage when error is present in currently opened file

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • Not Evaluated
    • None
    • Qt Creator 4.11.0
    • None
    • Linux/X11

    Description

      QtCreator 4.11-0.4 ( as reported by pacman -Si qtcreator ) currently uses nearly 80% of one CPU core when an error is present in a CPP file.

      Here is the situation : I am in a (still) very small project, where I'm starting to benchmark a TIFF image library for a personal project. All my files are HPP/CPP, and the project is based on CMake.

      When the currently opened file has no errors/warnings, QtCreator idles and uses <1% of any CPU core (as seen on screenshot 1). However, when the opened file has an error, Qt will use most of (if not all, sometimes) one core, on the main thread (as seen on screenshot 2). This causes a spike in usage, and causes my CPU to go up to 90-92°C.

      Here is an example. It is the same kind of code which is present in the attached screenshots. Consider the following :

      // Compute something, measure time spent :
      std::chrono::duration<double, std::milli> duration = end_point - start_point;
      // ... do some more things ...
      std::string debug_message = "Projected time for 4x operations : " + std::to_string(4000.0 * duration.count());
      // ... do some more things ...
      

      Now, this code is bug-free, and doesn't cause any problems. QtCreator is idling below 1%, such that htop considers it uses 0.0% CPU. Consider now the following code, with a template error :

      // Compute something, measure time spent :
      std::chrono::duration<double, std::milli> duration = end_point - start_point;
      // ... do some more things ...
      std::string debug_message = "Projected time for 4x operations : " + std::to_string(4000.0 * std::chrono::duration_cast<std::chrono::seconds>(duration.count()));
      // ... do some more things ...
      

      According to the std::chrono::duration_cast<> template, this causes an error. And QtCreator correctly flags it as such. But then, the main thread (labeled as the executable in screenshot 2) locks one of my CPU cores to anywhere between 75 to 80 and sometimes even 100%, causing a really high power draw (I'm running it on a laptop) and a really high CPU temperature.

      What's a bit weird is that it isn't even the clang backend process which uses a high percentage of my CPU, it's the qtcreator executable itself. Any info or insight into why this might be happening, or how to fix it is greatly appreciated.

      N.B : In my project, I have included the Core, GUI, Widgets, OpenGL, XML, and Multimedia widgets, I also have included libQGLViewer (latest version) and OpenGL as well as glm. Although they are linked with the executable when compiled, the program only has a small Qt window for displaying {{QLabel}}s to test some features, nothing fancy.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kosjar Nikolai Kosjar
            thibaulltt Thibault de Villèle
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes