Web lists-archives.com

[Mingw-users] Strange gprof results




Hello, all

I am learning gprof in MinGW and cannot seem to make
it report correct execution times.  I  am  profiling
the follwing simple code:

   #include "test.h"
   #include <stdlib.h>
   #include <stdio.h>

   void genwait( unsigned t )
   {    unsigned i;
        char line[3];
        for( i = 0; i < t; i++ )
        {    sprintf(line, "a");  }
   }

   void wait1()
   {    genwait(100000000);  }

   void wait2()
   {    genwait(800000000);  }

   void wait3()
   {    genwait(1600000000);  }

   void WorkHard()
   {    int i=0;
        wait1();
        wait2();
        wait3();
   }

and grpof reports that the wait<n> functions:

   index % time    self  children    called     name
   -----------------------------------------------
                   0.00    2.74       1/1           WorkHard [2]
   [4]     33.3    0.00    2.74       1         wait1 [4]
                   2.74    0.00       1/3           genwait [1]
   -----------------------------------------------
                   0.00    2.74       1/1           WorkHard [2]
   [5]     33.3    0.00    2.74       1         wait2 [5]
                   2.74    0.00       1/3           genwait [1]
   -----------------------------------------------
                   0.00    2.74       1/1           WorkHard [2]
   [6]     33.3    0.00    2.74       1         wait3 [6]
                   2.74    0.00       1/3           genwait [1]
   -----------------------------------------------

while they clearly take different times to complete.
I am compiling this  code  with  optimizations  off:
-O0.   My  full setup including the Makefile is here
on Google Drive:

         http://preview.tinyurl.com/hda7sez

Beware my dangerous 'clean' target which will delete
all executables in the current directory and below.

If  it  be a blunder of mine rather than a MinGW-re-
lated problem, please accept my apologies.

-- 
()  ascii ribbon campaign - against html e-mail
/\  http://preview.tinyurl.com/qcy6mjc [archived]


------------------------------------------------------------------------------
_______________________________________________
MinGW-users mailing list
MinGW-users@xxxxxxxxxxxxxxxxxxxxx

This list observes the Etiquette found at 
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:mingw-users-request@xxxxxxxxxxxxxxxxxxxxx?subject=unsubscribe