Author Topic: Code Profiler: Problem with gprof under WINDOWS  (Read 4915 times)

Offline zak

  • Multiple posting newcomer
  • *
  • Posts: 26
Code Profiler: Problem with gprof under WINDOWS
« on: June 07, 2008, 08:03:42 pm »
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

Code
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

Code
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
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




Offline zak

  • Multiple posting newcomer
  • *
  • Posts: 26
Re: Code Profiler: Problem with gprof under WINDOWS
« Reply #1 on: June 08, 2008, 01:49:37 pm »
Help me please!

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: Code Profiler: Problem with gprof under WINDOWS
« Reply #2 on: June 10, 2008, 04:40:55 am »
Are you a developer of the Code::Blocks plugin?

If not, then this is the wrong sub-forum. I suggest posting elsewhere.
Quote
C::B DEVELOPMENT STRICTLY!

Tim S
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline zak

  • Multiple posting newcomer
  • *
  • Posts: 26
Re: Code Profiler: Problem with gprof under WINDOWS
« Reply #3 on: June 10, 2008, 10:35:32 am »

I already do it.

Sorry.