[uCsimm] BOUNCE ucsimm@uClinux.com: Admin request of type /^sub\b/i at line 9

From: mdurrant@lineo.ca
Date: Wed Aug 09 2000 - 21:47:49 EDT


                                                                                                                    
                    owner-ucsimm@u
                    Clinux.com To: mdurrant@uClinux.com
                                          cc:
                    08/08/00 06:54 Subject: BOUNCE ucsimm@uClinux.com: Admin request of type /^sub\b/i
                    PM at line 9
                                                                                                                    
                                                                                                                    

> Has anyone been able to get greater timing accuracy that 10msec on the
> ucsimm? I am using gettimeofday() and it is only accurate to the nearest
> 10msec but the things I am trying to measure are in that order of time :
( I
> also don't have many MIPS to spare for the timing so don't suggest using
a
> for loop :)

S.ub-HZ resolution is provided by the call to mach_gettimeoffset() (if
defined) in do_gettimeofday() in arch/m68knommu/kernel/time.c. For uClinux
this points to BSP_gettimeoffset() in
arch/m68knommu/platform/68EZ328/config.c.

I added the following function to kernel/sched.c (so I wouldn't have to
export lost_ticks):

unsigned long
get_lost_ticks(void)
{
        return lost_ticks;
}

and then changed BSP_gettimeoffset() to:

unsigned long
BSP_gettimeoffset(void)
{
        unsigned short count;
        unsigned long lost_ticks;
        unsigned long deltat;

        /* pick this up as quickly as possible */
        count = TCN;

        lost_ticks = get_lost_ticks();

        /* take care to preserve accuracy and prevent overflow */
        /* NOTE: with TCMP set to 0xd7e4 (55268), HZ must be >= 16 */
        deltat = (lost_ticks * 1000000) / HZ;
        deltat = (count * (1000000 / HZ)) / TCMP;

        return deltat;
}

Cheers,

Henk Hesselink
Anda Consulting

This message resent by the ucsimm@uclinux.com list server http://www.uClinux.com/



This archive was generated by hypermail 2b30 : Sun Apr 07 2002 - 00:01:37 EST