=>From: Mordy Ovits <[EMAIL PROTECTED]>
 =>...
 =>My mouse is acting funny under Linux SMP.

Could you compile & run the program below when your mouse isn't
working right?  It calls gettimeofday() in a tight loop and reports
what it found once a second.  You should see lines like:

    Tue Oct 19 09:43:15 FWD:501936/     0:BACK (   0us > delta > 10860us)
    Tue Oct 19 09:43:16 FWD:810266/     0:BACK (   0us > delta > 10809us)

If you start seeing anything besides 0 in the BACK position, or a
negative minimum delta, then we may have a similar problem.  (If
you're running xntpd, turn it off and then reboot to make sure the
kernel's not doing a time adjustment.)

I'm running 2.3.18 plus Ingo Molnar's H5 patch on a 2xPIII, RH6.1,
with an ATI Mach64 card.  When I use XF86, things seem to be stable,
but I also have (and would like to use) XiG's accelerated server.
When I use it, though, the mouse goes crazy after a while.  (I believe
that's caused by negative time steps, but I don't know what causes the
negative steps.)

Anyway, let me know.

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/mentre/smp-faq/
To Unsubscribe: send "unsubscribe linux-smp" to [EMAIL PROTECTED]

Reply via email to