[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [rtl] Simple thread, massive glitch



> > > Delay of 1141792ns near  937517ms
> > > Delay of 1224000ns near 1530446ms
> > 

> >        rtl_no_interrupts(irqstate);		// disable all interrupts
> >  
> >        tick_time = clock_gethrtime(CLOCK_REALTIME);	//check time
> >        tock_time = clock_gethrtime(CLOCK_REALTIME);	//check time
> >        delay     = (long)(tock_time - tick_time);	//find difference
> >  
> >        rtl_restore_interrupts(irqstate);	// reenable interrupts

This means either something is preempting the system with rtl_no_interrupts()
(rather impossible) OR that  reported time has glitches OR that reading the
clock may take very long time. I would guess that something locks ISA bus
from  time to time and then you can not read the time.

Make sure APM is switched OFF in BIOS (or test with different settings). Try
to change other chipset settings in BIOS.

Please try to use Pentium clock (TSC) instead of your current
clock_gethrtime.

Try: 
#define  RDTSC(h,l)   __asm__ volatile ("rdtsc" : "=a"(l) , "=d"(h))

where unsigned int h is the high 32 bits, and l is low 32 bits. 
You will need to know the clock frequency to convert to ns.

Best regards,
--
Tomek