On Mon, 24 Oct 2005, Serge Goodenko wrote:

> > Also, HZ (i.e. the timer interrupt) is implemented using signals (i.e. 
> > alarm()), which are both slow and not precise (no more than host 
> > jiffies).

> hm.. this suggests that maybe it would be really better not to use 
> jiffies in UML (in my case), but some API?

I've been following this thread and I got curious...  On the host, 
gettimeofday gives microsecond resolution, according to comments.
See ./arch/i386/kernel/time.c; this is all from kernel 2.6.11.4.
Per ./arch/um/kernel/time.c, within UML do_gettimeofday just calls the 
host's gettimeofday.

./drivers/char/random.c illustrates how to use it in a driver: just
        struct timeval tv;
        do_gettimeofday(&tv);
        seconds = tv.tv_sec;
        usecs = tv.tv_usec;

do_gettimeofday has only quick operations, e.g. read timestamp counter 
(this in cur_timer->get_offset()), one multiply and a few additions.  This 
really would give microsecond resolution on a modern machine that has a 
timestamp counter.  There's a fallback for older machines, non-Pentium I 
think.

James F. Carter          Voice 310 825 2897    FAX 310 206 6673
UCLA-Mathnet;  6115 MSA; 405 Hilgard Ave.; Los Angeles, CA, USA 90095-1555
Email: [EMAIL PROTECTED]  http://www.math.ucla.edu/~jimc (q.v. for PGP key)


-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
User-mode-linux-user mailing list
User-mode-linux-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user

Reply via email to