Получить числовое значение тактовой частоты процессора в определенный момент времени - VB
Формулировка задачи:
Доброго времени суток. Подскажите можно ли как то получить числовое значение тактовой частоты процессора в определенный момент времени? имеется в виду по нажатию на кнопку когда это нужно.
Решение задачи: «Получить числовое значение тактовой частоты процессора в определенный момент времени»
textual
Листинг программы
- Option Explicit
- Private Type SYSTEM_INFO
- dwOemID As Long
- dwPageSize As Long
- lpMinimumApplicationAddress As Long
- lpMaximumApplicationAddress As Long
- dwActiveProcessorMask As Long
- dwNumberOrfProcessors As Long
- dwProcessorType As Long
- dwAllocationGranularity As Long
- dwReserved As Long
- End Type
- Private Type PROCESSOR_POWER_INFORMATION
- Number As Long
- MaxMhz As Long
- CurrentMhz As Long
- MhzLimit As Long
- MaxIdleState As Long
- CurrentIdleState As Long
- End Type
- Private Declare Function CallNtPowerInformation Lib "PowrProf" (ByVal InformationLevel As Long, lpInputBuffer As Any, ByVal nInputBufferSize As Long, lpOutputBuffer As Any, ByVal nOutputBufferSize As Long) As Long
- Private Declare Sub GetSystemInfo Lib "kernel32" (lpSystemInfo As SYSTEM_INFO)
- Private Const ProcessorInformation As Long = 11
- Private Sub Form_Click()
- Dim si As SYSTEM_INFO
- Dim p() As PROCESSOR_POWER_INFORMATION
- Dim i As Long
- GetSystemInfo si
- ReDim p(si.dwNumberOrfProcessors - 1)
- CallNtPowerInformation ProcessorInformation, ByVal 0&, 0, p(0), Len(p(0)) * si.dwNumberOrfProcessors
- Cls
- For i = 0 To si.dwNumberOrfProcessors - 1
- Print "Processor: " & p(i).Number
- Print "Current: " & p(i).CurrentMhz & " Mhz"
- Next
- End Sub
ИИ поможет Вам:
- решить любую задачу по программированию
- объяснить код
- расставить комментарии в коде
- и т.д