5

Sorry, it is always true! Edited...


I've just realised that Stopwatch.IsHighResolution returns false in my machine. Why? What is needed to it return true? What kind of hardware? MSDN do not say much about that.

Machine config: Win 7 x64; i7 930; 3x2 GB (tripple chanel); HD 500 GB 7200 RPM; Energy config CPU @ 100%


as requested: VS 2010; .NET 4.0; Win form application; debug mode (I will test in release now)


In release mode it returns true! :) well, sorry folks, actualy it is always true (debug and release).

H H
  • 263,252
  • 30
  • 330
  • 514
Pedro77
  • 5,176
  • 7
  • 61
  • 91

1 Answers1

2

It could be that you don't have permissions for the high-resolution performance counters or that your hardware doesn't have that feature to back the high-resolution performance counters.

Peter Ritchie
  • 35,463
  • 9
  • 80
  • 98
  • Does it have to do with the motherboard? CPU? How can I find where is the problem? I'm logged as admin and the VS is running as admin too. – Pedro77 Aug 03 '12 at 20:55
  • 5
    You could call the Win32 API [`QueryPerformanceFrequency`](http://msdn.microsoft.com/en-us/library/windows/desktop/ms644905(v=vs.85).aspx) (which is what IsHighResolution uses), and use GetLastError() to see what it indicates. – vcsjones Aug 03 '12 at 20:57
  • Documentation only details "hardware". IsHighResolution is populated from the result of calling the win32 function QueryPerformanceFrequency. See http://msdn.microsoft.com/en-us/library/windows/desktop/ms644905(v=vs.85).aspx for more details. – Peter Ritchie Aug 03 '12 at 20:58