=>From: "Manuel A. Matias" <[EMAIL PROTECTED]>
 =>Date:   Tue, 26 Oct 1999 14:05:21 +0200
 =>...
 =>but after 2
 =>days, more or less, strange things happen, and the dual (still
 =>1 job for each CPU) runs something like 4-5 times slower than
 =>the test machine, while it gets completely confused regarding
 dates.

Are you running X?  Do you see mouse problems?  (Jumpy pointer, random
clicks, etc?)  Are you running xntpd?

Could you compile & run the attached program after a reboot, and then
again when things are acting strangely?  (The program checks the time
repeatedly, and reports -- once a second -- the minimum and maximum
delta times seen in the previous second.  The deltas should always be
positive, but I'll bet you see negative deltas when the machine is
behaving weird.)

I've found that recent 2.3.x kernels work better on my 2xPIII box; you
may wish to try one of them if the test program indicates negative
time steps.

Regards,
d.

#include <stdio.h>
#include <sys/types.h>
#include <time.h>
#include <sys/time.h>
#include <unistd.h>

inline long
timeval_diff( const struct timeval *a, const struct timeval *b )
{
        if (a->tv_sec < b->tv_sec ||
                (a->tv_sec == b->tv_sec && a->tv_usec < b->tv_usec))
                return -((b->tv_sec - a->tv_sec) * 1000000 + (b->tv_usec-a->tv_usec));
        else
                return (a->tv_sec - b->tv_sec) * 1000000 + (a->tv_usec - b->tv_usec);
}

int
main( int argc, char **argv )
{
        struct timeval   now;
        struct timeval   then;
        unsigned long    n_fwd = 0;
        long                     max_fwd = 0;
        unsigned long    n_back = 0;
        long                     max_back = 0;
        time_t                   last_log = time( 0 );

        gettimeofday( &then, 0 );
        
        for ( ; ; ) {
                long     delta;
                
                gettimeofday( &now, 0 );

                delta = timeval_diff( &now, &then );

                if (delta >= 0)
                        ++n_fwd;
                else
                        ++n_back;

                if (delta > max_fwd)
                        max_fwd = delta;
                else
                if (delta < max_back)
                        max_back = delta;

                if (now.tv_sec >= last_log + 1) {
                        printf( "%.19s FWD:%6ld/%6ld:BACK (%4ldus > delta > %4ldus)\n",
                                        ctime( &now.tv_sec ),
                                   n_fwd, n_back, max_back, max_fwd );
                        n_fwd = n_back = 0;
                        max_fwd = max_back = 0;
                        last_log = now.tv_sec;
                }

                then = now;
        }

        return 0;
}
-
Linux SMP list: FIRST see FAQ at http://www.irisa.fr/prive/dmentre/smp-howto/
To Unsubscribe: send "unsubscribe linux-smp" to [EMAIL PROTECTED]

Reply via email to