- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- getting reliable ellapsed time
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
09-29-2003 03:10 AM
09-29-2003 03:10 AM
getting reliable ellapsed time
I have some trouble to get reliable information on ellapsed time measurement.
I use gettimeofday call fot that purpose but sometimes the ellapsed time I get is negative.
Here is the algorithm I use:
long m8_curBegPro;
long m8_endProcess;
long l8_durTrt;
gettimeofday(&lc_timeval, NULL);
m8_curBegPro = byte8(lc_timeval.tv_sec) * 1000LL +
byte8(lc_timeval.tv_usec) / 1000LL;
{
// some code ... (switch to an other thread)
}
gettimeofday(&lc_timeval, NULL);
lc_sReqTimes.m8_endProcess = byte8(lc_timeval.tv_sec) * 1000LL +
byte8(lc_timeval.tv_usec) / 1000LL;
// do the calculation
l8_durTrt = m8_endProcess - m8_curBegPro;
// l8_durTrt is sometimes < 0;
What is going wrong?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2003 03:29 AM
09-29-2003 03:29 AM
Re: getting reliable ellapsed time
if you are running 11.11 take care to have PHKL_27727 installed.
Best regards...
Dietmar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2003 03:37 AM
09-29-2003 03:37 AM
Re: getting reliable ellapsed time
I am running on HP 11.0 on Stratus bi-processor boxes.
When I run on HP boxes I don't seem to have the problem.
Is there a patch on PA equivalent to the 11.11 one?
By the way, The code I mentionned above is not the good one: I used to initialise a tz structure as the second parameter. I just changed it now to NULL. COuld it be the reason why I'm getting these incorrect values?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2003 04:34 AM
09-29-2003 04:34 AM
Re: getting reliable ellapsed time
the problem I had in mind was never present on 11.00. A correspondung 11.00 patch _would_ be PHKL_28766... but this patch covers a lot more modules.
The algorithms to guarantee consistant and well performing gettimeofday() results on MP systems are not that trivial and tightly bound to the underlying hardware design. Since you don't see the symptom on genuine HP systems, I would suggest to 1) try the above patch and then 2) call Stratus to see if this is a known issue for them.
Best regards...
Dietmar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2003 04:39 AM
09-29-2003 04:39 AM
Re: getting reliable ellapsed time
1.) From gettimeofday man page:
If tzp is not a null pointer, the behaviour is unspecified.
You are using NULL, so the behaviour is unspecified which means the call could fail.
2.) You aren't checking the return value of gettimeofday to see if the call failed for some reason (!0).
3.) Finally, I noticed you are assigning the second time to lc_sReqTimes.m8_endProcess, but then when calculating the duration, you are using m8_endProcess which hasn't been initialized, so it could be 0, a negative, or anything else. 0 - positve = negative.
I think you need to change the assignment to:
m8_endProcess = byte8(lc_timeval.tv_sec) * 1000LL + byte8(lc_timeval.tv_usec) / 1000LL;
HTH.