Re: negative elapsed time? (versions?)
by BrowserUk (Patriarch) on Aug 08, 2011 at 15:18 UTC
|
C:\test>junk14
Starting loop
End of loop
C:\test>perl -MTime::HiRes -E"say $Time::HiRes::VERSION"
1.9719
What versions are you running?
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] [d/l] |
|
|
Hi,
I am using:
perl 5, version 12, subversion 4 (v5.12.4) built for MSWin32-x86-multi-thread
This is the sample output I am getting:
Value negative in count: 5940052
t3: 1312816368.122099
t4: 1312816368.121128
Negative or zero value: -0.000970840454101563
Value negative in count: 996932
t3: 1312814653.022737
t4: 1312814653.022737
Negative or zero value: 0
Value negative in count: 996929
t3: 1312814653.023484
t4: 1312814653.023484
Negative or zero value: 0
Value negative in count: 996928
t3: 1312814653.024365
t4: 1312814653.024365
Negative or zero value: 0
Value negative in count: 996926
t3: 1312814653.024980
t4: 1312814653.024980
Negative or zero value: 0
Also, I tested in windows production servers, and I am getting these negative or zero values
| [reply] |
|
|
C:\perl5.14-64\bin>.\perl.exe \test\junk14.pl
Starting loop
End of loop
What versions of Time::HiRes and Windows are you using?
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] [d/l] |
|
|
|
|
Re: negative elapsed time?
by FunkyMonk (Bishop) on Aug 08, 2011 at 15:09 UTC
|
| [reply] [d/l] [select] |
|
|
Hi,
Most of times on windows, I get either negative or zero values, especially when the count value is high.
| [reply] |
Re: negative elapsed time?
by Marshall (Canon) on Aug 08, 2011 at 15:40 UTC
|
This article explains the limitations of the Time Stamp Counter register on multi-core x86 CPU's: Wiki Time Stamp Counter.
Evidently not applicable as Hi:Res does something different? See note from BrowserUk. I am unaware of any hardware source for a high resolution time other than this CPU feature. I'd be curious if somebody knows of some alternative. As article mentions, MS provides an API for times, but it uses this hardware.
| [reply] |
|
|
I am unaware of any hardware source for a high resolution time other than this CPU feature. I'd be curious if somebody knows of some alternative.
On windows, Time::HiRes uses QueryPerformanceCounter + GetSystemTimeAsFileTime. The former is underlain by the most accurate hardware timer available on the PC. This varies (increasing in accuracy) as the age of the hardware lessens.
Since circa 2005, all modern PCs have had a High Precision Event Time available as a part of the hardware. This is unaffected by clock speed energy management and lies outside of the number of cores or hyper-threads.
(Am I too scary to talk to?)
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] |
|
|
| [reply] |
|
|
So, is there way where i could program the code to run on only a single core?
| [reply] |
|
|
AFFINITY The new application will have the specified processor
affinity mask, expressed as a hexadecimal number.
But I do not think that is the problem here. (As might be evidenced by your lack of response to Re^5: negative elapsed time? (versions?)?)
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] [d/l] [select] |
Re: negative elapsed time?
by zentara (Cardinal) on Aug 08, 2011 at 14:58 UTC
|
Please wrap your code in '<code>' tags.
| [reply] |