source: Sophya/trunk/Eval/JET/ftim.c@ 4016

Last change on this file since 4016 was 2363, checked in by ansari, 22 years ago

This commit was generated by cvs2svn to compensate for changes in r2362,
which included commits to RCS files with non-trunk default branches.

File size: 1.1 KB
Line 
1
2#include <stdlib.h>
3#include <stdio.h>
4#include <string.h>
5#include <time.h>
6
7
8static clock_t CPUT0, CPUT;
9static 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*/
19void finittim_(void)
20{
21CPUT0 = CPUT = clock();
22ELT0 = ELT = time(NULL);
23return;
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*/
31void fprttim_(int * num)
32{
33float tcal,tcalt;
34clock_t cput;
35time_t elt;
36int etm,etmt;
37
38elt = time(NULL); cput = clock();
39tcalt = ( (float)(cput) - (float)(CPUT0) ) / (float)(CLOCKS_PER_SEC);
40tcal = ( (float)(cput) - (float)(CPUT) ) / (float)(CLOCKS_PER_SEC);
41etm = elt - ELT;
42etmt = elt - ELT0;
43printf("FPrtTim[%d] CPUTime: Total= %g (Partial= %g) Sec. \n",
44 *num, tcalt, tcal);
45printf("ElapsedTime(hh:mm:ss): Total= %02d:%02d:%02d ",
46 etmt/3600, (etmt%3600)/60, etmt%60);
47printf(" (Partial= %02d:%02d:%02d)\n",
48 etm/3600, (etm%3600)/60, etm%60);
49
50ELT = elt;
51CPUT = cput;
52return;
53}
Note: See TracBrowser for help on using the repository browser.