Re: Can't use gprof
- From: "guenther@xxxxxxxxx" <guenther@xxxxxxxxx>
- Date: Wed, 13 Jun 2007 21:39:51 -0000
On Jun 13, 12:09 pm, desktop <f...@xxxxxxx> wrote:
....
Ups I have correct that error but I still get the same error when trying
to run
gprof -b main gmon.out > results.txt
The gmon.out file is supposed to be created by the executable itself.
The -pg compiler option results in code being added to your program
such that when it calls exit() or returns from main(), the profiling
code takes control and writes out the profiling data to the file
gmon.out. Only then, after having run your program, can you then run
gprof on the generated gmon.out file.
To review:
1) build program using -pg option both when compiling and linking
(the output of make should confirm whether you have this correct)
2) run program, exercising the code that you want to profile and
bringing the program to a normal exit (you won't get any profile
output if the program dies from a signal)
3) run gprof
Programs that use chdir() or fork() or change UID or GID have
additional complications: the gmon.out file is created in the
process's current directory when exit() is called. If the process
doesn't have permission to create and or write to that file, then it
won't be generated. Processes that fork() and then call exit() in
more than on process can overwrite or corrupt the gmon.out file.
Philip Guenther
.
- References:
- Can't use gprof
- From: desktop
- Re: Can't use gprof
- From: Lew Pitcher
- Re: Can't use gprof
- From: desktop
- Can't use gprof
- Prev by Date: Re: accept() source code
- Next by Date: trace dlopen/dlsym
- Previous by thread: Re: Can't use gprof
- Next by thread: Re: Can't use gprof
- Index(es):
Relevant Pages
|
|