| 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) |
| 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; |