Chinaunix首页 | 论坛 | 博客
  • 博客访问: 402055
  • 博文数量: 103
  • 博客积分: 3073
  • 博客等级: 中校
  • 技术积分: 1078
  • 用 户 组: 普通用户
  • 注册时间: 2010-03-23 15:04
文章分类

全部博文(103)

文章存档

2012年(13)

2011年(76)

2010年(14)

分类: LINUX

2010-03-23 15:09:53

13.5 gprof doesn't produce output

Q: Every time I run the profiler it says "gmon.out: no such file or directory" and no profile is produced. What is this gmon.out file, and why won't gprof compute the profile?

A: gmon.out is the file with raw execution counts and timing info that gprof needs to produce the profile. The file is written by the profiled program when it exits. If the file isn't created, it might be because of one of the following reasons:

  • You didn't compile and/or link your program with the -pg switch. Note that both compilation and link need to be done with -pg, because the functions that actually write the results to gmon.out are only linked in when GCC sees -pg on the link command line.
  • You have called ld.exe directly to link your program and forgot to mention the files and switches necessary for the profiled program operation. You should use gcc to link your program instead of calling the linker directly; a -pg switch to gcc is all that it takes to make sure that the linker will get all the necessary arguments.
  • Your program exited abnormally. The function which generates gmon.out is registered with the atexit library function, and won't be called if the program was terminated in an abnormal way. Make sure that your program exits with a call to exit library function or with a return statement in your main function. For example, if your program dies with an exception or a signal, you need to install a handler for that signal and make it call exit.
references:
阅读(2574) | 评论(0) | 转发(0) |
0

上一篇:没有了

下一篇:events of AMD 64 family 10

给主人留下些什么吧!~~