Re: Timers
From: Thomas Matthews (Thomas_MatthewsSpitsOnSpamBots_at_sbcglobal.net)
Date: 08/11/04
- Next message: RCollins: "Re: File seek"
- Previous message: Arthur J. O'Dwyer: "Re: How not to abuse a "for loop": examples?"
- Maybe in reply to: Jens.Toerring_at_physik.fu-berlin.de: "Re: Timers"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 11 Aug 2004 13:48:37 GMT
George wrote:
> I have created a program that sends msgs at certain rate. What is the
> best way to do this so that I get a consistent rate all the time?
> For example I want to send 5000 msgs per second, and 1000 msgs per
> second.
> I have used "usleep" and most of the time I get way less than what I
> expect mainly do to system interrupt.
>
> How do I get time to print like the following 3:12:30.83884838?
>
> Thanks
> George
The best method is to have your operating system
execute your function at a given time interval.
This is all operating system specific and best
answered in a newsgroup about your O.S.
For example, if your platform has an interrupt
that fires every millisecond, you could have
the interrupt call your function that sends out
a message (one of the 1000 per second).
--
Thomas Matthews
C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.comeaucomputing.com/learn/faq/
Other sites:
http://www.josuttis.com -- C++ STL Library book
- Next message: RCollins: "Re: File seek"
- Previous message: Arthur J. O'Dwyer: "Re: How not to abuse a "for loop": examples?"
- Maybe in reply to: Jens.Toerring_at_physik.fu-berlin.de: "Re: Timers"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|