Uploaded image for project: 'Core ReactOS'
  1. Core ReactOS
  2. CORE-13206

System properties shows 1.00 GHz hardcoded CPU frequency

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 0.4.15
    • NTCore
    • None

    Description

      System properties dialog shows hardcoded CPU frequency equal to 1.00 GHz.

      The algorithm found on one of the forums. It works well in Windows (tested on different computers), but in ROS, its readings are somewhat overestimated. Perhaps there are errors in ROS, because of which the result differs from the result in Windows. As if there were no, based on it, you can calculate the actual frequency of the processor and use its value for the needs of the system. Test programm attached.

      function GetCPUSpeed: Double;
      const DelayTime = 500;
      var
      TimerHi : DWORD; 
      TimerLo : DWORD; 
      PriorityClass : Integer;
      Priority : Integer; 
      begin 
       PriorityClass := GetPriorityClass(GetCurrentProcess);
       Priority := GetThreadPriority(GetCurrentThread);
       SetPriorityClass(GetCurrentProcess, REALTIME_PRIORITY_CLASS);
       SetThreadPriority(GetCurrentThread, THREAD_PRIORITY_TIME_CRITICAL);
       Sleep(10);
       asm 
        DW 310Fh // rdtsc 
        MOV TimerLo, EAX 
        MOV TimerHi, EDX 
       end; 
       Sleep(DelayTime);
       asm
        DW 310Fh // rdtsc 
        SUB EAX, TimerLo 
        SBB EDX, TimerHi 
        MOV TimerLo, EAX 
        MOV TimerHi, EDX 
       end; 
       SetThreadPriority(GetCurrentThread, Priority); 
       SetPriorityClass(GetCurrentProcess, PriorityClass);
       Result := TimerLo / (1000.0 * DelayTime); 
      end;
      

      Attachments

        1. GetCPUClock.rar
          162 kB
          amber

        Issue Links

          Activity

            People

              binarymaster Stas'M
              amber amber
              Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: