- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- about using "select()" and "poll()" as timer
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2002 06:51 PM
05-28-2002 06:51 PM
about using "select()" and "poll()" as timer
Does anyone has experience on using select() or poll() calls as timer on 11i? When I do it, I find that select() actually sleeps 30 milli seconds even passed the parameter 20 milliseconds. "
timeout.tv_sec = 0;
timeout.tv_usec = 20000;
select(1,NULL,NULL,NULL, &timeout);
When use poll(), the same problem exists. How to solve it? Does anyone have other method for timer which precision is better than 10 millisecond which is for select() or poll()?
Thanks!
bo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2002 05:09 AM
05-29-2002 05:09 AM
Re: about using "select()" and "poll()" as timer
the time resolution of the system clock is documented by the constant HZ in /ust/include/sys/time.h. It is typically set to 100 (cycles per second) corresponding to 10 ms. So your expectations are very hard at the limit of what is possible.
To find out, why the delay was 30 ms, and not 20 ms, it is necessary to ask, how did you measure the time. Besides the time for the system call you have to consider the latency times needed for the process management of HPUX.
Klaus
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2002 06:05 AM
05-29-2002 06:05 AM
Re: about using "select()" and "poll()" as timer
Hi,
using select() and poll() as a timer
is an abuse of these calls.
You should use nanosleep()
Regards
Olav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2002 06:05 PM
05-29-2002 06:05 PM
Re: about using "select()" and "poll()" as timer
I use gettimeofday() to measure the time spent on the select() or poll() calls.
Olav,
Just tested nanosleep, I can't control the precise time, passing the 10000000 ns parameter in, the result varies as 19 ms, 13 ms, 12ms ...
Very thankful for your attentions!!
bo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2002 08:46 AM
05-30-2002 08:46 AM
Re: about using "select()" and "poll()" as timer
=== Tang Zhibo wrote:
> I use gettimeofday() to measure the time
> spent on the select() or poll() calls.
gettimeofday(2) is known to be rather slow... You might want to measure with gethrtime(2) which comes with PHCO_23092. See also:
http://h21007.www2.hp.com/hpux-devtools/CXX/hpux-devtools.0201/0091.html
Kiran