From owner-freebsd-hackers Wed Sep 10 23:54:01 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id XAA02823 for hackers-outgoing; Wed, 10 Sep 1997 23:54:01 -0700 (PDT) Received: from counterintelligence.ml.org (mdean.vip.best.com [206.86.94.101]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id XAA02816 for ; Wed, 10 Sep 1997 23:53:56 -0700 (PDT) Received: from localhost (jamil@localhost) by counterintelligence.ml.org (8.8.7/8.8.5) with SMTP id XAA26548; Wed, 10 Sep 1997 23:53:19 -0700 (PDT) Date: Wed, 10 Sep 1997 23:53:18 -0700 (PDT) From: "Jamil J. Weatherbee" To: Mike Smith cc: freebsd-hackers@freebsd.org Subject: Re: Realtime Programming Under FreeBSD? In-Reply-To: <199709100217.MAA00765@word.smith.net.au> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk 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 > >