MinGW gprof结果不准确?

时间:2011-11-01 11:24:14

标签: profiling mingw gprof

我一直在使用gprof在Linux(Ubuntu 11.04)和Windows(7,MinGW的最新版本)上编译程序,每次都使用相同的数据集或相同的程序,并获得显着不同的结果。 (显而易见的是,它们会导致关于代码的哪个部分需要优化的不同结论。)

在两个系统上结果可能是合理的不同,但我还必须考虑一个结果集不准确且应该被忽略的可能性,并且先验一个是MinGW的可能性更大,因为gprof更少在Windows上进行了广泛的测试而不是在Linux上。对该结论的一个更强有力的论据是,Windows上的结果看起来非常奇怪:

  %   cumulative   self              self     total           
 time   seconds   seconds    calls  us/call  us/call  name    
 27.43      1.13     1.13 68589813     0.02     0.02  addt
 21.48      2.02     0.89                             tok
 19.17      2.81     0.79                             hash
  9.95      3.21     0.41                             slot
  7.89      3.54     0.33                             nextx
  4.85      3.74     0.20                             next
  3.52      3.88     0.14 27809047     0.01     0.01  get
  0.85      3.92     0.04                             eol
  0.73      3.95     0.03                             __mingw_pformat
  0.73      3.98     0.03                             ch
  0.73      4.01     0.03                             tokx
  0.49      4.03     0.02                             slot
  0.49      4.05     0.02                             tok
  0.24      4.06     0.01   166896     0.06     0.06  mk2
  0.24      4.07     0.01     6693     1.49     1.49  initt
  0.24      4.08     0.01                             __pformat_putchars
  0.24      4.09     0.01                             hashs
  0.24      4.10     0.01                             pop
  0.24      4.11     0.01                             quoted
  0.12      4.12     0.01                             eat
  0.12      4.12     0.01                             expand
  0.00      4.12     0.00 145841014     0.00     0.00  initparse

存在很多差距,然后initparse,这是一个只调用一次的初始化函数,几乎没有其他任何东西,被报告为被称为一亿四千五百万次。

我应该忽略Windows的结果,只使用Linux中的结果吗?或者,在Windows上调用不会影响百分比时间结果的呼叫数量是否存在问题?或者我误读了输出或者误用了工具?

0 个答案:

没有答案