QScintillna (Want to check memory usage of lines in following Qt code in a profiler tool



  • void GQSciEdit::loadSourceFile(const QString& ofilename)
    

    {
    if (ofilename.isEmpty()) {
    setText("<EMPTY FILE>");
    filename = "";
    return;
    }

     if (ofilename.endsWith(".gpg") || ofilename.endsWith(".odb")) {
       setText("<ENCRYPTED FILE>");
       filename = "";
       return;
     }
    
     if (filename != ofilename) {
       QString msg = QString("Loaded file %1").arg(ofilename);
         if (FILE* fp = UFile::open(ofilename.toLatin1(), "r")) {
       QTextStream ts(fp, QIODevice::ReadOnly);
           setText(ts.readAll());
       setModified(FALSE);
       UFile::close(fp);
       d_filename = ofilename;
       emit fileNameChanged(ofilename);
          }
       }
    }
    

    I want to check memory usage of following line in above code setText(ts.readAll()); Can some one tell me the tool for it

    [edit: koahnig] Added some spaces for code visualisation.


  • Moderators

    @Qt-Enthusiast

    Profilers are typically dependent on OS. You may have a look to gprof

    On the other hand profilers eat a lot of CPU. Therefore do not try it on your large file. Probably it is much easier for you to measure time and required time with QElapsedTimer.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.