免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2308 | 回复: 2
打印 上一主题 下一主题

程序运行时间分析问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-02-13 11:52 |只看该作者 |倒序浏览
大家好,我在cygwin下将我的程序(包含诸多.c和.cpp),用gprof分析代码运行时间。gprof生成的结果有点问题,其中很多函数的调用次数等字段是空的。请看下面

Flat   profile:

Each   sample   counts   as   0.01   seconds.
    %       cumulative       self                             self           total                       
  time       seconds       seconds         calls     Ts/call     Ts/call     name         
  69.09             2.28           2.28                                                           fft
    5.76             2.47           0.19                                                           xdvfftfiltm
    3.64             2.59           0.12                                                           dviinit
    3.64             2.71           0.12                                                           xdvinit(double,   double,   double)
    3.33             2.82           0.11                                                           dvoper
    2.73             2.91           0.09                                                           simple_random()
    2.12             2.98           0.07                                                           RFFT(double*,   double*,   int,   int)
    1.82             3.04           0.06                                                           cexp(double*,   double*)
    1.21             3.08           0.04                                                           FFT(double*,   double*,   int,   int)
    1.21             3.12           0.04                                                           CAPM::Recover(CDataMatrix*,   CDataMatrix*)
    0.91             3.15           0.03                                                           dvcopy
    0.91             3.18           0.03                                                           sin
    0.61             3.20           0.02                                                           ss_xfractpitchtbl(long)
    0.61             3.22           0.02                                                           xdmcutrow
    0.61             3.24           0.02                                                           exp
    0.30             3.25           0.01                                                           ss_ceptompc(DVECTOR_STRUCT*,   long)
    0.30             3.26           0.01                                                           CDMConv2DMat(CDataMatrix*)
    0.30             3.27           0.01                                                           simple_gnoise(double)
    0.30             3.28           0.01                                                           ss_xgetgrpdlyNew
    0.30             3.29           0.01                                                           dvpaste
    0.30             3.30           0.01                                                           xdvcplx
    0.00             3.30           0.00                 1           0.00           0.00     straight_synth_tb06


上述结果有些函数的参数信息被我手动删掉了。

大家看很多函数的call,self   call等字段都是空的。至少应该显示为0阿,这是什么原因呢。
本人用makefile编译的。makefile中编译选项如下

CXX   =   g++
CXXFLAGS   =   -O   -Wall   -pg
CPU   =   linux

用makefile   生成exe后在cygwin下运行exe步骤如下:
./straight_mceplsf.exe   -lsf   -warp   1500   -order   40   -shift   5   -f0file   /cygdrive/e
/hts/gen/00000001.f0   -syn   /cygdrive/e/hts/gen/00000001.mcp   /cygdrive/e/hts/gen/
00000001.wav

gprof   straight_mceplsf.exe   gmon.out   >   res.txt

请问我的操作步骤中有什么问题么?请指出?另外一个问题,gprof受到计算机中其他运行的进程的影响后会增加代码运行时间么?我系统中运行的进程不同的时候运行结果不一样啊?怎么样让gprof不受到其他进程的影响呢?请指教,谢谢!

论坛徽章:
0
2 [报告]
发表于 2008-02-13 12:48 |只看该作者
about timing program's profile, it's a complex issue, maybe you can refer <<Computer Systems - A Programmer's Perspective>>

论坛徽章:
0
3 [报告]
发表于 2008-02-13 14:13 |只看该作者

回复 #2 rockins 的帖子

thank you for the reference.

the gprof make help in some extent,maybe  there is problem in the way i use gprof
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP