C/C++: Obtenir la date du processeur avec la fonction ‘clock()’

Author:

 date
{filelink=13335}

#include 
#include 

int main( )
{
	time_t debut, fin;
	clock_t ticks; long count;
   time(&debut);

   for (count = 0; count <= 50000000; count++)
  {
    if (count % 1000000 != 0) continue;
    ticks = clock( );
    printf("Pour un division de %ld million,"
           " Le temps utilisé par le processeur est: %0.2f secondes.n",  count / 1000000,
           (double)ticks/CLOCKS_PER_SEC);
  }

  time(&fin);
  printf("Temps d'exécution approximatif: %.0f secondes.n", difftime(fin, debut));
  return 0;
}

Leave a Reply

Your email address will not be published. Required fields are marked *