Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Sep 1997 23:53:18 -0700 (PDT)
From:      "Jamil J. Weatherbee" <jamil@counterintelligence.ml.org>
To:        Mike Smith <mike@smith.net.au>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Realtime Programming Under FreeBSD? 
Message-ID:  <Pine.BSF.3.96.970910234736.19803A-100000@counterintelligence.ml.org>
In-Reply-To: <199709100217.MAA00765@word.smith.net.au>

next in thread | previous in thread | raw e-mail | index | archive | help

No, I would use a select loop but the general idea is that you have a
whole lot events (in the form of writing a packet to a socket or something
to a serial port) that you want to be able to coordinate in time ---->

If for instance I wanted to do this cyclically:

send 0xff ----> port 0x260
wait 37ms
send 0x00 ----> port 0x260
wait 45ms
sample the value @ 0x200
etc.

in a user process I would simply use /dev/io and I don't think I want to
make my application a driver I simply want to be able to time events on
1ms frames (not necessarily exactly just close), on a modern machine ---
running at 200mhz or so there are a lot of clock cycles in between frames,
so the overhead of doing this (say in assembly) is not significant --- I
have tried putting HZ=1000 and this breaks LOTS of things most notably and
important for me: xntpd and it only really gives 500hz at best.




On Wed, 10 Sep 1997, Mike Smith wrote:

> > 
> > Can someone give a code snippet of the BEST way of running a 1000HZ for
> > loop under freebsd, without consuming massive amounts of cpu time.
> 
> How about you tell us what you're actually trying to do?  It sounds 
> like you want to poll something at a fixed 1KHz rate, which is a) 
> uncivilised and b) not terribly easy without fiddling.
> 
> If this is what you're after, look at the 'pcaudio' driver, which 
> fiddles one of the timers to arrange a fast regular interrupt.
> 
> mike
> 
> 




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.970910234736.19803A-100000>