Results 1 to 20 of 24

Thread: Profiling problems

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Profiling problems

    You should add the flag in your project file to the variable called QMAKE_CXXFLAGS_DEBUG.

  2. The following user says thank you to wysota for this useful post:

    Tindor (24th December 2006)

  3. #2
    Join Date
    Jul 2006
    Posts
    7
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11
    Thanks
    5

    Default Re: Profiling problems

    Well, I added it, but it stil does not create gmon.out.
    I also noticed this in the Makefile:
    Qt Code:
    1. DEFINES = -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED
    To copy to clipboard, switch view to plain text mode 
    And when I remove it and try "make" it's put in there again, maybe that's the problem.

  4. #3
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts

    Default Re: Profiling problems

    Looks like you are compiling a release version. Also, you must compile and link it with the corresponding profiling flags.

    QMAKE_CXXFLAGS_DEBUG *= -pg
    QMAKE_LFLAGS_DEBUG *= -pg
    $ qmake -config debug
    $ make
    J-P Nurmi

  5. The following 2 users say thank you to jpn for this useful post:

    Tindor (24th December 2006), vfernandez (4th January 2007)

  6. #4
    Join Date
    Jul 2006
    Posts
    7
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11
    Thanks
    5

    Default Re: Profiling problems

    Well, now I can debug the program with gdb , but still no gmon.out is created

  7. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Profiling problems

    Does the compilation run with -pg compiler flags? Did you recreate the Makefile after modyfiing the project file?

  8. The following user says thank you to wysota for this useful post:

    Tindor (24th December 2006)

  9. #6
    Join Date
    Jul 2006
    Posts
    7
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11
    Thanks
    5

    Default Re: Profiling problems

    It does, here's the code:
    g++ -c -pipe -g -pg -pg -Wall -W -D_REENTRANT -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/include/qt4/QtOpenGL -I/usr/include/qt4 -I. -I/usr/include -I. -I. -o main.o main.cpp
    Also, the makefile is supposed to be regenerated afer running qmake, am I wrong?
    Last edited by jacek; 24th December 2006 at 01:11. Reason: changed [code] to [quote]

  10. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: Profiling problems

    How do you start that application? gmon.out will be generated in the current directory and only if your application exits cleanly.

    Check if you can generate gmon.out for this small example:
    Qt Code:
    1. #include <QApplication>
    2. #include <QPushButton>
    3.  
    4. int main( int argc, char **argv )
    5. {
    6. QApplication app( argc, argv );
    7.  
    8. QPushButton b( "Close" );
    9. QObject::connect( &b, SIGNAL( clicked() ), &b, SLOT( close() ) );
    10. b.show();
    11.  
    12. return app.exec();
    13. }
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. ######################################################################
    2. # Automatically generated by qmake (2.00a) nie gru 24 01:16:45 2006
    3. ######################################################################
    4.  
    5. TEMPLATE = app
    6. TARGET +=
    7. DEPENDPATH += .
    8. INCLUDEPATH += .
    9.  
    10. CONFIG += debug
    11. QMAKE_CXXFLAGS_DEBUG *= -pg
    12. QMAKE_LFLAGS_DEBUG *= -pg
    13.  
    14. # Input
    15. SOURCES += main.cpp
    To copy to clipboard, switch view to plain text mode 

    $ ls
    main.cpp prof.pro
    $ qmake
    $ make
    ...
    $ ls
    main.cpp main.o Makefile prof prof.pro
    $ ./prof
    $ ls
    gmon.out main.cpp main.o Makefile prof prof.pro

  11. The following 2 users say thank you to jacek for this useful post:

    lit-uriy (24th January 2009), Tindor (24th December 2006)

  12. #8
    Join Date
    Jul 2006
    Posts
    7
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11
    Thanks
    5

    Default Re: Profiling problems

    Oops, I'm sorry I made you write the code. I've forgotten that I had to run the app in order to get a gmon.out.
    Thank you very much !

  13. #9
    Join Date
    Jun 2007
    Posts
    52
    Thanks
    6

    Default Re: Profiling problems

    I am having a similar issue. My program is a very large program and I created my own shared libraries, but when I try to compile them with the -pg flag set in QMAKE_CXXFLAGS_DEBUG and in QMAKE_LFLAGS_DEBUG and then run it I don't get the gmon.out.

    It is exiting normally and I have it set so that all the shared libraries are building with the flags. Any ideas?

  14. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Profiling problems

    This is a known issue with gprof. Please google around for using gprof with shared object files or use a different profiler such as Valgrind's callgrind tool.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  15. #11
    Join Date
    Jun 2007
    Posts
    52
    Thanks
    6

    Default Re: Profiling problems

    gprof is the reason I don't get the gmon.out file? I thought that was part of the gcc

  16. #12
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Profiling problems

    It's part of gcc but it's made for gprof. You'll find solutions much quicker if you google for "gprof and shared object files" than for "gcc and shared object files". And the file should be generated. It might be meaningless but it should get generated. Are you sure you linked with the -pg flag as well?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Problems customizing QSlider
    By Antrax in forum Qt Programming
    Replies: 13
    Last Post: 20th December 2011, 08:00
  2. Problems with Unicode(UTF8)
    By cristiano in forum Qt Programming
    Replies: 15
    Last Post: 5th December 2006, 13:33
  3. QGLWidget Problems
    By ToddAtWSU in forum Qt Programming
    Replies: 1
    Last Post: 2nd October 2006, 23:06
  4. Problems
    By euthymos in forum Installation and Deployment
    Replies: 2
    Last Post: 13th June 2006, 20:11
  5. QT4 Plugins - problems, problems
    By NormanDunbar in forum Qt Programming
    Replies: 6
    Last Post: 9th May 2006, 16:39

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.