Timing problems??

Timing problems??

Post by Peter Dalgaard S » Thu, 20 Oct 1994 01:42:23




Quote:>As I do have to do some
>,,benchmarking'' of the programmes, a difference of about 5 hundreds of a
>second is unacceptable

I'd like to see a reasonable answer to this too. It's quite
difficult though: an old UNIX joke is that 'time' really means
'Totally Inaccurate Measure of Execution' (and 'emacs' is 'Eight
Megabytes And Continuous Swapping')
--
   O_   ---- Peter Dalgaard
  c/ /'  --- Dept. of Biostatistics
 ( ) \( ) -- University of Copenhagen

 
 
 

1. System time warping around real time problem - please help

I am using the exact same kernel (a lot of folks are). There
is no such jumping on my system.
Try this program:

#include <stdio.h>
#include <time.h>
int main() {
   time_t x,y;
   (void)time(&x);
   (void)time(&y);
   for(;;) {
       (void)time(&x);
       if(x < y)
           printf("Prev %ld New %ld\n", y, x);
       y = x;
   }
   return 0;
If this shows time jumping around you have one of either:

(1)     Bad timer channel 0 chip (PIT).
(2)     Some daemon trying to sync time with another system.
(3)     You are traveling too close to the speed of light.

Now, your script shows time in fractional seconds.

You can modify the program to do this:

#include <stdio.h>
#include <sys/time.h>
int main() {
   struct timeval tv;
   double x, y;
   (void)gettimeofday(&tv, NULL);
   x = (double) tv.tv_sec * 1e6;
   x += (double) tv.tv_usec;
   y = x;
   for(;;) {
       (void)gettimeofday(&tv, NULL);
       x = (double) tv.tv_sec * 1e6;
       x += (double) tv.tv_usec;
       if(x < y)
           printf("Prev %f New %f\n", y, x);
       y = x;
   }
   return 0;

There should be no jumping around -- and there isn't on
any system I've tested this on.

Hmmm, software should never crash. Even if the timers jump backwards
as you say, they should eventually time-out. If you have crashes, this
may point to other hardware problems as well.

Cheers,
Dick Johnson
Penguin : Linux version 2.4.20 on an i686 machine (797.90 BogoMips).
Why is the government concerned about the lunatic fringe? Think about it.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

2. TVGA 9440

3. KDE 2.1 Beta 2

4. Real Time timing problem

5. CML1 cleanup patch

6. Timing problem running script in cron getting braindead need some guideance

7. C library to deal with mathematical expressions?

8. System time problem

9. Minor Initialization Timing Problem

10. Timed Problem

11. Adaptec 1522A timing problems?

12. Linux Time problem?