Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8702993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:46:58+00:00 2026-06-13T02:46:58+00:00

.Net has support for high resolution timing using the System.Diagnostics.Stopwatch class. I understand that

  • 0

.Net has support for high resolution timing using the System.Diagnostics.Stopwatch class. I understand that the specific resolution that this class uses differs depending on the underlying hardware and can be obtained via the static property Stopwatch.Frequency.

This frequency appears to be related to CPU frequency and Stopwatch reads this value and stores it in a static class variable within a static initializer/constructor. Hence I’m now wondering if this class will report incorrect timings if the CPU clock changes? e.g. in systems that alter the CPU clock depending system load.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T02:46:59+00:00Added an answer on June 13, 2026 at 2:46 am

    MSDN:

    *The Frequency value depends on the resolution of the underlying timing mechanism. If the installed hardware and operating system support a high-resolution performance counter, then the Frequency value reflects the frequency of that counter. Otherwise, the Frequency value is based on the system timer frequency.*

    The source of the Stopwatch.Frequency is not the CPU frequency. It is the frequency of a high frequency hardware counter. On windows this counter frequency is typically also read by a call to the QueryPerformanceCounter function while on linux High Resolution POSIX Timers are used to get high resolution timing.

    The use of Time Stamp Counter (RDTSC – CPU frequency) is often discussed in this context but has no real relevance:

    Some older hardware may not provide any high frequency hardware for timing purposes, thus the frequency of the CPU is used as a replacement. When using the CPU frequency for timing it needs to be secured that the frequency does remain constant. More modern hardware provides dynamic CPU frequency modification. Using the CPU freqency as a measure while it is dynamically modified would end in a messs.

    Fortunately this is non existing situation. Systems which can modify their CPU frequency are more modern. Such modern systems also do have a separate high frequency timer hardware High Precision Event Timer.

    There are some rumors about using the CPU frequency on multicore systems. In fact there has been a problem with certain hardware. But that’s long time ago and fixed for some time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

ScottGu says .NET MVC 2.0 has built in DataAnnotation support, I think that means
This question is about the public key that every .NET assembly has AFAIK (looking
Is there a open source .NET CMS that has support for Arabic language? Anyone
I understand the .NET 4 Framework has caching support built into it. Does anyone
The Application class in asp.net has Lock mechanism to support thread safety. As we
I am using ASP.NET and on ASP.NET page has validate attribute which checks for
We have a data driven ASP.NET website which has been written using the standard
ASP.NET MVC has good support for role-based security, but the usage of strings as
The .NET Framework has unmanaged debugging and profiling APIs that I assume people/companies are
I've inherited an ASP.NET web site that has an SSL certificate bought via GoDaddy.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.