source: Sophya/trunk/Eval/Speed/timing.c@ 1867

Last change on this file since 1867 was 1572, checked in by ansari, 24 years ago

declaration de const char * pour PrtTim() - Reza 12/7/2001

File size: 1.0 KB
RevLine 
[991]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
9clock_t CPUT0, CPUT;
10time_t ELT0, ELT;
11
12void InitTim(void);
[1572]13void PrtTim(const char *Comm);
[991]14
15/* Nouvelle-Fonction */
16void InitTim(void)
17{
18CPUT0 = CPUT = clock();
19ELT0 = ELT = time(NULL);
20return;
21}
22
23/* Nouvelle-Fonction */
[1572]24void PrtTim(const char *Comm)
[991]25{
26float tcal,tcalt;
27clock_t cput;
28time_t elt;
29int etm,etmt;
30
31elt = time(NULL); cput = clock();
32tcalt = ( (float)(cput) - (float)(CPUT0) ) / (float)(CLOCKS_PER_SEC);
33tcal = ( (float)(cput) - (float)(CPUT) ) / (float)(CLOCKS_PER_SEC);
34etm = elt - ELT;
35etmt = elt - ELT0;
36printf("%s CPUTime: Total= %g (Partial= %g) Sec. \n",
37 Comm, tcalt, tcal);
38printf("ElapsedTime(hh:mm:ss): Total= %02d:%02d:%02d ",
39 etmt/3600, (etmt%3600)/60, etmt%60);
40printf(" (Partial= %02d:%02d:%02d)\n",
41 etm/3600, (etm%3600)/60, etm%60);
42
43ELT = elt;
44CPUT = cput;
45return;
46}
Note: See TracBrowser for help on using the repository browser.