Need some help in getting the CPU Frequency

后端 未结 3 1276
遥遥无期
遥遥无期 2020-12-09 14:25

I\'m trying to make a C# software that reads information about the CPU and displays them to the user (just like CPU-Z). My current problem is that I\'ve failed to find a wa

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-09 14:35

    Your question is fundamentally unanswerable. CPU frequencies change constantly. Sometimes the OS knows about the changes and can tell you, but sometimes it does not. CPUs may overclock themselves (TurboBoost) or underclock themselves (due to overheating). Some processors reduce power to avoid melting by running the clock at the same rate but only doing work on some cycles, at which point the entire concept of clock frequency is meaningless.

    In this post I talk about a significant number of machines that I analyze where the CPU was being thermally throttled without Windows noticing.

    http://randomascii.wordpress.com/2013/08/06/defective-heat-sinks-causing-garbage-gaming/

    It is possible to write some messy code that is very processor specific to detect this but it requires administrator privileges.

    My point is that you are asking an unanswerable question and, in most cases, it is not a question that you should be asking. Use the value in the registry, or ask Windows what frequency it things the CPU is running at (see PROCESSOR_POWER_INFORMATION) and call that good enough.

提交回复
热议问题