CPU Usage (%) from API?? 
Author Message
 CPU Usage (%) from API??

How do you get the CPU usage from the API?  Any help appreciated!



Sat, 21 Oct 2000 03:00:00 GMT  
 CPU Usage (%) from API??

Public Const REG_DWORD = 4
Public Const HKEY_DYN_DATA = &H80000006
Public Declare Function RegQueryValueEx Lib "advapi32.dll" Alias
"RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal
lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long
Public Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA"
(ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Public Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long)
As Long

Public Function CPUUsage() As Integer
  Dim hKey As Long
  Dim dwType As Long, dwData As Long, dwSize As Long

  If RegOpenKey(HKEY_DYN_DATA, "PerfStats\StatData", hKey) = 0 Then

    dwType = REG_DWORD
    dwSize = 4
    RegQueryValueEx hKey, "KERNEL\CPUUsage", 0, dwType, dwData, dwSize
    RegCloseKey hKey

  End If

  CPUUsage = dwData

End Function

Quote:

>How do you get the CPU usage from the API?  Any help appreciated!



Sun, 22 Oct 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Process CPU Usage/Memory Usage

2. 100% CPU usage

3. CPU usage while running queries

4. Reduce maximum CPU-Usage

5. Lower CPU Usage

6. Timers cpu usage

7. CPU Usage Info

8. Determine the CPU usage

9. Win32_Process ( CPU Usage ) Issue

10. parse-cpu usage

11. CPU Usage % Slammed at MAXIMUM - Someone help

12. Hihg CPU Usage in the loop

 

 
Powered by phpBB® Forum Software