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
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
Tindor (24th December 2006), vfernandez (3rd January 2007)
Well, now I can debug the program with gdb , but still no gmon.out is created![]()
Does the compilation run with -pg compiler flags? Did you recreate the Makefile after modyfiing the project file?
Tindor (24th December 2006)
It does, here's the code:
Also, the makefile is supposed to be regenerated afer running qmake, am I wrong?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
Last edited by jacek; 24th December 2006 at 00:11. Reason: changed [code] to [quote]
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:
#include <QApplication> #include <QPushButton> int main( int argc, char **argv ) { b.show(); return app.exec(); }To copy to clipboard, switch view to plain text mode
Qt Code:
###################################################################### # Automatically generated by qmake (2.00a) nie gru 24 01:16:45 2006 ###################################################################### TEMPLATE = app TARGET += DEPENDPATH += . INCLUDEPATH += . CONFIG += debug QMAKE_CXXFLAGS_DEBUG *= -pg QMAKE_LFLAGS_DEBUG *= -pg # Input SOURCES += main.cppTo 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
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 !![]()
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?
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.
gprof is the reason I don't get the gmon.out file? I thought that was part of the gcc
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?
Bookmarks