Web lists-archives.com

Re: [Mingw-users] Strange gprof results

Manolo to Anton Shepelev:

>>while  they  clearly  take different times to com-
>How do you know this? Have you measured times?

I measured the times manually, but here I do  it  in
the code:

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

   void genwait( unsigned t )
   {    clock_t before, after;
        unsigned i;
        char line[3];
        double time_sec;
        before = clock();
        for( i = 0; i < t; i++ )
        {    sprintf(line, "a");  }
        after = clock();
        time_sec = ((double)(after - before)) / CLOCKS_PER_SEC;
        printf( "%i cycles took %2.3g seconds.\n", t, time_sec );

   void wait1()
   {    genwait(100000000);  }

   void wait2()
   {    genwait(800000000);  }

   void wait3()
   {    genwait(1600000000);  }

   void WorkHard()
   {    int i=0;

And the program outputs different execution times:

   100000000 cycles took 0.344 seconds.
   800000000 cycles took 2.86 seconds.
   1600000000 cycles took 5.7 seconds.

The modified test sample is here:


but  gprof still shows the average time of about 2.7
seconds for each test run.

MinGW-users mailing list

This list observes the Etiquette found at 
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:
Also: mailto:mingw-users-request@xxxxxxxxxxxxxxxxxxxxx?subject=unsubscribe