/[MITgcm]/MITgcm/eesupp/src/timer_stats.c
ViewVC logotype

Annotation of /MITgcm/eesupp/src/timer_stats.c

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (hide annotations) (download)
Tue Oct 10 00:10:08 2006 UTC (17 years, 7 months ago) by cnh
Branch: MAIN
CVS Tags: checkpoint59, checkpoint58y_post, checkpoint58t_post, checkpoint58w_post, checkpoint58q_post, mitgcm_mapl_00, checkpoint58r_post, checkpoint59e, checkpoint59d, checkpoint59g, checkpoint59f, checkpoint59a, checkpoint59c, checkpoint59b, checkpoint59h, checkpoint58v_post, checkpoint58x_post, checkpoint58u_post, checkpoint58s_post
Changes since 1.2: +4 -4 lines
File MIME type: text/plain
Changing routine names to avoid mangled name mangling and adding
in Mark Hadfield fix for -ignoretime genmake2 option.

1 heimbach 1.1 #include <sys/types.h>
2     #include <sys/times.h>
3     #include <sys/time.h>
4 ce107 1.2 #include <unistd.h>
5     /* Here, we get the definition of the FC_NAMEMANGLE() macro. */
6     #include "FC_NAMEMANGLE.h"
7    
8     static long clktck = 0;
9     static double invclktck = 0.0;
10    
11 cnh 1.3 double FC_NAMEMANGLE(cusertime) (void);
12     double FC_NAMEMANGLE(csystemtime) (void);
13 ce107 1.2 double FC_NAMEMANGLE(timenow) ();
14     void init_timer();
15 heimbach 1.1
16 ce107 1.2 void init_timer()
17     {
18     clktck = sysconf(_SC_CLK_TCK);
19     invclktck = 1.0/clktck;
20     return;
21     }
22 heimbach 1.1
23 cnh 1.3 double FC_NAMEMANGLE(cusertime) (void)
24 heimbach 1.1 {
25     clock_t blabla;
26     struct tms timest;
27 ce107 1.2 /* This is useless overhead but we'd need to call init_timer() elsewhere */
28     if (clktck == 0) init_timer();
29    
30 heimbach 1.1 blabla = times(&timest);
31 ce107 1.2 return invclktck*timest.tms_utime;
32 heimbach 1.1
33     }
34    
35 cnh 1.3 double FC_NAMEMANGLE(csystemtime) (void)
36 heimbach 1.1 {
37     clock_t blabla;
38     struct tms timest;
39 ce107 1.2 /* This is useless overhead but we'd need to call init_timer() elsewhere */
40     if (clktck == 0) init_timer();
41 heimbach 1.1
42     blabla = times(&timest);
43 ce107 1.2 return invclktck*timest.tms_stime;
44 heimbach 1.1
45     }
46    
47    
48    
49 ce107 1.2 double FC_NAMEMANGLE(timenow) (void)
50 heimbach 1.1 {
51     struct timeval timestr;
52     void *Tzp=0;
53     gettimeofday(&timestr, Tzp);
54    
55     return (double)timestr.tv_sec+1.0E-06*(double)timestr.tv_usec;
56     }
57    

  ViewVC Help
Powered by ViewVC 1.1.22