|
From: Dongsheng S. <don...@gm...> - 2010-07-19 03:21:01
|
PS:
If your source code only in main, then gprof does not out put anything of
your code.
For example, the following code:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int i;
for(i = 0; i < 1000000; i ++)
strtod("0.123", NULL);
return 0;
}
Profile out put like this (no main function):
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls Ts/call Ts/call name
20.48 0.17 0.17 __strtodg
15.66 0.30 0.13 dtoa_unlock
14.46 0.42 0.12 dtoa_lock
9.64 0.50 0.08 __lshift_D2A
7.23 0.56 0.06 __Balloc_D2A
7.23 0.62 0.06 __Bfree_D2A
6.02 0.67 0.05 __d2b_D2A
6.02 0.72 0.05 __diff_D2A
6.02 0.77 0.05 __strtod
2.41 0.79 0.02 __cmp_D2A
1.20 0.80 0.01 __mult_D2A
1.20 0.81 0.01 __multadd_D2A
1.20 0.82 0.01 __pow5mult_D2A
1.20 0.83 0.01 rvOK
But the following code:
#include <stdio.h>
#include <stdlib.h>
void test()
{
int i;
for(i = 0; i < 1000000; i ++)
strtod("0.123", NULL);
}
int main()
{
test();
return 0;
}
have useful out put like this (have test function):
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls Ts/call Ts/call name
19.48 0.15 0.15 __strtodg
18.18 0.29 0.14 dtoa_unlock
11.69 0.38 0.09 dtoa_lock
9.09 0.45 0.07 __Bfree_D2A
7.79 0.51 0.06 __copybits_D2A
5.19 0.55 0.04 __cmp_D2A
5.19 0.59 0.04 __strtod
3.90 0.62 0.03 __Balloc_D2A
3.90 0.65 0.03 __d2b_D2A
3.90 0.68 0.03 __diff_D2A
3.90 0.71 0.03 __multadd_D2A
2.60 0.73 0.02 __lshift_D2A
2.60 0.75 0.02 __s2b_D2A
1.30 0.76 0.01 __mult_D2A
1.30 0.77 0.01 rvOK
0.00 0.77 0.00 1 0.00 0.00 test
On Mon, Jul 19, 2010 at 10:51, Dongsheng Song <don...@gm...>wrote:
> Maybe this is a system clock resolution issue.
>
> Please check your clock resolution like this:
>
> http://live.sysinternals.com/Clockres.exe
>
> C:\var\download>clockres
>
> ClockRes v2.0 - View the system clock resolution
> Copyright (C) 2009 Mark Russinovich
> SysInternals - www.sysinternals.com
>
> Maximum timer interval: 15.625 ms
> Minimum timer interval: 1.000 ms
> Current timer interval: 0.977 ms
>
> As far as I know, profile very short running time is meaningless for
> gprof.
>
> On Mon, Jul 19, 2010 at 02:22, jayshankar nair <n_j...@ya...>wrote:
>
>> Hi,
>>
>> gprof (Bin utils 2.20) reports the %Time as 0.0 for source code
>> profiling. I
>> was wondering where i can download the correct binutils binaries with the
>> gprof
>> fixes. Please let me know.
>>
>> Thanks,
>> Jay
>>
>>
>> Sample Output:
>>
>>
>> Flat profile:
>> Each sample counts as 0.01 seconds.
>> no time accumulated
>> % cumulative self self total
>> time seconds seconds calls Ts/call Ts/call name
>> 0.00 0.00 0.00 AddAtomA@4
>> 0.00 0.00 0.00 AddNumbers
>>
>> 0.00 0.00 0.00 ExitProcess@4
>> 0.00 0.00 0.00 FindAtomA@4
>> 0.00 0.00 0.00 GetAtomNameA@12
>> 0.00 0.00 0.00
>> SetUnhandledExceptionFilte
>>
>>
|