6
<meta name="generator" content="c2html 0.9.1">
7
<meta name="date" content="2002-05-31T15:59:33+00:00">
6
<meta name="generator" content="c2html 0.9.4">
7
<meta name="date" content="2004-02-27T19:57:02+00:00">
10
10
<body bgcolor="#FFFFFF">
39
39
<a name="line31"> 31: </a><font color="#B22222"> PetscLogDouble v;</font>
40
40
<a name="line32"> 32: </a><font color="#B22222"> PetscTime(v);</font>
41
41
<a name="line33"> 33: </a><font color="#B22222"> .... perform some calculation ...</font>
42
<a name="line34"> 34: </a><font color="#B22222"> printf("Time for operation %gn",v);</font>
42
<a name="line34"> 34: </a><font color="#B22222"> printf("Time for operation %g\n",v);</font>
44
44
<a name="line36"> 36: </a><font color="#B22222"> Notes:</font>
45
45
<a name="line37"> 37: </a><font color="#B22222"> Since the PETSc libraries incorporate timing of phases and operations, </font>
130
130
<a name="line122">122: </a>EXTERN_C_END
133
<a name="line125">125: </a><strong><font color="#228B22">#define PetscTime(v) {static struct timespec _tp; </font></strong>
134
<a name="line126">126: </a><strong><font color="#228B22"> getclock(TIMEOFDAY,&_tp); </font></strong>
133
<a name="line125">125: </a><strong><font color="#228B22">#define PetscTime(v) {static struct timespec _tp; \</font></strong>
134
<a name="line126">126: </a><strong><font color="#228B22"> getclock(TIMEOFDAY,&_tp); \</font></strong>
135
135
<a name="line127">127: </a><strong><font color="#228B22"> (v)=((PetscLogDouble)_tp.tv_sec)+(1.0e-9)*(_tp.tv_nsec);}</font></strong>
137
<a name="line129">129: </a><strong><font color="#228B22">#define PetscTimeSubtract(v) {static struct timespec _tp; </font></strong>
138
<a name="line130">130: </a><strong><font color="#228B22"> getclock(TIMEOFDAY,&_tp); </font></strong>
137
<a name="line129">129: </a><strong><font color="#228B22">#define PetscTimeSubtract(v) {static struct timespec _tp; \</font></strong>
138
<a name="line130">130: </a><strong><font color="#228B22"> getclock(TIMEOFDAY,&_tp); \</font></strong>
139
139
<a name="line131">131: </a><strong><font color="#228B22"> (v)-=((PetscLogDouble)_tp.tv_sec)+(1.0e-9)*(_tp.tv_nsec);}</font></strong>
141
<a name="line133">133: </a><strong><font color="#228B22">#define PetscTimeAdd(v) {static struct timespec _tp; </font></strong>
142
<a name="line134">134: </a><strong><font color="#228B22"> getclock(TIMEOFDAY,&_tp); </font></strong>
141
<a name="line133">133: </a><strong><font color="#228B22">#define PetscTimeAdd(v) {static struct timespec _tp; \</font></strong>
142
<a name="line134">134: </a><strong><font color="#228B22"> getclock(TIMEOFDAY,&_tp); \</font></strong>
143
143
<a name="line135">135: </a><strong><font color="#228B22"> (v)+=((PetscLogDouble)_tp.tv_sec)+(1.0e-9)*(_tp.tv_nsec);}</font></strong>
145
145
<a name="line137">137: </a><font color="#B22222">/* ------------------------------------------------------------------</font>
173
173
<a name="line165">165: </a><font color="#B22222"> The usual Unix time routines.</font>
174
174
<a name="line166">166: </a><font color="#B22222">*/</font>
175
175
<a name="line167">167: </a><font color="#A020F0">#else</font>
176
<a name="line168">168: </a><strong><font color="#228B22">#define PetscTime(v) {static struct timeval _tp; </font></strong>
177
<a name="line169">169: </a><strong><font color="#228B22"> gettimeofday(&_tp,(struct timezone *)0);</font></strong>
176
<a name="line168">168: </a><strong><font color="#228B22">#define PetscTime(v) {static struct timeval _tp; \</font></strong>
177
<a name="line169">169: </a><strong><font color="#228B22"> gettimeofday(&_tp,(struct timezone *)0);\</font></strong>
178
178
<a name="line170">170: </a><strong><font color="#228B22"> (v)=((PetscLogDouble)_tp.tv_sec)+(1.0e-6)*(_tp.tv_usec);}</font></strong>
180
<a name="line172">172: </a><strong><font color="#228B22">#define PetscTimeSubtract(v) {static struct timeval _tp; </font></strong>
181
<a name="line173">173: </a><strong><font color="#228B22"> gettimeofday(&_tp,(struct timezone *)0);</font></strong>
180
<a name="line172">172: </a><strong><font color="#228B22">#define PetscTimeSubtract(v) {static struct timeval _tp; \</font></strong>
181
<a name="line173">173: </a><strong><font color="#228B22"> gettimeofday(&_tp,(struct timezone *)0);\</font></strong>
182
182
<a name="line174">174: </a><strong><font color="#228B22"> (v)-=((PetscLogDouble)_tp.tv_sec)+(1.0e-6)*(_tp.tv_usec);}</font></strong>
184
<a name="line176">176: </a><strong><font color="#228B22">#define PetscTimeAdd(v) {static struct timeval _tp; </font></strong>
185
<a name="line177">177: </a><strong><font color="#228B22"> gettimeofday(&_tp,(struct timezone *)0);</font></strong>
184
<a name="line176">176: </a><strong><font color="#228B22">#define PetscTimeAdd(v) {static struct timeval _tp; \</font></strong>
185
<a name="line177">177: </a><strong><font color="#228B22"> gettimeofday(&_tp,(struct timezone *)0);\</font></strong>
186
186
<a name="line178">178: </a><strong><font color="#228B22"> (v)+=((PetscLogDouble)_tp.tv_sec)+(1.0e-6)*(_tp.tv_usec);}</font></strong>
187
187
<a name="line179">179: </a><font color="#A020F0">#endif</font>