| 
            Last change
 on this file since 2739 was             1572, checked in by ansari, 24 years ago           | 
        
        
          | 
             
declaration de const char * pour PrtTim() - Reza 12/7/2001 
 
           | 
        
        
          | 
            File size:
            1.0 KB
           | 
        
      
      
| Line |   | 
|---|
| 1 | /*    Fonction d'impression de temps de calcul et de temps passe  */
 | 
|---|
| 2 | /*                               R.Ansari    Juin 93              */
 | 
|---|
| 3 |  
 | 
|---|
| 4 | #include <stdlib.h>
 | 
|---|
| 5 | #include <stdio.h>
 | 
|---|
| 6 | #include <string.h>
 | 
|---|
| 7 | #include <time.h>
 | 
|---|
| 8 |  
 | 
|---|
| 9 | clock_t CPUT0, CPUT;
 | 
|---|
| 10 | time_t ELT0, ELT;
 | 
|---|
| 11 |  
 | 
|---|
| 12 | void InitTim(void);
 | 
|---|
| 13 | void PrtTim(const char *Comm);
 | 
|---|
| 14 |  
 | 
|---|
| 15 | /* Nouvelle-Fonction */
 | 
|---|
| 16 | void InitTim(void)
 | 
|---|
| 17 | {
 | 
|---|
| 18 | CPUT0 = CPUT = clock();
 | 
|---|
| 19 | ELT0 = ELT = time(NULL);
 | 
|---|
| 20 | return;
 | 
|---|
| 21 | }
 | 
|---|
| 22 |  
 | 
|---|
| 23 | /* Nouvelle-Fonction */
 | 
|---|
| 24 | void PrtTim(const char *Comm)
 | 
|---|
| 25 | {
 | 
|---|
| 26 | float tcal,tcalt;
 | 
|---|
| 27 | clock_t cput;
 | 
|---|
| 28 | time_t elt;
 | 
|---|
| 29 | int etm,etmt;
 | 
|---|
| 30 |  
 | 
|---|
| 31 | elt = time(NULL);  cput = clock();
 | 
|---|
| 32 | tcalt = ( (float)(cput) - (float)(CPUT0) ) / (float)(CLOCKS_PER_SEC);
 | 
|---|
| 33 | tcal = ( (float)(cput) - (float)(CPUT) ) / (float)(CLOCKS_PER_SEC);
 | 
|---|
| 34 | etm = elt - ELT;
 | 
|---|
| 35 | etmt = elt - ELT0;
 | 
|---|
| 36 | printf("%s CPUTime: Total= %g  (Partial= %g) Sec. \n",
 | 
|---|
| 37 |        Comm, tcalt, tcal);
 | 
|---|
| 38 | printf("ElapsedTime(hh:mm:ss): Total= %02d:%02d:%02d ",
 | 
|---|
| 39 |        etmt/3600, (etmt%3600)/60, etmt%60);
 | 
|---|
| 40 | printf(" (Partial= %02d:%02d:%02d)\n",
 | 
|---|
| 41 |        etm/3600, (etm%3600)/60, etm%60);
 | 
|---|
| 42 |  
 | 
|---|
| 43 | ELT = elt;
 | 
|---|
| 44 | CPUT = cput;
 | 
|---|
| 45 | return;
 | 
|---|
| 46 | }
 | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.