in reply to negative elapsed time?

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.

Replies are listed 'Best First'.
Re^2: negative elapsed time?
by BrowserUk (Patriarch) on Aug 08, 2011 at 18:43 UTC
    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.
Re^2: negative elapsed time? (misinformation)
by BrowserUk (Patriarch) on Aug 08, 2011 at 15:48 UTC
    This article explains the limitations of the Time Stamp Counter register on multi-core x86 CPU's

    Which would be good information to post if Time::HiRes actually used the TSC!


    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.
Re^2: negative elapsed time?
by saneel (Initiate) on Aug 08, 2011 at 15:44 UTC
    So, is there way where i could program the code to run on only a single core?
      So, is there way where i could program the code to run on only a single core?

      Yes. See the /AFFINITY switch to the windows start command:

      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.