/[MITgcm]/MITgcm_contrib/heimbach/OpenAD/code_shallow_openad/timeRatio.c
ViewVC logotype

Diff of /MITgcm_contrib/heimbach/OpenAD/code_shallow_openad/timeRatio.c

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

revision 1.1 by utke, Sun Oct 29 05:19:33 2006 UTC revision 1.2 by utke, Mon Oct 30 17:20:05 2006 UTC
# Line 2  Line 2 
2  #include <stdio.h>  #include <stdio.h>
3    
4  void timeratio_() {  void timeratio_() {
5    /* three invocations produce    /*
6         three invocations produce
7       the ratio of the timedifference of       the ratio of the timedifference of
8       the 3rd vs. the 2nd invocation over       the 3rd vs. the 2nd invocation over
9       the difference of the 2nd vs. the 1st invocation       the difference of the 2nd vs. the 1st invocation
10    */    */
11    static short stage=0;    static short stage=0;
12    #define tvCount 3  #define tvCount 3
13    static struct timeval tv_a[tvCount];    static struct timeval tv_a[tvCount];
14    double deltaThis, deltaPrevious;    double deltaThis, deltaPrevious;
15    if (stage<tvCount)    if (stage<tvCount)
# Line 17  void timeratio_() { Line 18  void timeratio_() {
18           stage,           stage,
19           tv_a[stage].tv_sec,           tv_a[stage].tv_sec,
20           tv_a[stage].tv_usec);           tv_a[stage].tv_usec);
21    if (stage>0)    if (stage>0) {
22      printf("JU: TIMING: delta stamps %i-%i: %i.%06i\n",      printf("JU: TIMING: delta stamps %i-%i: %i.%06i\n",
23             stage,             stage,
24             stage-1,             stage-1,
25             (tv_a[stage].tv_usec<tv_a[stage-1].tv_usec)?tv_a[stage].tv_sec-tv_a[stage-1].tv_sec-1:tv_a[stage].tv_sec-tv_a[stage-1].tv_sec,             (tv_a[stage].tv_usec<tv_a[stage-1].tv_usec)?tv_a[stage].tv_sec-tv_a[stage-1].tv_sec-1:tv_a[stage].tv_sec-tv_a[stage-1].tv_sec,
26             (tv_a[stage].tv_usec<tv_a[stage-1].tv_usec)?1000000-(tv_a[stage-1].tv_usec-tv_a[stage].tv_usec):tv_a[stage].tv_usec-tv_a[stage-1].tv_usec);             (tv_a[stage].tv_usec<tv_a[stage-1].tv_usec)?1000000-(tv_a[stage-1].tv_usec-tv_a[stage].tv_usec):tv_a[stage].tv_usec-tv_a[stage-1].tv_usec);
27      }
28      if (stage>1) {
29        printf("JU: TIMING: delta stamps %i-%i: %i.%06i\n",
30               stage,
31               0,
32               (tv_a[stage].tv_usec<tv_a[0].tv_usec)?tv_a[stage].tv_sec-tv_a[0].tv_sec-1:tv_a[stage].tv_sec-tv_a[0].tv_sec,
33               (tv_a[stage].tv_usec<tv_a[0].tv_usec)?1000000-(tv_a[0].tv_usec-tv_a[stage].tv_usec):tv_a[stage].tv_usec-tv_a[0].tv_usec);
34      }
35    if (stage==tvCount-1 && stage>1) {    if (stage==tvCount-1 && stage>1) {
36      deltaThis=(tv_a[stage].tv_usec<tv_a[stage-1].tv_usec)?tv_a[stage].tv_sec-tv_a[stage-1].tv_sec-1:tv_a[stage].tv_sec-tv_a[stage-1].tv_sec;      deltaThis=(tv_a[stage].tv_usec<tv_a[stage-1].tv_usec)?tv_a[stage].tv_sec-tv_a[stage-1].tv_sec-1:tv_a[stage].tv_sec-tv_a[stage-1].tv_sec;
37      deltaThis*=1.0e6;      deltaThis*=1.0e6;

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.22