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. QScintillna (Want to check memory usage of lines in following Qt code in a profiler tool

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

Scheduled Pinned Locked Moved Unsolved General and Desktop
qscintillna
2 Posts 2 Posters 573 Views 2 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.
  • Q Offline
    Q Offline
    Qt Enthusiast
    wrote on last edited by A Former User
    #1
    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.

    K 1 Reply Last reply
    0
    • Q Qt Enthusiast
      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.

      K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      @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.

      Vote the answer(s) that helped you to solve your issue(s)

      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