| 
            Last change
 on this file since 3836 was             2362, checked in by ansari, 23 years ago           | 
        
        
          
            
Creation du module JET, Test / evaluation de Expressions Template 
 
Reza 17 Avril 2003  
 
 
 
           | 
        
        
          | 
            File size:
            1.1 KB
           | 
        
      
      
| Rev | Line |   | 
|---|
| [2362] | 1 | 
 | 
|---|
 | 2 | #include <stdlib.h>
 | 
|---|
 | 3 | #include <stdio.h>
 | 
|---|
 | 4 | #include <string.h>
 | 
|---|
 | 5 | #include <time.h>
 | 
|---|
 | 6 | 
 | 
|---|
 | 7 | 
 | 
|---|
 | 8 | static clock_t CPUT0, CPUT;
 | 
|---|
 | 9 | static time_t ELT0, ELT;
 | 
|---|
 | 10 |  
 | 
|---|
 | 11 |  
 | 
|---|
 | 12 | /* Nouvelle-Fonction */
 | 
|---|
 | 13 | /*!
 | 
|---|
 | 14 |    \ingroup SysTools
 | 
|---|
 | 15 |    Initializes CPU and elapsed time timer (C function).
 | 
|---|
 | 16 |    The values of the CPU and elapsed time can then be printed 
 | 
|---|
 | 17 |    using \b PrtTim() 
 | 
|---|
 | 18 | */
 | 
|---|
 | 19 | void finittim_(void)
 | 
|---|
 | 20 | {
 | 
|---|
 | 21 | CPUT0 = CPUT = clock();
 | 
|---|
 | 22 | ELT0 = ELT = time(NULL);
 | 
|---|
 | 23 | return;
 | 
|---|
 | 24 | }
 | 
|---|
 | 25 |  
 | 
|---|
 | 26 | /* Nouvelle-Fonction */
 | 
|---|
 | 27 | /*!
 | 
|---|
 | 28 |    \ingroup SysTools
 | 
|---|
 | 29 |    Prints the values of the CPU and elapsed time, since call to \b InitTim().
 | 
|---|
 | 30 | */
 | 
|---|
 | 31 | void fprttim_(int * num)
 | 
|---|
 | 32 | {
 | 
|---|
 | 33 | float tcal,tcalt;
 | 
|---|
 | 34 | clock_t cput;
 | 
|---|
 | 35 | time_t elt;
 | 
|---|
 | 36 | int etm,etmt;
 | 
|---|
 | 37 |  
 | 
|---|
 | 38 | elt = time(NULL);  cput = clock();
 | 
|---|
 | 39 | tcalt = ( (float)(cput) - (float)(CPUT0) ) / (float)(CLOCKS_PER_SEC);
 | 
|---|
 | 40 | tcal = ( (float)(cput) - (float)(CPUT) ) / (float)(CLOCKS_PER_SEC);
 | 
|---|
 | 41 | etm = elt - ELT;
 | 
|---|
 | 42 | etmt = elt - ELT0;
 | 
|---|
 | 43 | printf("FPrtTim[%d] CPUTime: Total= %g  (Partial= %g) Sec. \n",
 | 
|---|
 | 44 |        *num, tcalt, tcal);
 | 
|---|
 | 45 | printf("ElapsedTime(hh:mm:ss): Total= %02d:%02d:%02d ",
 | 
|---|
 | 46 |        etmt/3600, (etmt%3600)/60, etmt%60);
 | 
|---|
 | 47 | printf(" (Partial= %02d:%02d:%02d)\n",
 | 
|---|
 | 48 |        etm/3600, (etm%3600)/60, etm%60);
 | 
|---|
 | 49 |  
 | 
|---|
 | 50 | ELT = elt;
 | 
|---|
 | 51 | CPUT = cput;
 | 
|---|
 | 52 | return;
 | 
|---|
 | 53 | }
 | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.