I have some problem with gprof under WINDOWS
with C:B 5082.
I remember that it has worked in the past..
This is the wrong result of my test code under WINDOWS XP
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 500 0.00 0.00 f(int)
0.00 0.00 0.00 500 0.00 0.00 g(int)
.
.
.
granularity: each sample hit covers 0 byte(s) no time propagated
index % time self children called name
0.00 0.00 500/500 _main [53]
[3] 0.0 0.00 0.00 500 f(int) [3]
-----------------------------------------------
0.00 0.00 500/500 _main [53]
[4] 0.0 0.00 0.00 500 g(int) [4]
-----------------------------------------------
and this is the correct version under LINUX
where it works fine
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls ms/call ms/call name
79.66 0.47 0.47 250 1.88 1.88 f(int)
20.34 0.59 0.12 250 0.48 0.48 g(int)
.
,
,
granularity: each sample hit covers 4 byte(s) for 1.69% of 0.59 seconds
index % time self children called name
<spontaneous>
[1] 100.0 0.00 0.59 main [1]
0.47 0.00 250/250 f(int) [2]
0.12 0.00 250/250 g(int) [3]
-----------------------------------------------
0.47 0.00 250/250 main [1]
[2] 79.7 0.47 0.00 250 f(int) [2]
-----------------------------------------------
0.12 0.00 250/250 main [1]
[3] 20.3 0.12 0.00 250 g(int) [3]
-----------------------------------------------
Here i put the test code
#include <sys/time.h>
#define rdtscll(val) asm volatile("rdtsc" : "=A" (val))
struct timeval tv;
unsigned long long t;
void f (int n)
{
int x, y, z = 0;
for (x = 0; x < n; x++)
for (y = 0; y < n; y++) {
z += x * y;
rdtscll (t);
}
}
void g (int n)
{
int x, y, z = 0;
for (x = 0; x < n; x++)
for (y = 0; y < n; y++) {
z += x * y;
gettimeofday (&tv, 0);
}
}
int main (int argc, char *argv[])
{
int n;
for (n = 0; n < 500; n++) {
if (n % 2)
f (n);
else
g (n);
}
return 0;
}
Where is the problem?? I miss some library or what???
Any help is appreciated.
Thanks very much, Zak